This is an archive of the discontinued LLVM Phabricator instance.

[tests] precommit tests for D156845
ClosedPublic

Authored by Allen on Aug 2 2023, 1:56 AM.

Diff Detail

Event Timeline

Allen created this revision.Aug 2 2023, 1:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 1:56 AM
Allen requested review of this revision.Aug 2 2023, 1:56 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 2 2023, 1:56 AM
arsenm added inline comments.Aug 10 2023, 2:54 PM
llvm/test/Transforms/FunctionSpecialization/and-add-shl.ll
2 ↗(On Diff #546360)

Seems like a strange move? I'd expect a new patch to only add a test to the relevant pass, not delete one from another

Allen updated this revision to Diff 549225.Aug 10 2023, 7:01 PM

revert the change of deleting one from another

Allen marked an inline comment as done.Aug 10 2023, 7:02 PM
Allen added inline comments.
llvm/test/Transforms/FunctionSpecialization/and-add-shl.ll
2 ↗(On Diff #546360)

Apply your comment, thanks

Allen updated this revision to Diff 549573.Aug 11 2023, 10:00 PM
Allen marked an inline comment as done.

1、 replace the test file under llvm/test/Transforms/SCCP
2、 Add a new negative case and_not_shl_overlap

arsenm accepted this revision.Aug 23 2023, 5:03 PM
This revision is now accepted and ready to land.Aug 23 2023, 5:03 PM
StephenFan added inline comments.Aug 23 2023, 9:30 PM
llvm/test/Transforms/SCCP/and-add-shl.ll
3

Can we replace ipsccp with sccp? These tests don't touch IPO, right?

Allen marked an inline comment as done.Aug 24 2023, 12:22 AM
Allen added inline comments.
llvm/test/Transforms/SCCP/and-add-shl.ll
3

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
This revision was automatically updated to reflect the committed changes.
Allen marked an inline comment as done.