[llvm] 2b5a897 - Revert "[SimpleLoopUnswitch] Fix introduction of UB when hoisted condition may be undef or poison"

Juneyoung Lee via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 18:10:54 PST 2020


Author: Juneyoung Lee
Date: 2020-02-28T11:10:46+09:00
New Revision: 2b5a8976514de326bb84f0913d9d451089c11d22

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

LOG: Revert "[SimpleLoopUnswitch] Fix introduction of UB when hoisted condition may be undef or poison"

.. due to performance regression.

This patch is reverted until infrastructore for CSE/LICM support for freeze is
added.

This reverts commit 181628b

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll
    llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll
    llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll
    llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
    llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-cost.ll
    llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index 5b6ae8dc3a0f..a356395fc02c 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -26,8 +26,6 @@
 #include "llvm/Analysis/LoopPass.h"
 #include "llvm/Analysis/MemorySSA.h"
 #include "llvm/Analysis/MemorySSAUpdater.h"
-#include "llvm/Analysis/MustExecute.h"
-#include "llvm/Analysis/ValueTracking.h"
 #include "llvm/IR/BasicBlock.h"
 #include "llvm/IR/Constant.h"
 #include "llvm/IR/Constants.h"
@@ -181,14 +179,11 @@ static void buildPartialUnswitchConditionalBranch(BasicBlock &BB,
                                                   ArrayRef<Value *> Invariants,
                                                   bool Direction,
                                                   BasicBlock &UnswitchedSucc,
-                                                  BasicBlock &NormalSucc,
-                                                  bool InsertFreeze) {
+                                                  BasicBlock &NormalSucc) {
   IRBuilder<> IRB(&BB);
 
   Value *Cond = Direction ? IRB.CreateOr(Invariants) :
     IRB.CreateAnd(Invariants);
-  if (InsertFreeze)
-    Cond = IRB.CreateFreeze(Cond, Cond->getName() + ".fr");
   IRB.CreateCondBr(Cond, Direction ? &UnswitchedSucc : &NormalSucc,
                    Direction ? &NormalSucc : &UnswitchedSucc);
 }
@@ -502,7 +497,7 @@ static bool unswitchTrivialBranch(Loop &L, BranchInst &BI, DominatorTree &DT,
                  Instruction::And &&
              "Must have an `and` of `i1`s for the condition!");
     buildPartialUnswitchConditionalBranch(*OldPH, Invariants, ExitDirection,
-                                          *UnswitchedBB, *NewPH, false);
+                                          *UnswitchedBB, *NewPH);
   }
 
   // Update the dominator tree with the added edge.
@@ -2013,10 +2008,6 @@ static void unswitchNontrivialInvariants(
       SE->forgetTopmostLoop(&L);
   }
 
-  ICFLoopSafetyInfo SafetyInfo(&DT);
-  SafetyInfo.computeLoopSafetyInfo(&L);
-  bool InsertFreeze = !SafetyInfo.isGuaranteedToExecute(TI, &DT, &L);
-
   // If the edge from this terminator to a successor dominates that successor,
   // store a map from each block in its dominator subtree to it. This lets us
   // tell when cloning for a particular successor if a block is dominated by
