[PATCH] D145929: [LSR]: Fold terminating condition not only for eq and ne.
EverRest via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 13 23:14:49 PDT 2023
MarkGoncharovAl updated this revision to Diff 504948.
MarkGoncharovAl added a comment.
Fix lit-test.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145929/new/
https://reviews.llvm.org/D145929
Files:
llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold.ll
Index: llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold.ll
===================================================================
--- llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold.ll
+++ llvm/test/Transforms/LoopStrengthReduce/lsr-term-fold.ll
@@ -178,26 +178,26 @@
define void @IcmpSle(ptr %a) {
; CHECK-LABEL: @IcmpSle(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[START:%.*]] = getelementptr i8, ptr %a, i64 84
-; CHECK-NEXT: [[END:%.*]] = getelementptr i8, ptr %a, i64 1600
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
+; CHECK-NEXT: [[START:%.*]] = getelementptr i8, ptr %a, i32 84
+; CHECK-NEXT: [[END:%.*]] = getelementptr i8, ptr %a, i32 1600
+; CHECK-NEXT: br label %[[FOR_BODY:.*]]
; CHECK: [[FOR_BODY]]:
-; CHECK-NEXT: [[LSR_IV:%.*]] = phi ptr [ [[LSR_IV_NEXT:%.*]], [[FOR_BODY]] ], [ [[START]], %entry ]
-; CHECK-NEXT: [[STORE:%.*]] = store i32 1, ptr %[[LSR_IV]], align 4
-; CHECK-NEXT: [[LSR_IV_NEXT]] = getelementptr i8, ptr [[LSR_IV]], i64 4
+; CHECK-NEXT: [[LSR_IV:%.*]] = phi ptr [ [[LSR_IV_NEXT:%.*]], %[[FOR_BODY]] ], [ [[START]], %entry ]
+; CHECK-NEXT: store i32 1, ptr [[LSR_IV]], align 4
+; CHECK-NEXT: [[LSR_IV_NEXT]] = getelementptr i8, ptr [[LSR_IV]], i32 4
; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[LSR_IV_NEXT]], [[END]]
-; CHECK-NEXT: br i1 [[CMP]], label [[BR_END:%.*]], label [[FOR_BODY]]
+; CHECK-NEXT: br i1 [[CMP]], label [[BR_END:%.*]], label %[[FOR_BODY]]
entry:
- %uglygep = getelementptr i8, ptr %a, i64 84
+ %uglygep = getelementptr i8, ptr %a, i32 84
br label %for.body
for.body: ; preds = %for.body, %entry
%lsr.iv1 = phi ptr [ %uglygep2, %for.body ], [ %uglygep, %entry ]
- %lsr.iv = phi i64 [ %lsr.iv.next, %for.body ], [ 379, %entry ]
+ %lsr.iv = phi i32 [ %lsr.iv.next, %for.body ], [ 379, %entry ]
store i32 1, ptr %lsr.iv1, align 4
- %lsr.iv.next = add nsw i64 %lsr.iv, -1
- %uglygep2 = getelementptr i8, ptr %lsr.iv1, i64 4
- %exitcond.not = icmp sle i64 %lsr.iv.next, 0
+ %lsr.iv.next = add nsw i32 %lsr.iv, -1
+ %uglygep2 = getelementptr i8, ptr %lsr.iv1, i32 4
+ %exitcond.not = icmp sle i32 %lsr.iv.next, 0
br i1 %exitcond.not, label %for.end, label %for.body
for.end: ; preds = %for.body
@@ -208,26 +208,26 @@
define void @IcmpSlt(ptr %a) {
; CHECK-LABEL: @IcmpSlt(
; CHECK-NEXT: entry:
-; CHECK-NEXT: [[START:%.*]] = getelementptr i8, ptr %a, i64 84
-; CHECK-NEXT: [[END:%.*]] = getelementptr i8, ptr %a, i64 1604
-; CHECK-NEXT: br label [[FOR_BODY:%.*]]
+; CHECK-NEXT: [[START:%.*]] = getelementptr i8, ptr %a, i32 84
+; CHECK-NEXT: [[END:%.*]] = getelementptr i8, ptr %a, i32 1604
+; CHECK-NEXT: br label %[[FOR_BODY:.*]]
; CHECK: [[FOR_BODY]]:
-; CHECK-NEXT: [[LSR_IV:%.*]] = phi ptr [ [[LSR_IV_NEXT:%.*]], [[FOR_BODY]] ], [ [[START]], %entry ]
-; CHECK-NEXT: [[STORE:%.*]] = store i32 1, ptr %[[LSR_IV]], align 4
-; CHECK-NEXT: [[LSR_IV_NEXT]] = getelementptr i8, ptr [[LSR_IV]], i64 4
+; CHECK-NEXT: [[LSR_IV:%.*]] = phi ptr [ [[LSR_IV_NEXT:%.*]], %[[FOR_BODY]] ], [ [[START]], %entry ]
+; CHECK-NEXT: store i32 1, ptr [[LSR_IV]], align 4
+; CHECK-NEXT: [[LSR_IV_NEXT]] = getelementptr i8, ptr [[LSR_IV]], i32 4
; CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr [[LSR_IV_NEXT]], [[END]]
-; CHECK-NEXT: br i1 [[CMP]], label [[BR_END:%.*]], label [[FOR_BODY]]
+; CHECK-NEXT: br i1 [[CMP]], label [[BR_END:%.*]], label %[[FOR_BODY]]
entry:
- %uglygep = getelementptr i8, ptr %a, i64 84
+ %uglygep = getelementptr i8, ptr %a, i32 84
br label %for.body
for.body: ; preds = %for.body, %entry
%lsr.iv1 = phi ptr [ %uglygep2, %for.body ], [ %uglygep, %entry ]
- %lsr.iv = phi i64 [ %lsr.iv.next, %for.body ], [ 379, %entry ]
+ %lsr.iv = phi i32 [ %lsr.iv.next, %for.body ], [ 379, %entry ]
store i32 1, ptr %lsr.iv1, align 4
- %lsr.iv.next = add nsw i64 %lsr.iv, -1
- %uglygep2 = getelementptr i8, ptr %lsr.iv1, i64 4
- %exitcond.not = icmp slt i64 %lsr.iv.next, 0
+ %lsr.iv.next = add nsw i32 %lsr.iv, -1
+ %uglygep2 = getelementptr i8, ptr %lsr.iv1, i32 4
+ %exitcond.not = icmp slt i32 %lsr.iv.next, 0
br i1 %exitcond.not, label %for.end, label %for.body
for.end: ; preds = %for.body
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145929.504948.patch
Type: text/x-patch
Size: 4366 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230314/755f49ae/attachment.bin>
More information about the llvm-commits
mailing list