[llvm] 2db1a42 - [CVP] Add test for invalid use of undef range for saturating insts (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 02:54:41 PST 2023
Author: Nikita Popov
Date: 2023-12-12T11:54:33+01:00
New Revision: 2db1a42184218cad60072d1088498703946bafb9
URL: https://github.com/llvm/llvm-project/commit/2db1a42184218cad60072d1088498703946bafb9
DIFF: https://github.com/llvm/llvm-project/commit/2db1a42184218cad60072d1088498703946bafb9.diff
LOG: [CVP] Add test for invalid use of undef range for saturating insts (NFC)
Added:
Modified:
llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll b/llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll
index 5108af7f4516f8..7424da32e32fd0 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/overflows.ll
@@ -1,12 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes=correlated-propagation < %s | FileCheck %s
-; Check that debug locations are preserved. For more info see:
-; https://llvm.org/docs/SourceLevelDebugging.html#fixing-errors
-; RUN: opt < %s -enable-debugify -passes=correlated-propagation -S 2>&1 | \
-; RUN: FileCheck %s -check-prefix=DEBUG
-; DEBUG: CheckModuleDebugify: PASS
-
declare { i32, i1 } @llvm.sadd.with.overflow.i32(i32, i32)
declare { i32, i1 } @llvm.ssub.with.overflow.i32(i32, i32)
@@ -1155,3 +1149,38 @@ out:
%ret = phi i1 [ true, %entry], [ true, %cont1 ], [ %cmp3, %cont2 ]
ret i1 %ret
}
+
+; FIXME: This is a miscompile.
+define i8 @uadd_sat_undef_range(i8 %x) {
+; CHECK-LABEL: @uadd_sat_undef_range(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: switch i8 [[X:%.*]], label [[JOIN:%.*]] [
+; CHECK-NEXT: i8 1, label [[CASE1:%.*]]
+; CHECK-NEXT: i8 2, label [[CASE2:%.*]]
+; CHECK-NEXT: ]
+; CHECK: case1:
+; CHECK-NEXT: br label [[JOIN]]
+; CHECK: case2:
+; CHECK-NEXT: br label [[JOIN]]
+; CHECK: join:
+; CHECK-NEXT: [[PHI:%.*]] = phi i8 [ 1, [[CASE1]] ], [ 2, [[CASE2]] ], [ undef, [[ENTRY:%.*]] ]
+; CHECK-NEXT: [[RES1:%.*]] = add nuw i8 [[PHI]], 100
+; CHECK-NEXT: ret i8 [[RES1]]
+;
+entry:
+ switch i8 %x, label %join [
+ i8 1, label %case1
+ i8 2, label %case2
+ ]
+
+case1:
+ br label %join
+
+case2:
+ br label %join
+
+join:
+ %phi = phi i8 [ 1, %case1 ], [ 2, %case2 ], [ undef, %entry ]
+ %res = call i8 @llvm.uadd.sat.i8(i8 %phi, i8 100)
+ ret i8 %res
+}
More information about the llvm-commits
mailing list