[llvm] b50961b - [CVP] Add test for PR59887 (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 9 07:16:31 PST 2023
Author: Nikita Popov
Date: 2023-01-09T16:16:23+01:00
New Revision: b50961bded5cb8e224c4c11714eb3acfa2d81293
URL: https://github.com/llvm/llvm-project/commit/b50961bded5cb8e224c4c11714eb3acfa2d81293
DIFF: https://github.com/llvm/llvm-project/commit/b50961bded5cb8e224c4c11714eb3acfa2d81293.diff
LOG: [CVP] Add test for PR59887 (NFC)
Also fix all the incorrect intrinsic name mangling while here.
Added:
Modified:
llvm/test/Transforms/CorrelatedValuePropagation/abs.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/abs.ll b/llvm/test/Transforms/CorrelatedValuePropagation/abs.ll
index e9f41b2a15323..47ed7892b5d3f 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/abs.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/abs.ll
@@ -2,7 +2,8 @@
; RUN: opt < %s -passes=correlated-propagation -S | FileCheck %s
declare void @llvm.assume(i1)
-declare i8 @llvm.abs(i8, i1)
+declare i8 @llvm.abs.i8(i8, i1)
+declare i1 @llvm.abs.i1(i1, i1)
; If we don't know anything about the argument, we can't do anything.
@@ -11,7 +12,7 @@ define i8 @test0(i8 %x) {
; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.abs.i8(i8 [[X:%.*]], i1 false)
; CHECK-NEXT: ret i8 [[R]]
;
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test1(i8 %x) {
@@ -19,7 +20,7 @@ define i8 @test1(i8 %x) {
; CHECK-NEXT: [[R:%.*]] = call i8 @llvm.abs.i8(i8 [[X:%.*]], i1 true)
; CHECK-NEXT: ret i8 [[R]]
;
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -35,7 +36,7 @@ define i8 @test2(i8 %x) {
%lim = icmp sge i8 %x, -1
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test3(i8 %x) {
@@ -48,7 +49,7 @@ define i8 @test3(i8 %x) {
%lim = icmp sge i8 %x, -1
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -61,7 +62,7 @@ define i8 @test4(i8 %x) {
%lim = icmp sge i8 %x, 0
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test5(i8 %x) {
@@ -73,7 +74,7 @@ define i8 @test5(i8 %x) {
%lim = icmp sge i8 %x, 0
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -86,7 +87,7 @@ define i8 @test6(i8 %x) {
%lim = icmp sge i8 %x, 1
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test7(i8 %x) {
@@ -98,7 +99,7 @@ define i8 @test7(i8 %x) {
%lim = icmp sge i8 %x, 1
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -113,7 +114,7 @@ define i8 @test8(i8 %x) {
%lim = icmp ule i8 %x, 127
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test9(i8 %x) {
@@ -125,7 +126,7 @@ define i8 @test9(i8 %x) {
%lim = icmp ule i8 %x, 127
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -138,7 +139,7 @@ define i8 @test10(i8 %x) {
%lim = icmp ule i8 %x, 128
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test11(i8 %x) {
@@ -150,7 +151,7 @@ define i8 @test11(i8 %x) {
%lim = icmp ule i8 %x, 128
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -164,7 +165,7 @@ define i8 @test12(i8 %x) {
%lim = icmp ule i8 %x, 129
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test13(i8 %x) {
@@ -177,7 +178,7 @@ define i8 @test13(i8 %x) {
%lim = icmp ule i8 %x, 129
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -195,7 +196,7 @@ define i8 @test14(i8 %x) {
%lim = icmp sle i8 %x, -1
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test15(i8 %x) {
@@ -208,7 +209,7 @@ define i8 @test15(i8 %x) {
%lim = icmp sle i8 %x, -1
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -222,7 +223,7 @@ define i8 @test16(i8 %x) {
%lim = icmp sle i8 %x, 0
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test17(i8 %x) {
@@ -235,7 +236,7 @@ define i8 @test17(i8 %x) {
%lim = icmp sle i8 %x, 0
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -249,7 +250,7 @@ define i8 @test18(i8 %x) {
%lim = icmp sle i8 %x, 1
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test19(i8 %x) {
@@ -262,7 +263,7 @@ define i8 @test19(i8 %x) {
%lim = icmp sle i8 %x, 1
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -278,7 +279,7 @@ define i8 @test20(i8 %x) {
%lim = icmp uge i8 %x, 127
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test21(i8 %x) {
@@ -291,7 +292,7 @@ define i8 @test21(i8 %x) {
%lim = icmp uge i8 %x, 127
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -305,7 +306,7 @@ define i8 @test22(i8 %x) {
%lim = icmp uge i8 %x, 128
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test23(i8 %x) {
@@ -318,7 +319,7 @@ define i8 @test23(i8 %x) {
%lim = icmp uge i8 %x, 128
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -332,7 +333,7 @@ define i8 @test24(i8 %x) {
%lim = icmp uge i8 %x, 129
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test25(i8 %x) {
@@ -345,7 +346,7 @@ define i8 @test25(i8 %x) {
%lim = icmp uge i8 %x, 129
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
@@ -360,7 +361,7 @@ define i8 @test26(i8 %x) {
;
%lim = icmp ne i8 %x, 128
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 0)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 0)
ret i8 %r
}
define i8 @test27(i8 %x) {
@@ -372,6 +373,17 @@ define i8 @test27(i8 %x) {
;
%lim = icmp ne i8 %x, 128
call void @llvm.assume(i1 %lim)
- %r = call i8 @llvm.abs(i8 %x, i1 1)
+ %r = call i8 @llvm.abs.i8(i8 %x, i1 1)
ret i8 %r
}
+
+define i1 @pr59887(i1 %x, i1 %c) {
+; CHECK-LABEL: @pr59887(
+; CHECK-NEXT: [[ABS:%.*]] = call i1 @llvm.abs.i1(i1 [[X:%.*]], i1 false)
+; CHECK-NEXT: [[RES:%.*]] = select i1 [[C:%.*]], i1 [[ABS]], i1 false
+; CHECK-NEXT: ret i1 false
+;
+ %abs = call i1 @llvm.abs.i1(i1 %x, i1 false)
+ %res = select i1 %c, i1 %abs, i1 false
+ ret i1 %res
+}
More information about the llvm-commits
mailing list