[llvm] 4dec8ec - [NFC][InstCombine] Multi-level aggregate test for phi-of-insertvalue pattern
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 24 12:40:02 PDT 2020
Author: Roman Lebedev
Date: 2020-08-24T22:39:34+03:00
New Revision: 4dec8ec33d685bac27c047f74723263f3fb03256
URL: https://github.com/llvm/llvm-project/commit/4dec8ec33d685bac27c047f74723263f3fb03256
DIFF: https://github.com/llvm/llvm-project/commit/4dec8ec33d685bac27c047f74723263f3fb03256.diff
LOG: [NFC][InstCombine] Multi-level aggregate test for phi-of-insertvalue pattern
See https://reviews.llvm.org/D86306
Added:
Modified:
llvm/test/Transforms/InstCombine/phi-of-insertvalues.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/phi-of-insertvalues.ll b/llvm/test/Transforms/InstCombine/phi-of-insertvalues.ll
index dc9c45ca1294..787a7e62769b 100644
--- a/llvm/test/Transforms/InstCombine/phi-of-insertvalues.ll
+++ b/llvm/test/Transforms/InstCombine/phi-of-insertvalues.ll
@@ -224,3 +224,65 @@ end:
%r = phi { i32, i32 } [ %i0, %left ], [ %i1, %right ]
ret { i32, i32 } %r
}
+
+; More complex aggregates are fine, too, as long as indicies match.
+define {{ i32, i32 }, { i32, i32 }} @test7({{ i32, i32 }, { i32, i32 }} %agg, i32 %val_left, i32 %val_right, i1 %c) {
+; CHECK-LABEL: @test7(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[C:%.*]], label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK: left:
+; CHECK-NEXT: [[I0:%.*]] = insertvalue { { i32, i32 }, { i32, i32 } } [[AGG:%.*]], i32 [[VAL_LEFT:%.*]], 0, 0
+; CHECK-NEXT: br label [[END:%.*]]
+; CHECK: right:
+; CHECK-NEXT: [[I1:%.*]] = insertvalue { { i32, i32 }, { i32, i32 } } [[AGG]], i32 [[VAL_RIGHT:%.*]], 0, 0
+; CHECK-NEXT: br label [[END]]
+; CHECK: end:
+; CHECK-NEXT: [[R:%.*]] = phi { { i32, i32 }, { i32, i32 } } [ [[I0]], [[LEFT]] ], [ [[I1]], [[RIGHT]] ]
+; CHECK-NEXT: ret { { i32, i32 }, { i32, i32 } } [[R]]
+;
+entry:
+ br i1 %c, label %left, label %right
+
+left:
+ %i0 = insertvalue {{ i32, i32 }, { i32, i32 }} %agg, i32 %val_left, 0, 0
+ br label %end
+
+right:
+ %i1 = insertvalue {{ i32, i32 }, { i32, i32 }} %agg, i32 %val_right, 0, 0
+ br label %end
+
+end:
+ %r = phi {{ i32, i32 }, { i32, i32 }} [ %i0, %left ], [ %i1, %right ]
+ ret {{ i32, i32 }, { i32, i32 }} %r
+}
+
+; The indicies must fully match, on all levels.
+define {{ i32, i32 }, { i32, i32 }} @test8({{ i32, i32 }, { i32, i32 }} %agg, i32 %val_left, i32 %val_right, i1 %c) {
+; CHECK-LABEL: @test8(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[C:%.*]], label [[LEFT:%.*]], label [[RIGHT:%.*]]
+; CHECK: left:
+; CHECK-NEXT: [[I0:%.*]] = insertvalue { { i32, i32 }, { i32, i32 } } [[AGG:%.*]], i32 [[VAL_LEFT:%.*]], 0, 0
+; CHECK-NEXT: br label [[END:%.*]]
+; CHECK: right:
+; CHECK-NEXT: [[I1:%.*]] = insertvalue { { i32, i32 }, { i32, i32 } } [[AGG]], i32 [[VAL_RIGHT:%.*]], 0, 1
+; CHECK-NEXT: br label [[END]]
+; CHECK: end:
+; CHECK-NEXT: [[R:%.*]] = phi { { i32, i32 }, { i32, i32 } } [ [[I0]], [[LEFT]] ], [ [[I1]], [[RIGHT]] ]
+; CHECK-NEXT: ret { { i32, i32 }, { i32, i32 } } [[R]]
+;
+entry:
+ br i1 %c, label %left, label %right
+
+left:
+ %i0 = insertvalue {{ i32, i32 }, { i32, i32 }} %agg, i32 %val_left, 0, 0
+ br label %end
+
+right:
+ %i1 = insertvalue {{ i32, i32 }, { i32, i32 }} %agg, i32 %val_right, 0, 1
+ br label %end
+
+end:
+ %r = phi {{ i32, i32 }, { i32, i32 }} [ %i0, %left ], [ %i1, %right ]
+ ret {{ i32, i32 }, { i32, i32 }} %r
+}
More information about the llvm-commits
mailing list