[llvm] 451b1bd - [NFC][InstCombine] Add a PHI-of-insertvalues test with different base aggregate types
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 23:58:12 PDT 2020
Author: Roman Lebedev
Date: 2020-08-26T09:57:50+03:00
New Revision: 451b1bd894f6cf8b2359214b186079f7f0f698cf
URL: https://github.com/llvm/llvm-project/commit/451b1bd894f6cf8b2359214b186079f7f0f698cf
DIFF: https://github.com/llvm/llvm-project/commit/451b1bd894f6cf8b2359214b186079f7f0f698cf.diff
LOG: [NFC][InstCombine] Add a PHI-of-insertvalues test with different base aggregate types
Added:
Modified:
llvm/test/Transforms/InstCombine/phi-of-extractvalues.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/phi-of-extractvalues.ll b/llvm/test/Transforms/InstCombine/phi-of-extractvalues.ll
index 72abd9d64adb..78ea09f7e636 100644
--- a/llvm/test/Transforms/InstCombine/phi-of-extractvalues.ll
+++ b/llvm/test/Transforms/InstCombine/phi-of-extractvalues.ll
@@ -282,3 +282,35 @@ end:
%r = phi i32 [ %i0, %left ], [ %i1, %right ]
ret i32 %r
}
+
+; Also, unlike PHI-of-insertvalues, here the base aggregates of extractvalue
+; can have
diff erent types, and just checking the indicies is not enough.
+define i32 @test9({ i32, i32 } %agg_left, { i32, { i32, i32 } } %agg_right, i1 %c) {
+; CHECK-LABEL: @test9(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[C:%.*]], label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK: left:
+; CHECK-NEXT: [[I0:%.*]] = extractvalue { i32, i32 } [[AGG_LEFT:%.*]], 0
+; CHECK-NEXT: br label [[END:%.*]]
+; CHECK: right:
+; CHECK-NEXT: [[I1:%.*]] = extractvalue { i32, { i32, i32 } } [[AGG_RIGHT:%.*]], 0
+; CHECK-NEXT: br label [[END]]
+; CHECK: end:
+; CHECK-NEXT: [[R:%.*]] = phi i32 [ [[I0]], [[LEFT]] ], [ [[I1]], [[RIGHT]] ]
+; CHECK-NEXT: ret i32 [[R]]
+;
+entry:
+ br i1 %c, label %left, label %right
+
+left:
+ %i0 = extractvalue { i32, i32 } %agg_left, 0
+ br label %end
+
+right:
+ %i1 = extractvalue { i32, { i32, i32 } } %agg_right, 0
+ br label %end
+
+end:
+ %r = phi i32 [ %i0, %left ], [ %i1, %right ]
+ ret i32 %r
+}
More information about the llvm-commits
mailing list