@@ -2074,12 +2065,6 @@ static void unswitchNontrivialInvariants(
       BasicBlock *ClonedPH = ClonedPHs.begin()->second;
       BI->setSuccessor(ClonedSucc, ClonedPH);
       BI->setSuccessor(1 - ClonedSucc, LoopPH);
-      if (InsertFreeze) {
-        auto Cond = BI->getCondition();
-        if (!isGuaranteedNotToBeUndefOrPoison(Cond))
-          BI->setCondition(new FreezeInst(Cond, Cond->getName() + ".fr", BI));
-      }
-
       DTUpdates.push_back({DominatorTree::Insert, SplitBB, ClonedPH});
     } else {
       assert(SI && "Must either be a branch or switch!");
@@ -2094,12 +2079,6 @@ static void unswitchNontrivialInvariants(
         else
           Case.setSuccessor(ClonedPHs.find(Case.getCaseSuccessor())->second);
 
-      if (InsertFreeze) {
-        auto Cond = SI->getCondition();
-        if (!isGuaranteedNotToBeUndefOrPoison(Cond))
-          SI->setCondition(new FreezeInst(Cond, Cond->getName() + ".fr", SI));
-      }
-
       // We need to use the set to populate domtree updates as even when there
       // are multiple cases pointing at the same successor we only want to
       // remove and insert one edge in the domtree.
@@ -2176,7 +2155,7 @@ static void unswitchNontrivialInvariants(
     // When doing a partial unswitch, we have to do a bit more work to build up
     // the branch in the split block.
     buildPartialUnswitchConditionalBranch(*SplitBB, Invariants, Direction,
-                                          *ClonedPH, *LoopPH, InsertFreeze);
+                                          *ClonedPH, *LoopPH);
     DTUpdates.push_back({DominatorTree::Insert, SplitBB, ClonedPH});
 
     if (MSSAU) {

diff  --git a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll
index 04d027cd502c..d2ca06357cfe 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested.ll
@@ -85,14 +85,8 @@
 
 declare void @bar()
 
-define void @loop_nested3_conds5(i32* %addr, i1 %c1i, i1 %c2i, i1 %c3i, i1 %c4i, i1 %c5i) {
+define void @loop_nested3_conds5(i32* %addr, i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5) {
 entry:
-  ; c1 ~ c5 are guaranteed to be never undef or poison.
-  %c1 = freeze i1 %c1i
-  %c2 = freeze i1 %c2i
-  %c3 = freeze i1 %c3i
-  %c4 = freeze i1 %c4i
-  %c5 = freeze i1 %c5i
   %addr1 = getelementptr i32, i32* %addr, i64 0
   %addr2 = getelementptr i32, i32* %addr, i64 1
   %addr3 = getelementptr i32, i32* %addr, i64 2

diff  --git a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll
index 26179ad9068e..e8879e79c53f 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-nontrivial-unswitch-nested2.ll
@@ -97,14 +97,8 @@
 
 declare void @bar()
 
-define void @loop_nested3_conds5(i32* %addr, i1 %c1i, i1 %c2i, i1 %c3i, i1 %c4i, i1 %c5i) {
+define void @loop_nested3_conds5(i32* %addr, i1 %c1, i1 %c2, i1 %c3, i1 %c4, i1 %c5) {
 entry:
-  ; c1 ~ c5 are guaranteed to be never undef or poison.
-  %c1 = freeze i1 %c1i
-  %c2 = freeze i1 %c2i
-  %c3 = freeze i1 %c3i
-  %c4 = freeze i1 %c4i
-  %c5 = freeze i1 %c5i
   %addr1 = getelementptr i32, i32* %addr, i64 0
   %addr2 = getelementptr i32, i32* %addr, i64 1
   %addr3 = getelementptr i32, i32* %addr, i64 2

diff  --git a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll
index 6606a1931d4d..35d431e5ee26 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/exponential-switch-unswitch.ll
@@ -86,11 +86,8 @@
 ; LOOP-MAX-COUNT-111:     Loop at depth 2 containing:
 ; LOOP-MAX-NOT: Loop at depth 2 containing:
 
-define i32 @loop_switch(i32* %addr, i32 %c1i, i32 %c2i) {
+define i32 @loop_switch(i32* %addr, i32 %c1, i32 %c2) {
 entry:
-  ; c1, c2 are guaranteed to be never undef or poison.
-  %c1 = freeze i32 %c1i
-  %c2 = freeze i32 %c2i
   %addr1 = getelementptr i32, i32* %addr, i64 0
   %addr2 = getelementptr i32, i32* %addr, i64 1
   %check0 = icmp eq i32 %c2, 0

diff  --git a/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll b/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
index 9365829f976a..de57075b6222 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/guards.ll
@@ -81,8 +81,7 @@ exit:
 define void @test_conditional_guards(i1 %cond, i32 %N) {
 ; CHECK-LABEL: @test_conditional_guards(
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    [[COND_FR:%.*]] = freeze i1 [[COND:%.*]]
-; CHECK-NEXT:    br i1 [[COND_FR]], label [[ENTRY_SPLIT_US:%.*]], label [[ENTRY_SPLIT:%.*]]
+; CHECK-NEXT:    br i1 [[COND:%.*]], label [[ENTRY_SPLIT_US:%.*]], label [[ENTRY_SPLIT:%.*]]
 ; CHECK:       entry.split.us:
 ; CHECK-NEXT:    br label [[LOOP_US:%.*]]
 ; CHECK:       loop.us:

diff  --git a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-cost.ll b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-cost.ll
index 7b2c8280e7a3..692799db1c60 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-cost.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-cost.ll
@@ -57,8 +57,7 @@ define void @test_unswitch(i1* %ptr, i1 %cond) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   call void @x()
@@ -128,8 +127,7 @@ define void @test_unswitch_non_dup_code(i1* %ptr, i1 %cond) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   call void @x()
@@ -210,8 +208,7 @@ define void @test_unswitch_non_dup_code_in_cfg(i1* %ptr, i1 %cond) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   call void @x()
@@ -367,8 +364,7 @@ define void @test_unswitch_large_exit(i1* %ptr, i1 %cond) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   call void @x()
@@ -445,8 +441,7 @@ define void @test_unswitch_dedicated_exiting(i1* %ptr, i1 %cond) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   call void @x()

diff  --git a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll
index 02b3bd5b4c3d..0aec52d447d5 100644
--- a/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll
+++ b/llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll
@@ -814,8 +814,7 @@ inner_loop_begin:
 ; CHECK-NEXT:    %[[A_INNER_PHI:.*]] = phi i32 [ %[[A]], %loop_begin ], [ %[[A2:.*]], %inner_inner_loop_exit ]
 ; CHECK-NEXT:    %[[COND:.*]] = load i1, i1* %cond.ptr
 ; CHECK-NEXT:    %[[B:.*]] = load i32, i32* %b.ptr
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %[[COND]]
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %inner_loop_begin.split.us, label %inner_loop_begin.split
+; CHECK-NEXT:    br i1 %[[COND]], label %inner_loop_begin.split.us, label %inner_loop_begin.split
 
 inner_inner_loop_begin:
   %v1 = load i1, i1* %ptr
@@ -968,8 +967,7 @@ inner_loop_begin:
 ; CHECK-NEXT:    %[[A_INNER_PHI:.*]] = phi i32 [ %[[A]], %loop_begin ], [ %[[A2:.*]], %inner_inner_loop_exit ]
 ; CHECK-NEXT:    %[[COND:.*]] = load i1, i1* %cond.ptr
 ; CHECK-NEXT:    %[[B:.*]] = load i32, i32* %b.ptr
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %[[COND]]
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %inner_loop_begin.split.us, label %inner_loop_begin.split
+; CHECK-NEXT:    br i1 %[[COND]], label %inner_loop_begin.split.us, label %inner_loop_begin.split
 
 inner_inner_loop_begin:
   %v1 = load i1, i1* %ptr
@@ -1122,8 +1120,7 @@ inner_loop_begin:
 ; CHECK-NEXT:    %[[A_INNER_PHI:.*]] = phi i32 [ %[[A]], %loop_begin ], [ %[[A2:.*]], %inner_inner_loop_exit ]
 ; CHECK-NEXT:    %[[COND:.*]] = load i1, i1* %cond.ptr
 ; CHECK-NEXT:    %[[B:.*]] = load i32, i32* %b.ptr
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %[[COND]]
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %inner_loop_begin.split.us, label %inner_loop_begin.split
+; CHECK-NEXT:    br i1 %[[COND]], label %inner_loop_begin.split.us, label %inner_loop_begin.split
 
 inner_inner_loop_begin:
   %v1 = load i1, i1* %ptr
@@ -1243,8 +1240,7 @@ inner_loop_begin:
 ; CHECK-NEXT:    %[[A_INNER_PHI:.*]] = phi i32 [ %[[A]], %loop_begin ], [ %[[A2:.*]], %inner_inner_loop_exit ]
 ; CHECK-NEXT:    %[[COND:.*]] = load i1, i1* %cond.ptr
 ; CHECK-NEXT:    %[[B:.*]] = load i32, i32* %b.ptr
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %[[COND]]
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %inner_loop_begin.split.us, label %inner_loop_begin.split
+; CHECK-NEXT:    br i1 %[[COND]], label %inner_loop_begin.split.us, label %inner_loop_begin.split
 
 inner_inner_loop_begin:
   %v1 = load i1, i1* %ptr
@@ -1486,8 +1482,7 @@ define i32 @test10a(i1* %ptr, i1 %cond, i32* %a.ptr) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   %a = load i32, i32* %a.ptr
@@ -1567,8 +1562,7 @@ define i32 @test10b(i1* %ptr, i1 %cond, i32* %a.ptr) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   %a = load i32, i32* %a.ptr
@@ -1667,8 +1661,7 @@ inner_loop_ph:
   br label %inner_loop_begin
 ; CHECK:       inner_loop_ph:
 ; CHECK-NEXT:    %[[COND:.*]] = load i1, i1* %cond.ptr
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %[[COND]]
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %inner_loop_ph.split.us, label %inner_loop_ph.split
+; CHECK-NEXT:    br i1 %[[COND]], label %inner_loop_ph.split.us, label %inner_loop_ph.split
 
 inner_loop_begin:
   call void @sink1(i32 %b)
@@ -1762,8 +1755,7 @@ inner_loop_ph:
   br label %inner_loop_begin
 ; CHECK:       inner_loop_ph:
 ; CHECK-NEXT:    %[[COND:.*]] = load i1, i1* %cond.ptr
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %[[COND]]
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %inner_loop_ph.split.us, label %inner_loop_ph.split
+; CHECK-NEXT:    br i1 %[[COND]], label %inner_loop_ph.split.us, label %inner_loop_ph.split
 
 inner_loop_begin:
   call void @sink1(i32 %b)
@@ -1861,8 +1853,7 @@ inner_inner_loop_ph:
   br label %inner_inner_loop_begin
 ; CHECK:       inner_inner_loop_ph:
 ; CHECK-NEXT:    %[[COND:.*]] = load i1, i1* %cond.ptr
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %[[COND]]
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %inner_inner_loop_ph.split.us, label %inner_inner_loop_ph.split
+; CHECK-NEXT:    br i1 %[[COND]], label %inner_inner_loop_ph.split.us, label %inner_inner_loop_ph.split
 
 inner_inner_loop_begin:
   call void @sink1(i32 %b)
@@ -1970,8 +1961,7 @@ inner_inner_loop_ph:
   br label %inner_inner_loop_begin
 ; CHECK:       inner_inner_loop_ph:
 ; CHECK-NEXT:    %[[COND:.*]] = load i1, i1* %cond.ptr
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %[[COND]]
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %inner_inner_loop_ph.split.us, label %inner_inner_loop_ph.split
+; CHECK-NEXT:    br i1 %[[COND]], label %inner_inner_loop_ph.split.us, label %inner_inner_loop_ph.split
 
 inner_inner_loop_begin:
   call void @sink1(i32 %b)
@@ -2058,8 +2048,7 @@ define i32 @test13a(i1* %ptr, i1 %cond, i32* %a.ptr, i32* %b.ptr) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   %a = load i32, i32* %a.ptr
@@ -2183,8 +2172,7 @@ define i32 @test13b(i1* %ptr, i1 %cond, i32* %a.ptr, i32* %b.ptr) {
 entry:
   br label %loop_begin
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %[[COND_FR:.*]] = freeze i1 %cond
-; CHECK-NEXT:    br i1 %[[COND_FR]], label %entry.split.us, label %entry.split
+; CHECK-NEXT:    br i1 %cond, label %entry.split.us, label %entry.split
 
 loop_begin:
   %a = load i32, i32* %a.ptr
@@ -2432,10 +2420,9 @@ loop_exit:
 ; paths to reach an inner loop after unswitching, and one of them is via the
 ; predecessors of the unswitched loop header. That can allow us to find the loop
 ; through multiple 
diff erent paths.
-define void @test21(i1 %a0, i1 %b) {
+define void @test21(i1 %a, i1 %b) {
 ; CHECK-LABEL: @test21(
 bb:
-  %a = freeze i1 %a0
   br label %bb3
 ; CHECK-NOT:     br i1 %a
 ;
@@ -2566,8 +2553,7 @@ define void @test23(i1 %arg, i1* %ptr) {
 entry:
   br label %outer.header
 ; CHECK:       entry:
-; CHECK-NEXT:    %[[ARG_FR:.*]] = freeze i1 %arg
-; CHECK-NEXT:    br i1 %[[ARG_FR]],
+; CHECK-NEXT:    br i1 %arg,
 ;
 ; Just verify that we unswitched the correct bits. We should call `@f` twice in
 ; one unswitch and `@f` and then `@g` in the other.
@@ -3078,8 +3064,7 @@ define i32 @test29(i32 %arg) {
 entry:
   br label %header
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %arg.fr = freeze i32 %arg
-; CHECK-NEXT:    switch i32 %arg.fr, label %[[ENTRY_SPLIT_C:.*]] [
+; CHECK-NEXT:    switch i32 %arg, label %[[ENTRY_SPLIT_C:.*]] [
 ; CHECK-NEXT:      i32 0, label %[[ENTRY_SPLIT_A:.*]]
 ; CHECK-NEXT:      i32 1, label %[[ENTRY_SPLIT_A]]
 ; CHECK-NEXT:      i32 2, label %[[ENTRY_SPLIT_B:.*]]
@@ -3257,13 +3242,11 @@ exit:
 ; a loop exit edge as those can in some cases be special. Among other things,
 ; this includes an LCSSA phi with multiple entries despite being a dedicated
 ; exit block.
-define i32 @test30(i32 %arg0) {
+define i32 @test30(i32 %arg) {
 ; CHECK-LABEL: define i32 @test30(
 entry:
-  %arg = freeze i32 %arg0
   br label %header
 ; CHECK-NEXT:  entry:
-; CHECK-NEXT:    %arg = freeze i32 %arg0
 ; CHECK-NEXT:    switch i32 %arg, label %[[ENTRY_SPLIT_EXIT:.*]] [
 ; CHECK-NEXT:      i32 -1, label %[[ENTRY_SPLIT_EXIT]]
 ; CHECK-NEXT:      i32 0, label %[[ENTRY_SPLIT_A:.*]]
@@ -3443,8 +3426,7 @@ b.header:
   br label %c.header
 ; CHECK:       b.header:
 ; CHECK-NEXT:    %v1 = call i1 @cond()
-; CHECK-NEXT:    %[[V1_FR:.*]] = freeze i1 %v1
-; CHECK-NEXT:    br i1 %[[V1_FR]], label %[[B_HEADER_SPLIT_US:.*]], label %[[B_HEADER_SPLIT:.*]]
+; CHECK-NEXT:    br i1 %v1, label %[[B_HEADER_SPLIT_US:.*]], label %[[B_HEADER_SPLIT:.*]]
 ;
 ; CHECK:       [[B_HEADER_SPLIT_US]]:
 ; CHECK-NEXT:    br label %[[C_HEADER_US:.*]]
@@ -3519,8 +3501,7 @@ b.header:
 ; CHECK:       b.header:
 ; CHECK-NEXT:    %x.b = load i32, i32* %ptr
 ; CHECK-NEXT:    %v1 = call i1 @cond()
-; CHECK-NEXT:    %[[V1_FR:.*]] = freeze i1 %v1
-; CHECK-NEXT:    br i1 %[[V1_FR]], label %[[B_HEADER_SPLIT_US:.*]], label %[[B_HEADER_SPLIT:.*]]
+; CHECK-NEXT:    br i1 %v1, label %[[B_HEADER_SPLIT_US:.*]], label %[[B_HEADER_SPLIT:.*]]
 ;
 ; CHECK:       [[B_HEADER_SPLIT_US]]:
 ; CHECK-NEXT:    br label %[[C_HEADER_US:.*]]
@@ -3608,8 +3589,7 @@ b.header:
 ; CHECK:       b.header:
 ; CHECK-NEXT:    %x.b = load i32, i32* %ptr
 ; CHECK-NEXT:    %v1 = call i1 @cond()
-; CHECK-NEXT:    %[[V1_FR:.*]] = freeze i1 %v1
-; CHECK-NEXT:    br i1 %[[V1_FR]], label %[[B_HEADER_SPLIT_US:.*]], label %[[B_HEADER_SPLIT:.*]]
+; CHECK-NEXT:    br i1 %v1, label %[[B_HEADER_SPLIT_US:.*]], label %[[B_HEADER_SPLIT:.*]]
 ;
 ; CHECK:       [[B_HEADER_SPLIT_US]]:
 ; CHECK-NEXT:    br label %[[C_HEADER_US:.*]]
@@ -3689,8 +3669,7 @@ b.header:
 ; CHECK:       b.header:
 ; CHECK-NEXT:    %x.b = load i32, i32* %ptr
 ; CHECK-NEXT:    %v1 = call i1 @cond()
-; CHECK-NEXT:    %[[V1_FR:.*]] = freeze i1 %v1
-; CHECK-NEXT:    br i1 %[[V1_FR]], label %[[B_HEADER_SPLIT_US:.*]], label %[[B_HEADER_SPLIT:.*]]
+; CHECK-NEXT:    br i1 %v1, label %[[B_HEADER_SPLIT_US:.*]], label %[[B_HEADER_SPLIT:.*]]
 ;
 ; CHECK:       [[B_HEADER_SPLIT_US]]:
 ; CHECK-NEXT:    br label %[[C_HEADER_US:.*]]
@@ -3788,8 +3767,7 @@ c.header:
   br label %d.header
 ; CHECK:       c.header:
 ; CHECK-NEXT:    %v1 = call i1 @cond()
-; CHECK-NEXT:    %[[V1_FR:.*]] = freeze i1 %v1
-; CHECK-NEXT:    br i1 %[[V1_FR]], label %[[C_HEADER_SPLIT_US:.*]], label %[[C_HEADER_SPLIT:.*]]
+; CHECK-NEXT:    br i1 %v1, label %[[C_HEADER_SPLIT_US:.*]], label %[[C_HEADER_SPLIT:.*]]
 ;
 ; CHECK:       [[C_HEADER_SPLIT_US]]:
 ; CHECK-NEXT:    br label %[[D_HEADER_US:.*]]
@@ -3902,8 +3880,7 @@ c.header:
 ; CHECK:       c.header:
 ; CHECK-NEXT:    %x.c = load i32, i32* %ptr
 ; CHECK-NEXT:    %v1 = call i1 @cond()
-; CHECK-NEXT:    %[[V1_FR:.*]] = freeze i1 %v1
-; CHECK-NEXT:    br i1 %[[V1_FR]], label %[[C_HEADER_SPLIT_US:.*]], label %[[C_HEADER_SPLIT:.*]]
+; CHECK-NEXT:    br i1 %v1, label %[[C_HEADER_SPLIT_US:.*]], label %[[C_HEADER_SPLIT:.*]]
 ;
 ; CHECK:       [[C_HEADER_SPLIT_US]]:
 ; CHECK-NEXT:    br label %[[D_HEADER_US:.*]]
@@ -3985,8 +3962,7 @@ b.header:
 ; CHECK:       b.header:
 ; CHECK-NEXT:    %x.b = load i32, i32* %ptr
 ; CHECK-NEXT:    %v1 = call i32 @cond.i32()
-; CHECK-NEXT:    %[[V1_FR]] = freeze i32 %v1
-; CHECK-NEXT:    switch i32 %[[V1_FR]], label %[[B_HEADER_SPLIT:.*]] [
+; CHECK-NEXT:    switch i32 %v1, label %[[B_HEADER_SPLIT:.*]] [
 ; CHECK-NEXT:      i32 1, label %[[B_HEADER_SPLIT_US:.*]]
 ; CHECK-NEXT:      i32 2, label %[[B_HEADER_SPLIT_US]]
 ; CHECK-NEXT:      i32 3, label %[[B_HEADER_SPLIT_US]]


        


More information about the llvm-commits mailing list