diff options
author | Florian Hahn <flo@fhahn.com> | 2019-07-01 12:36:44 +0000 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2019-07-01 12:36:44 +0000 |
commit | 33c8c0ea2756f25f9914d328906debf20cfc49d5 (patch) | |
tree | 88f8eb3d1a143c45f1d17b3536b410aa9784b5c7 /llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp | |
parent | d5c3e34cb7ed17b38c1fae73fc9e65fdc7d28a28 (diff) | |
download | bcm5719-llvm-33c8c0ea2756f25f9914d328906debf20cfc49d5.tar.gz bcm5719-llvm-33c8c0ea2756f25f9914d328906debf20cfc49d5.zip |
[AMDGPU] Call isLoopExiting for blocks in the loop.
isLoopExiting should only be called for blocks in the loop. A follow
up patch makes this requirement an assertion.
I've updated the usage here, to only match for actual exit blocks. Previously,
it would also match blocks not in the loop.
Reviewers: arsenm, nhaehnle
Reviewed By: nhaehnle
Differential Revision: https://reviews.llvm.org/D63980
llvm-svn: 364750
Diffstat (limited to 'llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp index 1c17e6054f0..e198a9c7eb8 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp @@ -117,8 +117,10 @@ void AMDGPUTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE, // Add a small bonus for each of such "if" statements. if (const BranchInst *Br = dyn_cast<BranchInst>(&I)) { if (UP.Threshold < MaxBoost && Br->isConditional()) { - if (L->isLoopExiting(Br->getSuccessor(0)) || - L->isLoopExiting(Br->getSuccessor(1))) + BasicBlock *Succ0 = Br->getSuccessor(0); + BasicBlock *Succ1 = Br->getSuccessor(1); + if ((L->contains(Succ0) && L->isLoopExiting(Succ0)) || + (L->contains(Succ1) && L->isLoopExiting(Succ1))) continue; if (dependsOnLocalPhi(L, Br->getCondition())) { UP.Threshold += UnrollThresholdIf; |