[llvm] 8be07f6 - InstCombine: Don't use anonymous values in tests
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 1 20:09:03 PST 2022
Author: Matt Arsenault
Date: 2022-12-01T23:08:57-05:00
New Revision: 8be07f6ad605a96913390320fca7976c8f7566de
URL: https://github.com/llvm/llvm-project/commit/8be07f6ad605a96913390320fca7976c8f7566de
DIFF: https://github.com/llvm/llvm-project/commit/8be07f6ad605a96913390320fca7976c8f7566de.diff
LOG: InstCombine: Don't use anonymous values in tests
These interfered with opaquification
Added:
Modified:
llvm/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
llvm/test/Transforms/InstCombine/pr44245.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll b/llvm/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
index addb862949c4..7e1f4506079d 100644
--- a/llvm/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
+++ b/llvm/test/Transforms/InstCombine/2011-06-13-nsw-alloca.ll
@@ -3,62 +3,68 @@ target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f3
target triple = "i386-apple-darwin10.0.0"
; CHECK-LABEL: define void @fu1(
-define void @fu1(i32 %parm) nounwind ssp {
- %1 = alloca i32, align 4
-; CHECK: alloca double*
+define void @fu1(i32 %parm) #0 {
+bb:
+ %i = alloca i32, align 4
+
+ ; CHECK: alloca double*
%ptr = alloca double*, align 4
- store i32 %parm, i32* %1, align 4
+ store i32 %parm, i32* %i, align 4
store double* null, double** %ptr, align 4
- %2 = load i32, i32* %1, align 4
- %3 = icmp ne i32 %2, 0
- br i1 %3, label %4, label %10
+ %i1 = load i32, i32* %i, align 4
+ %i2 = icmp ne i32 %i1, 0
+ br i1 %i2, label %bb3, label %bb9
+
+bb3: ; preds = %bb
+ %i4 = load i32, i32* %i, align 4
+ %i5 = shl nuw i32 %i4, 3
+ ; With "nuw", the alloca and its bitcast can be fused:
+ %i6 = add nuw i32 %i5, 2048
-; <label>:4 ; preds = %0
- %5 = load i32, i32* %1, align 4
- %6 = shl nuw i32 %5, 3
-; With "nuw", the alloca and its bitcast can be fused:
- %7 = add nuw i32 %6, 2048
-; CHECK: alloca double
- %8 = alloca i8, i32 %7
- %9 = bitcast i8* %8 to double*
-; CHECK-NEXT: store double*
- store double* %9, double** %ptr, align 4
- br label %10
-; <label>:10 ; preds = %4, %0
- %11 = load double*, double** %ptr, align 4
- call void @bar(double* %11)
-; CHECK: ret
+ ; CHECK: alloca double
+ %i7 = alloca i8, i32 %i6, align 1
+ %i8 = bitcast i8* %i7 to double*
+ ; CHECK-NEXT: store double*
+ store double* %i8, double** %ptr, align 4
+ br label %bb9
+
+bb9: ; preds = %bb3, %bb
+ %i10 = load double*, double** %ptr, align 4
+ call void @bar(double* %i10)
ret void
}
declare void @bar(double*)
; CHECK-LABEL: define void @fu2(
-define void @fu2(i32 %parm) nounwind ssp {
- %1 = alloca i32, align 4
+define void @fu2(i32 %parm) #0 {
+bb:
+ %i = alloca i32, align 4
%ptr = alloca double*, align 4
- store i32 %parm, i32* %1, align 4
+ store i32 %parm, i32* %i, align 4
store double* null, double** %ptr, align 4
- %2 = load i32, i32* %1, align 4
- %3 = icmp ne i32 %2, 0
- br i1 %3, label %4, label %10
+ %i1 = load i32, i32* %i, align 4
+ %i2 = icmp ne i32 %i1, 0
+ br i1 %i2, label %bb3, label %bb9
+
+bb3: ; preds = %bb
+ %i4 = load i32, i32* %i, align 4
+ %i5 = mul nuw i32 %i4, 8
+ ; Without "nuw", the alloca and its bitcast cannot be fused:
+ %i6 = add i32 %i5, 2048
+ ; CHECK: alloca i8
+ %i7 = alloca i8, i32 %i6, align 1
-; <label>:4 ; preds = %0
- %5 = load i32, i32* %1, align 4
- %6 = mul nuw i32 %5, 8
-; Without "nuw", the alloca and its bitcast cannot be fused:
- %7 = add i32 %6, 2048
-; CHECK: alloca i8
- %8 = alloca i8, i32 %7
-; CHECK-NEXT: bitcast double**
-; CHECK-NEXT: store i8*
- %9 = bitcast i8* %8 to double*
- store double* %9, double** %ptr, align 4
- br label %10
+ ; CHECK-NEXT: bitcast double**
+ ; CHECK-NEXT: store i8*
+ %i8 = bitcast i8* %i7 to double*
+ store double* %i8, double** %ptr, align 4
+ br label %bb9
-; <label>:10 ; preds = %4, %0
- %11 = load double*, double** %ptr, align 4
- call void @bar(double* %11)
+bb9: ; preds = %bb3, %bb
+ %i10 = load double*, double** %ptr, align 4
+ call void @bar(double* %i10)
ret void
}
+attributes #0 = { nounwind ssp }
diff --git a/llvm/test/Transforms/InstCombine/pr44245.ll b/llvm/test/Transforms/InstCombine/pr44245.ll
index 3ecd9028e923..3d781a325065 100644
--- a/llvm/test/Transforms/InstCombine/pr44245.ll
+++ b/llvm/test/Transforms/InstCombine/pr44245.ll
@@ -8,8 +8,8 @@ define void @test(i1 %c) {
; CHECK-NEXT: bb16:
; CHECK-NEXT: br i1 [[C:%.*]], label [[BB17:%.*]], label [[BB24:%.*]]
; CHECK: bb17:
-; CHECK-NEXT: [[TMP0:%.*]] = phi i8* [ [[TMP1:%.*]], [[BB47:%.*]] ], [ undef, [[BB16:%.*]] ]
-; CHECK-NEXT: store i8* [[TMP0]], i8** undef, align 8
+; CHECK-NEXT: [[I:%.*]] = phi i8* [ [[TMP0:%.*]], [[BB47:%.*]] ], [ undef, [[BB16:%.*]] ]
+; CHECK-NEXT: store i8* [[I]], i8** undef, align 8
; CHECK-NEXT: ret void
; CHECK: bb24:
; CHECK-NEXT: br i1 [[C]], label [[BB44:%.*]], label [[BB49:%.*]]
@@ -17,7 +17,7 @@ define void @test(i1 %c) {
; CHECK-NEXT: [[TMP467:%.*]] = load i8*, i8** inttoptr (i64 16 to i8**), align 16
; CHECK-NEXT: br label [[BB47]]
; CHECK: bb47:
-; CHECK-NEXT: [[TMP1]] = phi i8* [ [[TMP2:%.*]], [[BB150:%.*]] ], [ [[TMP1221:%.*]], [[BB119:%.*]] ], [ [[TMP1032:%.*]], [[BB101:%.*]] ], [ [[TMP933:%.*]], [[BB91:%.*]] ], [ [[TMP834:%.*]], [[BB81:%.*]] ], [ [[TMP705:%.*]], [[BB67:%.*]] ], [ [[TMP586:%.*]], [[BB56:%.*]] ], [ [[TMP467]], [[BB44]] ]
+; CHECK-NEXT: [[TMP0]] = phi i8* [ [[TMP1:%.*]], [[BB150:%.*]] ], [ [[TMP1221:%.*]], [[BB119:%.*]] ], [ [[TMP1032:%.*]], [[BB101:%.*]] ], [ [[TMP933:%.*]], [[BB91:%.*]] ], [ [[TMP834:%.*]], [[BB81:%.*]] ], [ [[TMP705:%.*]], [[BB67:%.*]] ], [ [[TMP586:%.*]], [[BB56:%.*]] ], [ [[TMP467]], [[BB44]] ]
; CHECK-NEXT: br label [[BB17]]
; CHECK: bb49:
; CHECK-NEXT: br i1 [[C]], label [[BB56]], label [[BB59:%.*]]
@@ -55,79 +55,79 @@ define void @test(i1 %c) {
; CHECK-NEXT: [[TMP1499:%.*]] = load i8*, i8** inttoptr (i64 16 to i8**), align 16
; CHECK-NEXT: br label [[BB150]]
; CHECK: bb150:
-; CHECK-NEXT: [[TMP2]] = phi i8* [ [[TMP1848:%.*]], [[BB152]] ], [ [[TMP1499]], [[BB147]] ]
+; CHECK-NEXT: [[TMP1]] = phi i8* [ [[TMP1848:%.*]], [[BB152]] ], [ [[TMP1499]], [[BB147]] ]
; CHECK-NEXT: br label [[BB47]]
; CHECK: bb152:
; CHECK-NEXT: [[TMP1848]] = load i8*, i8** inttoptr (i64 16 to i8**), align 16
; CHECK-NEXT: store i1 true, i1* poison, align 1
; CHECK-NEXT: br label [[BB150]]
;
-bb16: ; preds = %bb
+bb16:
br i1 %c, label %bb17, label %bb24
-bb17: ; preds = %bb47, %bb17
- %0 = phi i8* [ %1, %bb47 ], [ undef, %bb16 ]
- store i8* %0, i8** undef, align 8
+bb17: ; preds = %bb47, %bb16
+ %i = phi i8* [ %i1, %bb47 ], [ undef, %bb16 ]
+ store i8* %i, i8** undef, align 8
ret void
-bb24: ; preds = %bb24
+bb24: ; preds = %bb16
br i1 %c, label %bb44, label %bb49
-bb44: ; preds = %bb43
+bb44: ; preds = %bb24
%tmp46 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
br label %bb47
bb47: ; preds = %bb150, %bb119, %bb101, %bb91, %bb81, %bb67, %bb56, %bb44
%.in1 = phi i64* [ %.in, %bb150 ], [ %tmp122, %bb119 ], [ %tmp103, %bb101 ], [ %tmp93, %bb91 ], [ %tmp83, %bb81 ], [ %tmp70, %bb67 ], [ %tmp58, %bb56 ], [ %tmp46, %bb44 ]
- %1 = bitcast i64* %.in1 to i8*
+ %i1 = bitcast i64* %.in1 to i8*
br label %bb17
-bb49: ; preds = %bb49
+bb49: ; preds = %bb24
br i1 %c, label %bb56, label %bb59
-bb56: ; preds = %bb55
+bb56: ; preds = %bb49
%tmp58 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
br label %bb47
-bb59: ; preds = %bb59
+bb59: ; preds = %bb49
br i1 %c, label %bb67, label %bb71
-bb67: ; preds = %bb66
+bb67: ; preds = %bb59
%tmp70 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
br label %bb47
-bb71: ; preds = %bb71
+bb71: ; preds = %bb59
br i1 %c, label %bb81, label %bb84
-bb81: ; preds = %bb80
+bb81: ; preds = %bb71
%tmp83 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
br label %bb47
-bb84: ; preds = %bb84
+bb84: ; preds = %bb71
br i1 %c, label %bb91, label %bb94
-bb91: ; preds = %bb90
+bb91: ; preds = %bb84
%tmp93 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
br label %bb47
-bb94: ; preds = %bb94
+bb94: ; preds = %bb84
br i1 %c, label %bb101, label %bb104
-bb101: ; preds = %bb100
+bb101: ; preds = %bb94
%tmp103 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
br label %bb47
-bb104: ; preds = %bb104
+bb104: ; preds = %bb94
br i1 %c, label %bb119, label %bb123
-bb119: ; preds = %bb118
+bb119: ; preds = %bb104
%tmp122 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
br label %bb47
-bb123: ; preds = %bb123
+bb123: ; preds = %bb104
br i1 %c, label %bb147, label %bb152
-bb147: ; preds = %bb146
+bb147: ; preds = %bb123
%tmp149 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
br label %bb150
@@ -135,15 +135,15 @@ bb150: ; preds = %bb152, %bb147
%.in = phi i64* [ %tmp184, %bb152 ], [ %tmp149, %bb147 ]
br label %bb47
-bb152: ; preds = %bb146
+bb152: ; preds = %bb123
%tmp184 = load i64*, i64** inttoptr (i64 16 to i64**), align 16
call void undef()
br label %bb150
}
+
; This used to cause an instcombine loop when the problem above was
; addressed in a non-robust fashion.
-
%type_1 = type {}
%type_2 = type {}
%type_3 = type {}
@@ -177,15 +177,15 @@ while.cond: ; preds = %cond.end144, %entry
for.cond: ; preds = %while.cond
br i1 %c, label %cond.true133, label %cond.false138
-cond.true133: ; preds = %sw.epilog
- %0 = load %type_2*, %type_2** undef, align 8
+cond.true133: ; preds = %for.cond
+ %i = load %type_2*, %type_2** undef, align 8
br label %cond.end144
-cond.false138: ; preds = %sw.epilog
- %1 = load %type_2*, %type_2** undef, align 8
+cond.false138: ; preds = %for.cond
+ %i1 = load %type_2*, %type_2** undef, align 8
br label %cond.end144
cond.end144: ; preds = %cond.false138, %cond.true133
- %cond145 = phi %type_2* [ %0, %cond.true133 ], [ %1, %cond.false138 ]
+ %cond145 = phi %type_2* [ %i, %cond.true133 ], [ %i1, %cond.false138 ]
br label %while.cond
}
More information about the llvm-commits
mailing list