[PATCH] D63980: [AMDGPU] Call isLoopExiting for blocks in the loop.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 1 05:38:03 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL364750: [AMDGPU] Call isLoopExiting for blocks in the loop. (authored by fhahn, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D63980?vs=207232&id=207266#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63980/new/

https://reviews.llvm.org/D63980

Files:
  llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp


Index: llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
===================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp
@@ -117,8 +117,10 @@
       // 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63980.207266.patch
Type: text/x-patch
Size: 942 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190701/2e7db762/attachment.bin>


More information about the llvm-commits mailing list