From 855c29d82c0358f43d1dc22f5330bb31a74adfd1 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Sun, 10 Nov 2013 07:34:34 +0000 Subject: Revert "Resurrect r191017 " GVN proceeds in the presence of dead code" plus a fix to PR17307 & 17308." This causes PR17852. This reverts commit d93e8a06b2ca09ab18f390cd514b7443e2e571f7. Conflicts: test/Transforms/GVN/cond_br2.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194348 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Transforms/GVN/2007-07-26-InterlockingLoops.ll | 8 +- test/Transforms/GVN/2008-07-02-Unreachable.ll | 8 +- test/Transforms/GVN/cond_br.ll | 55 -------- test/Transforms/GVN/cond_br2.ll | 140 --------------------- test/Transforms/GVN/local-pre.ll | 6 +- test/Transforms/GVN/rle-nonlocal.ll | 5 +- test/Transforms/GVN/rle-semidominated.ll | 5 +- test/Transforms/GVN/rle.ll | 16 ++- 8 files changed, 22 insertions(+), 221 deletions(-) delete mode 100644 test/Transforms/GVN/cond_br.ll delete mode 100644 test/Transforms/GVN/cond_br2.ll (limited to 'test/Transforms') diff --git a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll index 5a15f0e43a..a1cc0083f1 100644 --- a/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll +++ b/test/Transforms/GVN/2007-07-26-InterlockingLoops.ll @@ -2,7 +2,7 @@ @last = external global [65 x i32*] -define i32 @NextRootMove(i32 %wtm, i32 %x, i32 %y, i32 %z) { +define i32 @NextRootMove(i32 %wtm) { entry: %A = alloca i32* %tmp17618 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 @@ -15,14 +15,12 @@ entry: br label %cond_true116 cond_true116: - %cmp = icmp eq i32 %x, %y - br i1 %cmp, label %cond_true128, label %cond_true145 + br i1 false, label %cond_true128, label %cond_true145 cond_true128: %tmp17625 = load i32** getelementptr ([65 x i32*]* @last, i32 0, i32 1), align 4 store i32* %tmp17625, i32** %A - %cmp1 = icmp eq i32 %x, %z - br i1 %cmp1 , label %bb98.backedge, label %return.loopexit + br i1 false, label %bb98.backedge, label %return.loopexit bb98.backedge: br label %cond_true116 diff --git a/test/Transforms/GVN/2008-07-02-Unreachable.ll b/test/Transforms/GVN/2008-07-02-Unreachable.ll index ce83fa4e4b..4f07868a1c 100644 --- a/test/Transforms/GVN/2008-07-02-Unreachable.ll +++ b/test/Transforms/GVN/2008-07-02-Unreachable.ll @@ -3,11 +3,10 @@ @g_3 = external global i8 ; [#uses=2] -define i8 @func_1(i32 %x, i32 %y) nounwind { +define i8 @func_1() nounwind { entry: %A = alloca i8 - %cmp = icmp eq i32 %x, %y - br i1 %cmp, label %ifelse, label %ifthen + br i1 false, label %ifelse, label %ifthen ifthen: ; preds = %entry br label %ifend @@ -15,6 +14,9 @@ ifthen: ; preds = %entry ifelse: ; preds = %entry %tmp3 = load i8* @g_3 ; [#uses=0] store i8 %tmp3, i8* %A + br label %forcond.thread + +forcond.thread: ; preds = %ifelse br label %afterfor forcond: ; preds = %forinc diff --git a/test/Transforms/GVN/cond_br.ll b/test/Transforms/GVN/cond_br.ll deleted file mode 100644 index 918e7d41f1..0000000000 --- a/test/Transforms/GVN/cond_br.ll +++ /dev/null @@ -1,55 +0,0 @@ -; RUN: opt -basicaa -gvn -S < %s | FileCheck %s -@y = external global i32 -@z = external global i32 - -; Function Attrs: nounwind ssp uwtable -define void @foo(i32 %x) { -; CHECK: @foo(i32 %x) -; CHECK: %.pre = load i32* @y -; CHECK: call void @bar(i32 %.pre) - - %t = sub i32 %x, %x - %.pre = load i32* @y, align 4 - %cmp = icmp sgt i32 %t, 2 - br i1 %cmp, label %if.then, label %entry.if.end_crit_edge - -entry.if.end_crit_edge: ; preds = %entry - br label %if.end - -if.then: ; preds = %entry - %add = add nsw i32 %x, 3 - store i32 %add, i32* @y, align 4 - br label %if.end - -if.end: ; preds = %entry.if.end_crit_edge, %if.then - %1 = phi i32 [ %.pre, %entry.if.end_crit_edge ], [ %add, %if.then ] - tail call void @bar(i32 %1) - ret void -} - -define void @foo2(i32 %x) { -; CHECK: @foo2(i32 %x) -; CHECK: %.pre = load i32* @y -; CHECK: tail call void @bar(i32 %.pre) -entry: - %t = sub i32 %x, %x - %.pre = load i32* @y, align 4 - %cmp = icmp sgt i32 %t, 2 - br i1 %cmp, label %if.then, label %if.else - -if.then: ; preds = %entry - %add = add nsw i32 %x, 3 - store i32 %add, i32* @y, align 4 - br label %if.end - -if.else: ; preds = %entry - store i32 1, i32* @z, align 4 - br label %if.end - -if.end: ; preds = %if.else, %if.then - %0 = phi i32 [ %.pre, %if.else ], [ %add, %if.then ] - tail call void @bar(i32 %0) - ret void -} - -declare void @bar(i32) diff --git a/test/Transforms/GVN/cond_br2.ll b/test/Transforms/GVN/cond_br2.ll deleted file mode 100644 index 27e6f75de2..0000000000 --- a/test/Transforms/GVN/cond_br2.ll +++ /dev/null @@ -1,140 +0,0 @@ -; RUN: opt -basicaa -gvn -S < %s | FileCheck %s -target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" - -%"class.llvm::SmallVector" = type { %"class.llvm::SmallVectorImpl", [1 x %"union.llvm::SmallVectorBase::U"] } -%"class.llvm::SmallVectorImpl" = type { %"class.llvm::SmallVectorTemplateBase" } -%"class.llvm::SmallVectorTemplateBase" = type { %"class.llvm::SmallVectorTemplateCommon" } -%"class.llvm::SmallVectorTemplateCommon" = type { %"class.llvm::SmallVectorBase" } -%"class.llvm::SmallVectorBase" = type { i8*, i8*, i8*, %"union.llvm::SmallVectorBase::U" } -%"union.llvm::SmallVectorBase::U" = type { x86_fp80 } - -; Function Attrs: ssp uwtable -define void @_Z4testv() #0 { -; CHECK: @_Z4testv() -; CHECK: invoke.cont: -; CHECK: br i1 true, label %new.notnull.i11, label %if.end.i14 -; CHECK: Retry.i10: - -entry: - %sv = alloca %"class.llvm::SmallVector", align 16 - %0 = bitcast %"class.llvm::SmallVector"* %sv to i8* - call void @llvm.lifetime.start(i64 64, i8* %0) #1 - %BeginX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 0 - %FirstEl.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 3 - %1 = bitcast %"union.llvm::SmallVectorBase::U"* %FirstEl.i.i.i.i.i.i to i8* - store i8* %1, i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4 - %EndX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 1 - store i8* %1, i8** %EndX.i.i.i.i.i.i, align 8, !tbaa !4 - %CapacityX.i.i.i.i.i.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 2 - %add.ptr.i.i.i.i2.i.i = getelementptr inbounds %"union.llvm::SmallVectorBase::U"* %FirstEl.i.i.i.i.i.i, i64 2 - %add.ptr.i.i.i.i.i.i = bitcast %"union.llvm::SmallVectorBase::U"* %add.ptr.i.i.i.i2.i.i to i8* - store i8* %add.ptr.i.i.i.i.i.i, i8** %CapacityX.i.i.i.i.i.i, align 16, !tbaa !4 - %EndX.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 1 - %2 = load i8** %EndX.i, align 8, !tbaa !4 - %CapacityX.i = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0, i32 2 - %cmp.i = icmp ult i8* %2, %add.ptr.i.i.i.i.i.i - br i1 %cmp.i, label %Retry.i, label %if.end.i - -Retry.i: ; preds = %.noexc, %entry - %3 = phi i8* [ %2, %entry ], [ %.pre.i, %.noexc ] - %new.isnull.i = icmp eq i8* %3, null - br i1 %new.isnull.i, label %invoke.cont, label %new.notnull.i - -new.notnull.i: ; preds = %Retry.i - %4 = bitcast i8* %3 to i32* - store i32 1, i32* %4, align 4, !tbaa !5 - br label %invoke.cont - -if.end.i: ; preds = %entry - %5 = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0 - invoke void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"* %5, i64 0, i64 4) - to label %.noexc unwind label %lpad - -.noexc: ; preds = %if.end.i - %.pre.i = load i8** %EndX.i, align 8, !tbaa !4 - br label %Retry.i - -invoke.cont: ; preds = %new.notnull.i, %Retry.i - %add.ptr.i = getelementptr inbounds i8* %3, i64 4 - store i8* %add.ptr.i, i8** %EndX.i, align 8, !tbaa !4 - %6 = load i8** %CapacityX.i, align 16, !tbaa !4 - %cmp.i8 = icmp ult i8* %add.ptr.i, %6 - br i1 %cmp.i8, label %new.notnull.i11, label %if.end.i14 - -Retry.i10: ; preds = %if.end.i14 - %.pre.i13 = load i8** %EndX.i, align 8, !tbaa !4 - %new.isnull.i9 = icmp eq i8* %.pre.i13, null - br i1 %new.isnull.i9, label %invoke.cont2, label %new.notnull.i11 - -new.notnull.i11: ; preds = %invoke.cont, %Retry.i10 - %7 = phi i8* [ %.pre.i13, %Retry.i10 ], [ %add.ptr.i, %invoke.cont ] - %8 = bitcast i8* %7 to i32* - store i32 2, i32* %8, align 4, !tbaa !5 - br label %invoke.cont2 - -if.end.i14: ; preds = %invoke.cont - %9 = getelementptr inbounds %"class.llvm::SmallVector"* %sv, i64 0, i32 0, i32 0, i32 0, i32 0 - invoke void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"* %9, i64 0, i64 4) - to label %Retry.i10 unwind label %lpad - -invoke.cont2: ; preds = %new.notnull.i11, %Retry.i10 - %10 = phi i8* [ null, %Retry.i10 ], [ %7, %new.notnull.i11 ] - %add.ptr.i12 = getelementptr inbounds i8* %10, i64 4 - store i8* %add.ptr.i12, i8** %EndX.i, align 8, !tbaa !4 - invoke void @_Z1gRN4llvm11SmallVectorIiLj8EEE(%"class.llvm::SmallVector"* %sv) - to label %invoke.cont3 unwind label %lpad - -invoke.cont3: ; preds = %invoke.cont2 - %11 = load i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4 - %cmp.i.i.i.i19 = icmp eq i8* %11, %1 - br i1 %cmp.i.i.i.i19, label %_ZN4llvm11SmallVectorIiLj8EED1Ev.exit21, label %if.then.i.i.i20 - -if.then.i.i.i20: ; preds = %invoke.cont3 - call void @free(i8* %11) #1 - br label %_ZN4llvm11SmallVectorIiLj8EED1Ev.exit21 - -_ZN4llvm11SmallVectorIiLj8EED1Ev.exit21: ; preds = %invoke.cont3, %if.then.i.i.i20 - call void @llvm.lifetime.end(i64 64, i8* %0) #1 - ret void - -lpad: ; preds = %if.end.i14, %if.end.i, %invoke.cont2 - %12 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) - cleanup - %13 = load i8** %BeginX.i.i.i.i.i.i, align 16, !tbaa !4 - %cmp.i.i.i.i = icmp eq i8* %13, %1 - br i1 %cmp.i.i.i.i, label %eh.resume, label %if.then.i.i.i - -if.then.i.i.i: ; preds = %lpad - call void @free(i8* %13) #1 - br label %eh.resume - -eh.resume: ; preds = %if.then.i.i.i, %lpad - resume { i8*, i32 } %12 -} - -; Function Attrs: nounwind -declare void @llvm.lifetime.start(i64, i8* nocapture) #1 - -declare i32 @__gxx_personality_v0(...) - -declare void @_Z1gRN4llvm11SmallVectorIiLj8EEE(%"class.llvm::SmallVector"*) #2 - -; Function Attrs: nounwind -declare void @llvm.lifetime.end(i64, i8* nocapture) #1 - -declare void @_ZN4llvm15SmallVectorBase8grow_podEmm(%"class.llvm::SmallVectorBase"*, i64, i64) #2 - -; Function Attrs: nounwind -declare void @free(i8* nocapture) #3 - -attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #1 = { nounwind } -attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } -attributes #3 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } - -!0 = metadata !{metadata !"any pointer", metadata !1} -!1 = metadata !{metadata !"omnipotent char", metadata !2} -!2 = metadata !{metadata !"Simple C/C++ TBAA"} -!3 = metadata !{metadata !"int", metadata !1} -!4 = metadata !{metadata !0, metadata !0, i64 0} -!5 = metadata !{metadata !3, metadata !3, i64 0} diff --git a/test/Transforms/GVN/local-pre.ll b/test/Transforms/GVN/local-pre.ll index 2c92699dca..1d0dadfbe0 100644 --- a/test/Transforms/GVN/local-pre.ll +++ b/test/Transforms/GVN/local-pre.ll @@ -1,9 +1,9 @@ ; RUN: opt < %s -gvn -enable-pre -S | grep "b.pre" -define i32 @main(i32 %p, i32 %q) { +define i32 @main(i32 %p) { block1: - %cmp = icmp eq i32 %p, %q - br i1 %cmp, label %block2, label %block3 + + br i1 true, label %block2, label %block3 block2: %a = add i32 %p, 1 diff --git a/test/Transforms/GVN/rle-nonlocal.ll b/test/Transforms/GVN/rle-nonlocal.ll index 8229aaa142..6b74e9a946 100644 --- a/test/Transforms/GVN/rle-nonlocal.ll +++ b/test/Transforms/GVN/rle-nonlocal.ll @@ -1,9 +1,8 @@ ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s -define i32 @main(i32** %p, i32 %x, i32 %y) { +define i32 @main(i32** %p) { block1: - %cmp = icmp eq i32 %x, %y - br i1 %cmp , label %block2, label %block3 + br i1 true, label %block2, label %block3 block2: %a = load i32** %p diff --git a/test/Transforms/GVN/rle-semidominated.ll b/test/Transforms/GVN/rle-semidominated.ll index 923cd03ecd..71aa548ab1 100644 --- a/test/Transforms/GVN/rle-semidominated.ll +++ b/test/Transforms/GVN/rle-semidominated.ll @@ -1,10 +1,9 @@ ; RUN: opt < %s -basicaa -gvn -S | grep "DEAD = phi i32 " -define i32 @main(i32* %p, i32 %x, i32 %y) { +define i32 @main(i32* %p) { block1: %z = load i32* %p - %cmp = icmp eq i32 %x, %y - br i1 %cmp, label %block2, label %block3 + br i1 true, label %block2, label %block3 block2: br label %block4 diff --git a/test/Transforms/GVN/rle.ll b/test/Transforms/GVN/rle.ll index 8d289b0699..4c5d40a3c1 100644 --- a/test/Transforms/GVN/rle.ll +++ b/test/Transforms/GVN/rle.ll @@ -369,14 +369,13 @@ Cont: ; CHECK: ret i8 %A } -define i32 @chained_load(i32** %p, i32 %x, i32 %y) { +define i32 @chained_load(i32** %p) { block1: %A = alloca i32* %z = load i32** %p store i32* %z, i32** %A - %cmp = icmp eq i32 %x, %y - br i1 %cmp, label %block2, label %block3 + br i1 true, label %block2, label %block3 block2: %a = load i32** %p @@ -440,11 +439,10 @@ TY: ret i32 0 } -define i32 @phi_trans3(i32* %p, i32 %x, i32 %y, i32 %z) { +define i32 @phi_trans3(i32* %p) { ; CHECK-LABEL: @phi_trans3( block1: - %cmpxy = icmp eq i32 %x, %y - br i1 %cmpxy, label %block2, label %block3 + br i1 true, label %block2, label %block3 block2: store i32 87, i32* %p @@ -457,7 +455,7 @@ block3: block4: %A = phi i32 [-1, %block2], [42, %block3] - br i1 %cmpxy, label %block5, label %exit + br i1 true, label %block5, label %exit ; CHECK: block4: ; CHECK-NEXT: %D = phi i32 [ 87, %block2 ], [ 97, %block3 ] @@ -465,11 +463,11 @@ block4: block5: %B = add i32 %A, 1 - br i1 %cmpxy, label %block6, label %exit + br i1 true, label %block6, label %exit block6: %C = getelementptr i32* %p, i32 %B - br i1 %cmpxy, label %block7, label %exit + br i1 true, label %block7, label %exit block7: %D = load i32* %C -- cgit v1.2.3