/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QBSPTREE_P_H #define QBSPTREE_P_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists for the convenience // of other Qt classes. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include #include #include QT_BEGIN_NAMESPACE class QBspTree { public: struct Node { enum Type { None = 0, VerticalPlane = 1, HorizontalPlane = 2, Both = 3 }; inline Node() : pos(0), type(None) {} int pos; Type type; }; typedef Node::Type NodeType; struct Data { Data(void *p) : ptr(p) {} Data(int n) : i(n) {} union { void *ptr; int i; }; }; typedef QBspTree::Data QBspTreeData; typedef void callback(QVector &leaf, const QRect &area, uint visited, QBspTreeData data); QBspTree(); void create(int n, int d = -1); void destroy(); inline void init(const QRect &area, NodeType type) { init(area, depth, type, 0); } void climbTree(const QRect &rect, callback *function, QBspTreeData data); inline int leafCount() const { return leaves.count(); } inline QVector &leaf(int i) { return leaves[i]; } inline void insertLeaf(const QRect &r, int i) { climbTree(r, &insert, i, 0); } inline void removeLeaf(const QRect &r, int i) { climbTree(r, &remove, i, 0); } protected: void init(const QRect &area, int depth, NodeType type, int index); void climbTree(const QRect &rect, callback *function, QBspTreeData data, int index); inline int parentIndex(int i) const { return (i & 1) ? ((i - 1) / 2) : ((i - 2) / 2); } inline int firstChildIndex(int i) const { return ((i * 2) + 1); } static void insert(QVector &leaf, const QRect &area, uint visited, QBspTreeData data); static void remove(QVector &leaf, const QRect &area, uint visited, QBspTreeData data); private: uint depth; mutable uint visited; QVector nodes; mutable QVector< QVector > leaves; // the leaves are just indices into the items }; QT_END_NAMESPACE #endif // QBSPTREE_P_H elease/2.1.x'>upstream/release/2.1.x Vendor branches of https://github.com/llvm/llvm-project.git
summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* StructurizeCFG: Relax uniformity checks.Neil Henning2019-05-241-1/+107
| | | | | | | | | | | | | | | This change relaxes the checks for hasOnlyUniformBranches such that our region is uniform if: 1. All conditional branches that are direct children are uniform. 2. And either: a. All sub-regions are uniform. b. There is one or less conditional branches among the direct children. Differential Revision: https://reviews.llvm.org/D62198 llvm-svn: 361610
* Revert "Temporarily Revert "Add basic loop fusion pass.""Eric Christopher2019-04-1717-0/+1093
| | | | | | | | The reversion apparently deleted the test/Transforms directory. Will be re-reverting again. llvm-svn: 358552
* Temporarily Revert "Add basic loop fusion pass."Eric Christopher2019-04-1717-1093/+0
| | | | | | | | As it's causing some bot failures (and per request from kbarton). This reverts commit r358543/ab70da07286e618016e78247e4a24fcb84077fda. llvm-svn: 358546
* StructurizeCFG: Simplify inserted PHI nodesNicolai Haehnle2018-10-173-22/+19
| | | | | | | | | | | | | | | Summary: This improves subsequent divergence analysis in some cases. Change-Id: I5e95e7ec7fd3fa80d414d1a53a02fea23e3d67d3 Reviewers: arsenm, rampitec Subscribers: jvesely, wdng, llvm-commits Differential Revision: https://reviews.llvm.org/D53316 llvm-svn: 344697
* StructurizeCFG,AMDGPU: Test case of a redundant phi and codegen consequencesNicolai Haehnle2018-10-151-0/+45
| | | | | Change-Id: I9681f9e41ca30f82576f3d1f965c3a550a34b171 llvm-svn: 344569
* AMDGPU: Fix tests using old number for constant address spaceMatt Arsenault2018-09-101-1/+1
| | | | llvm-svn: 341770
* StructurizeCFG: Adjust the loop depth for a subregion to order the nodes ↵Changpeng Fang2018-05-231-0/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | correctly Summary: StructurizeCFG::orderNodes basically uses a reverse post-order (RPO) traversal of the region list to get the order. The only problem with it is that sometimes backedges for outer loops will be visited before backedges for inner loops. To solve this problem, a loop depth based approach has been used to make sure all blocks in this loop has been visited before moving on to outer loop. However, we found a problem for a SubRegion which is a loop itself: --> BB1 --> BB2 --> BB3 --> In this case, BB2 is a SubRegion (loop), and thus its loopdepth is different than that of BB1 and BB3. This fact will lead BB2 to be placed in the wrong order. In this work, we treat the SubRegion as a special case and use its exit block to determine the loop and its depth to guard the sorting. Reviewers: arsenm, jlebar Differential Revision: https://reviews.llvm.org/D46912 llvm-svn: 333111
* StructurizeCFG: fix inverting conditionsMarek Olsak2018-05-151-0/+30
| | | | | | | | | | | | | | | | Author: Samuel Pitoiset Without this patch, it appears to me that we are selecting the wrong operand when inverting conditions. In the attached test, it will select %tmp3 instead of %tmp4. To fix it, just use 'A' as everywhere. This fixes a regression introduced by "[PatternMatch] define m_Not using m_Xor and cst_pred_ty" https://reviews.llvm.org/D46351 llvm-svn: 332403
* StructurizeCFG: Test for branch divergence correctlyNicolai Haehnle2018-04-041-0/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes cases like the new test @nonuniform. In that test, %cc itself is a uniform value; however, when reading it after the end of the loop in basic block %if, its value is effectively non-uniform, so the branch is non-uniform. This problem was encountered in https://bugs.freedesktop.org/show_bug.cgi?id=103743; however, this change in itself is not sufficient to fix that bug, as there is another issue in the AMDGPU backend. As discovered after committing an earlier version of this change, this exposes a subtle interaction between this pass and DivergenceAnalysis: since we remove and re-create branch instructions, we can no longer rely on DivergenceAnalysis for branches in subregions that were already processed by the pass. Explicitly remove branch instructions from DivergenceAnalysis to avoid dangling pointers as a matter of defensive programming, and change how we detect non-uniform subregions. Change-Id: I32bbffece4a32f686fab54964dae1a5dd72949d4 Differential Revision: https://reviews.llvm.org/D43743 llvm-svn: 329165
* [StructurizeCFG] fix test to be independent of FP undefSanjay Patel2018-03-081-5/+7
| | | | llvm-svn: 327028
* [StructurizeCFG] auto-generate full checks; NFCSanjay Patel2018-03-081-3/+22
| | | | | | Not sure what the intent of this test is, but this will change when we fix FP undef constant folding. llvm-svn: 327022
* Revert "StructurizeCFG: Test for branch divergence correctly"Adam Nemet2018-02-241-82/+0
| | | | | | | | This reverts commit r325881. Breaks many bots llvm-svn: 326037
* StructurizeCFG: Test for branch divergence correctlyNicolai Haehnle2018-02-231-0/+82
| | | | | | | | | | | | | | | | | | | | | | Summary: This fixes cases like the new test @nonuniform. In that test, %cc itself is a uniform value; however, when reading it after the end of the loop in basic block %if, its value is effectively non-uniform. This problem was encountered in https://bugs.freedesktop.org/show_bug.cgi?id=103743; however, this change in itself is not sufficient to fix that bug, as there is another issue in the AMDGPU backend. Change-Id: I32bbffece4a32f686fab54964dae1a5dd72949d4 Reviewers: arsenm, rampitec, jlebar Subscribers: wdng, tpr, llvm-commits Differential Revision: https://reviews.llvm.org/D40546 llvm-svn: 325881
* Revert r321751, "StructurizeCFG: Fix broken backedge detection"Nicolai Haehnle2018-01-243-56/+81
| | | | | | | | | | | It causes regressions in various OpenGL test suites. Keep the test cases introduced by r321751 as XFAIL, and add a test case for the regression. Change-Id: I90b4cc354f68cebe5fcef1f2422dc8fe1c6d3514 Bugzilla: https://bugs.llvm.org/show_bug.cgi?id=36015 llvm-svn: 323355
* StructurizeCFG: xfail one of the testcases from r321751Matt Arsenault2018-01-042-139/+78
| | | | | | | It fails with -verify-region-info. This seems to be a issue with RegionInfo itself which existed before. llvm-svn: 321806
* StructurizeCFG: Fix broken backedge detectionMatt Arsenault2018-01-033-27/+359
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The work order was changed in r228186 from SCC order to RPO with an arbitrary sorting function. The sorting function attempted to move inner loop nodes earlier. This was was apparently relying on an assumption that every block in a given loop / the same loop depth would be seen before visiting another loop. In the broken testcase, a block outside of the loop was encountered before moving onto another block in the same loop. The testcase would then structurize such that one blocks unconditional successor could never be reached. Revert to plain RPO for the analysis phase. This fixes detecting edges as backedges that aren't really. The processing phase does use another visited set, and I'm unclear on whether the order there is as important. An arbitrary order doesn't work, and triggers some infinite loops. The reversed RPO list seems to work and is closer to the order that was used before, minus the arbitary custom sorting. A few of the changed tests now produce smaller code, and a few are slightly worse looking. llvm-svn: 321751