[llvm] 14d45e4 - [test] Update precommit tests for D108734
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 26 12:06:42 PDT 2021
Author: Arthur Eubanks
Date: 2021-08-26T12:05:56-07:00
New Revision: 14d45e41bf8198ce7c43696c284b69222861b1fd
URL: https://github.com/llvm/llvm-project/commit/14d45e41bf8198ce7c43696c284b69222861b1fd
DIFF: https://github.com/llvm/llvm-project/commit/14d45e41bf8198ce7c43696c284b69222861b1fd.diff
LOG: [test] Update precommit tests for D108734
Added:
Modified:
llvm/test/Transforms/InstCombine/invariant.group.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/invariant.group.ll b/llvm/test/Transforms/InstCombine/invariant.group.ll
index 7480242ee0960..76605c05a784d 100644
--- a/llvm/test/Transforms/InstCombine/invariant.group.ll
+++ b/llvm/test/Transforms/InstCombine/invariant.group.ll
@@ -159,31 +159,59 @@ define i16 addrspace(42)* @skipWithDifferentTypesDifferentAddrspace(i8* %a) {
ret i16 addrspace(42)* %a3
}
-define i1 @icmp1(i8* %a) {
-; CHECK-LABEL: @icmp1(
+define i1 @icmp_launder(i8* %a) {
+; CHECK-LABEL: @icmp_launder(
; CHECK-NEXT: [[A2:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* [[A:%.*]])
-; CHECK-NEXT: [[TMP1:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* [[A]])
-; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[A2]], [[TMP1]]
+; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[A2]], null
; CHECK-NEXT: ret i1 [[R]]
;
%a2 = call i8* @llvm.launder.invariant.group.p0i8(i8* %a)
- %a3 = call i8* @llvm.strip.invariant.group.p0i8(i8* %a2)
- %r = icmp eq i8* %a2, %a3
+ %r = icmp eq i8* %a2, null
ret i1 %r
}
-define i1 @icmp2(i8* %a, i8* %b) {
-; CHECK-LABEL: @icmp2(
-; CHECK-NEXT: [[TMP1:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* [[A:%.*]])
-; CHECK-NEXT: [[TMP2:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* [[B:%.*]])
-; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[TMP1]], [[TMP2]]
+define i1 @icmp_strip(i8* %a) {
+; CHECK-LABEL: @icmp_strip(
+; CHECK-NEXT: [[A2:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* [[A:%.*]])
+; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[A2]], null
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %a2 = call i8* @llvm.strip.invariant.group.p0i8(i8* %a)
+ %r = icmp eq i8* %a2, null
+ ret i1 %r
+}
+
+define i1 @icmp_launder_valid_null(i8* %a) #0 {
+; CHECK-LABEL: @icmp_launder_valid_null(
+; CHECK-NEXT: [[A2:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* [[A:%.*]])
+; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[A2]], null
; CHECK-NEXT: ret i1 [[R]]
;
%a2 = call i8* @llvm.launder.invariant.group.p0i8(i8* %a)
- %a3 = call i8* @llvm.strip.invariant.group.p0i8(i8* %a2)
- %b2 = call i8* @llvm.strip.invariant.group.p0i8(i8* %b)
- %b3 = call i8* @llvm.launder.invariant.group.p0i8(i8* %b2)
- %r = icmp eq i8* %a3, %b3
+ %r = icmp eq i8* %a2, null
+ ret i1 %r
+}
+
+define i1 @icmp_strip_valid_null(i8* %a) #0 {
+; CHECK-LABEL: @icmp_strip_valid_null(
+; CHECK-NEXT: [[A2:%.*]] = call i8* @llvm.strip.invariant.group.p0i8(i8* [[A:%.*]])
+; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[A2]], null
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %a2 = call i8* @llvm.strip.invariant.group.p0i8(i8* %a)
+ %r = icmp eq i8* %a2, null
+ ret i1 %r
+}
+
+; Check that null always becomes the RHS
+define i1 @icmp_launder_lhs(i8* %a) {
+; CHECK-LABEL: @icmp_launder_lhs(
+; CHECK-NEXT: [[A2:%.*]] = call i8* @llvm.launder.invariant.group.p0i8(i8* [[A:%.*]])
+; CHECK-NEXT: [[R:%.*]] = icmp eq i8* [[A2]], null
+; CHECK-NEXT: ret i1 [[R]]
+;
+ %a2 = call i8* @llvm.launder.invariant.group.p0i8(i8* %a)
+ %r = icmp eq i8* null, %a2
ret i1 %r
}
More information about the llvm-commits
mailing list