[PATCH] D156865: [tests] precommit tests for D156845

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 00:22:05 PDT 2023


Allen marked an inline comment as done.
Allen added inline comments.


================
Comment at: llvm/test/Transforms/SCCP/and-add-shl.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
+; RUN: opt < %s -passes=ipsccp -S | FileCheck %s
+
----------------
StephenFan wrote:
> Can we replace `ipsccp` with `sccp`? These tests don't touch IPO, right? 
I find they have some different result because we can propagate the value of **llvm.ssa.copy.i8** when we enable the IPO.
```
+++ b/llvm/test/Transforms/SCCP/and-add-shl.ll
@@ -10,9 +10,10 @@ define i8 @and_add_shl(i8 %x) {
 ; CHECK-SAME: (i8 [[X:%.*]]) {
 ; CHECK-NEXT:    [[OP1_P2:%.*]] = icmp ule i8 [[X]], 5
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[OP1_P2]])
-; CHECK-NEXT:    [[SHIFT:%.*]] = shl nuw nsw i8 1, [[X]]
-; CHECK-NEXT:    [[SUB:%.*]] = add nsw i8 [[SHIFT]], -1
-; CHECK-NEXT:    ret i8 0
+; CHECK-NEXT:    [[SHIFT:%.*]] = shl nuw i8 1, [[X]]
+; CHECK-NEXT:    [[SUB:%.*]] = add i8 [[SHIFT]], -1
+; CHECK-NEXT:    [[R:%.*]] = and i8 [[SUB]], 32
+; CHECK-NEXT:    ret i8 [[R]]
 ;
   %op1_p2 = icmp ule i8 %x, 5
   call void @llvm.assume(i1 %op1_p2)
@@ -65,8 +66,8 @@ define i8 @and_add_shl_overlap(i8 %x) {
 ; CHECK-SAME: (i8 [[X:%.*]]) {
 ; CHECK-NEXT:    [[OP1_P2:%.*]] = icmp ule i8 [[X]], 6
 ; CHECK-NEXT:    call void @llvm.assume(i1 [[OP1_P2]])
-; CHECK-NEXT:    [[SHIFT:%.*]] = shl nuw nsw i8 1, [[X]]
-; CHECK-NEXT:    [[SUB:%.*]] = add nsw i8 [[SHIFT]], -1
+; CHECK-NEXT:    [[SHIFT:%.*]] = shl nuw i8 1, [[X]]
+; CHECK-NEXT:    [[SUB:%.*]] = add i8 [[SHIFT]], -1
 ; CHECK-NEXT:    [[R:%.*]] = and i8 [[SUB]], 32
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156865/new/

https://reviews.llvm.org/D156865



More information about the llvm-commits mailing list