[llvm] 1ae766e - [InstCombine] Add tests for select(freeze(undef)); NFC
Juneyoung Lee via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 28 23:27:22 PDT 2020
Author: Juneyoung Lee
Date: 2020-07-29T15:27:09+09:00
New Revision: 1ae766e3e06a233ce9d60a5734f29e78ccd80639
URL: https://github.com/llvm/llvm-project/commit/1ae766e3e06a233ce9d60a5734f29e78ccd80639
DIFF: https://github.com/llvm/llvm-project/commit/1ae766e3e06a233ce9d60a5734f29e78ccd80639.diff
LOG: [InstCombine] Add tests for select(freeze(undef)); NFC
Added:
Modified:
llvm/test/Transforms/InstCombine/select.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/select.ll b/llvm/test/Transforms/InstCombine/select.ll
index 93281ce1f799..c2cacc0b14ee 100644
--- a/llvm/test/Transforms/InstCombine/select.ll
+++ b/llvm/test/Transforms/InstCombine/select.ll
@@ -2487,3 +2487,42 @@ define <2 x i32> @true_undef_vec(i1 %cond, <2 x i32> %x) {
%s = select i1 %cond, <2 x i32> undef, <2 x i32> %x
ret <2 x i32> %s
}
+
+define i8 @cond_freeze(i8 %x, i8 %y) {
+; CHECK-LABEL: @cond_freeze(
+; CHECK-NEXT: [[COND_FR:%.*]] = freeze i1 undef
+; CHECK-NEXT: [[S:%.*]] = select i1 [[COND_FR]], i8 [[X:%.*]], i8 [[Y:%.*]]
+; CHECK-NEXT: ret i8 [[S]]
+;
+ %cond.fr = freeze i1 undef
+ %s = select i1 %cond.fr, i8 %x, i8 %y
+ ret i8 %s
+}
+
+define i8 @cond_freeze2(i8 %x, i8 %y) {
+; CHECK-LABEL: @cond_freeze2(
+; CHECK-NEXT: [[COND_FR:%.*]] = freeze i1 undef
+; CHECK-NEXT: [[S:%.*]] = select i1 [[COND_FR]], i8 [[X:%.*]], i8 1
+; CHECK-NEXT: ret i8 [[S]]
+;
+ %cond.fr = freeze i1 undef
+ %s = select i1 %cond.fr, i8 %x, i8 1
+ ret i8 %s
+}
+
+declare void @foo2(i8, i8)
+
+define void @cond_freeze_multipleuses(i8 %x, i8 %y) {
+; CHECK-LABEL: @cond_freeze_multipleuses(
+; CHECK-NEXT: [[COND_FR:%.*]] = freeze i1 undef
+; CHECK-NEXT: [[S:%.*]] = select i1 [[COND_FR]], i8 [[X:%.*]], i8 [[Y:%.*]]
+; CHECK-NEXT: [[S2:%.*]] = select i1 [[COND_FR]], i8 [[Y]], i8 [[X]]
+; CHECK-NEXT: call void @foo2(i8 [[S]], i8 [[S2]])
+; CHECK-NEXT: ret void
+;
+ %cond.fr = freeze i1 undef
+ %s = select i1 %cond.fr, i8 %x, i8 %y
+ %s2 = select i1 %cond.fr, i8 %y, i8 %x
+ call void @foo2(i8 %s, i8 %s2)
+ ret void
+}
More information about the llvm-commits
mailing list