[llvm] eae0d2e - Revert "[Peeling] Extend the scope of peeling a bit"

Serguei Katkov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 22 03:49:07 PDT 2020


Author: Serguei Katkov
Date: 2020-06-22T17:48:29+07:00
New Revision: eae0d2e9b276019713c796c435506ceb183329da

URL: https://github.com/llvm/llvm-project/commit/eae0d2e9b276019713c796c435506ceb183329da
DIFF: https://github.com/llvm/llvm-project/commit/eae0d2e9b276019713c796c435506ceb183329da.diff

LOG: Revert "[Peeling] Extend the scope of peeling a bit"

This reverts commit 29b2c1ca72096ca06415b5e626e6728c42ef1e74.

The patch causes the DT verifier failure like:
DominatorTree is different than a freshly computed one!

Not sure the patch itself it wrong but revert to investigate the failure.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
    llvm/lib/Transforms/Utils/LoopUtils.cpp

Removed: 
    llvm/test/Transforms/LoopUnroll/peel-loop-pgo-deopt-pd.ll


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
index 23fe5330babc..43dfaf3e50dc 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollPeel.cpp
@@ -90,7 +90,7 @@ bool llvm::canPeel(Loop *L) {
       const BranchInst *T = dyn_cast<BranchInst>(Latch->getTerminator());
       return T && T->isConditional() && L->isLoopExiting(Latch) &&
              all_of(Exits, [](const BasicBlock *BB) {
-               return BB->getPostdominatingDeoptimizeCall();
+               return BB->getTerminatingDeoptimizeCall();
              });
     }
   }

diff  --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp
index bd4fb4bedc17..9241377012a4 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -744,7 +744,7 @@ static BranchInst *getExpectedExitLoopLatchBranch(Loop *L) {
   SmallVector<BasicBlock *, 4> ExitBlocks;
   L->getUniqueNonLatchExitBlocks(ExitBlocks);
   if (any_of(ExitBlocks, [](const BasicBlock *EB) {
-        return !EB->getPostdominatingDeoptimizeCall();
+        return !EB->getTerminatingDeoptimizeCall();
       }))
     return nullptr;
 

diff  --git a/llvm/test/Transforms/LoopUnroll/peel-loop-pgo-deopt-pd.ll b/llvm/test/Transforms/LoopUnroll/peel-loop-pgo-deopt-pd.ll
deleted file mode 100644
index 06a69e17b2fd..000000000000
--- a/llvm/test/Transforms/LoopUnroll/peel-loop-pgo-deopt-pd.ll
+++ /dev/null
@@ -1,47 +0,0 @@
-; RUN: opt < %s -S -loop-unroll -unroll-runtime -unroll-peel-multi-deopt-exit 2>&1 | FileCheck %s
-
-; Make sure that we can peel even if deopt block is not in immidiate exit.
-
-; CHECK-LABEL: @basic
-; CHECK: br i1 %c, label %{{.*}}, label %side_exit
-; CHECK: br i1 %{{.*}}, label %[[NEXT0:.*]], label %exit
-; CHECK: [[NEXT0]]:
-; CHECK: br i1 %c, label %{{.*}}, label %side_exit
-; CHECK: br i1 %{{.*}}, label %[[NEXT1:.*]], label %exit
-
-define i32 @basic(i32* %p, i32 %k, i1 %c) #0 !prof !1 {
-entry:
-  %cmp3 = icmp slt i32 0, %k
-  br i1 %cmp3, label %header, label %deopt
-
-header:
-  br label %body
-
-body:
-  %i = phi i32 [ 0, %header ], [ %inc, %backedge ]
-  %addr = getelementptr inbounds i32, i32* %p, i32 %i
-  store i32 %i, i32* %addr, align 4
-  %inc = add nsw i32 %i, 1
-  %cmp = icmp slt i32 %inc, %k
-  br i1 %c, label %backedge, label %side_exit, !prof !3
-
-backedge:
-  br i1 %cmp, label %body, label %exit, !prof !2
-
-exit:
-  ret i32 %i
-
-side_exit:
-  br label %deopt
-
-deopt:
-  %deopt_kind = phi i32 [0, %entry], [1, %side_exit]
-  %rval = call i32(...) @llvm.experimental.deoptimize.i32() [ "deopt"(i32 %deopt_kind) ]
-  ret i32 %rval
-}
-
-declare i32 @llvm.experimental.deoptimize.i32(...)
-
-!1 = !{!"function_entry_count", i64 1}
-!2 = !{!"branch_weights", i32 0, i32 1}
-!3 = !{!"branch_weights", i32 1, i32 0}


        


More information about the llvm-commits mailing list