[llvm] 11725b5 - [InstCombine] Add tests for incorrect range handling in ctz fold (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 4 06:48:16 PDT 2024
Author: Nikita Popov
Date: 2024-06-04T15:48:08+02:00
New Revision: 11725b5240840e077c944af6a56e75dd00275395
URL: https://github.com/llvm/llvm-project/commit/11725b5240840e077c944af6a56e75dd00275395
DIFF: https://github.com/llvm/llvm-project/commit/11725b5240840e077c944af6a56e75dd00275395.diff
LOG: [InstCombine] Add tests for incorrect range handling in ctz fold (NFC)
Added:
Modified:
llvm/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll b/llvm/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll
index 3d5f2c209edf3..eac46856bb4b5 100644
--- a/llvm/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll
+++ b/llvm/test/Transforms/InstCombine/select-cmp-cttz-ctlz.ll
@@ -49,6 +49,18 @@ define i16 @test4(i16 %x) {
ret i16 %cond
}
+; FIXME: This is a miscompile.
+define i16 @test4_with_range(i16 %x) {
+; CHECK-LABEL: @test4_with_range(
+; CHECK-NEXT: [[CT:%.*]] = call range(i16 0, 16) i16 @llvm.ctlz.i16(i16 [[X:%.*]], i1 false)
+; CHECK-NEXT: ret i16 [[CT]]
+;
+ %ct = call range(i16 0, 16) i16 @llvm.ctlz.i16(i16 %x, i1 true)
+ %tobool = icmp eq i16 %x, 0
+ %cond = select i1 %tobool, i16 16, i16 %ct
+ ret i16 %cond
+}
+
define i32 @test5(i32 %x) {
; CHECK-LABEL: @test5(
; CHECK-NEXT: [[CT:%.*]] = tail call range(i32 0, 33) i32 @llvm.ctlz.i32(i32 [[X:%.*]], i1 false)
@@ -115,6 +127,18 @@ define i16 @test4b(i16 %x) {
ret i16 %cond
}
+; FIXME: This is a miscompile.
+define i16 @test4b_with_range(i16 %x) {
+; CHECK-LABEL: @test4b_with_range(
+; CHECK-NEXT: [[CT:%.*]] = call range(i16 0, 16) i16 @llvm.cttz.i16(i16 [[X:%.*]], i1 false)
+; CHECK-NEXT: ret i16 [[CT]]
+;
+ %ct = call range(i16 0, 16) i16 @llvm.cttz.i16(i16 %x, i1 true)
+ %tobool = icmp eq i16 %x, 0
+ %cond = select i1 %tobool, i16 16, i16 %ct
+ ret i16 %cond
+}
+
define i32 @test5b(i32 %x) {
; CHECK-LABEL: @test5b(
; CHECK-NEXT: entry:
More information about the llvm-commits
mailing list