[PATCH] D148170: [LoopIdiomRecognize] Remove NUW flag from SCEV in getTripCount.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 13:55:15 PDT 2023


craig.topper created this revision.
craig.topper added reviewers: reames, nikic.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.

Based on the conversation in D147355 <https://reviews.llvm.org/D147355>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148170

Files:
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll


Index: llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll
===================================================================
--- llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll
+++ llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll
@@ -196,9 +196,9 @@
 ; CHECK-NEXT:    [[I:%.*]] = icmp sgt i32 [[ARG2:%.*]], -1
 ; CHECK-NEXT:    br i1 [[I]], label [[BB3:%.*]], label [[BB5:%.*]]
 ; CHECK:       bb3:
-; CHECK-NEXT:    [[TMP0:%.*]] = zext i32 [[ARG2]] to i64
-; CHECK-NEXT:    [[TMP1:%.*]] = mul nuw nsw i64 [[TMP0]], 12
-; CHECK-NEXT:    [[TMP2:%.*]] = add nuw nsw i64 [[TMP1]], 12
+; CHECK-NEXT:    [[TMP0:%.*]] = add i32 [[ARG2]], 1
+; CHECK-NEXT:    [[TMP1:%.*]] = zext i32 [[TMP0]] to i64
+; CHECK-NEXT:    [[TMP2:%.*]] = mul nuw nsw i64 [[TMP1]], 12
 ; CHECK-NEXT:    call void @llvm.memcpy.p0.p0.i64(ptr align 4 [[ARG:%.*]], ptr align 4 [[ARG1:%.*]], i64 [[TMP2]], i1 false)
 ; CHECK-NEXT:    br label [[BB6:%.*]]
 ; CHECK:       bb4:
Index: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -1003,7 +1003,7 @@
           CurLoop, ICmpInst::ICMP_NE, BECount,
           SE->getMinusOne(BECount->getType()))) {
     TripCountS = SE->getZeroExtendExpr(
-        SE->getAddExpr(BECount, SE->getOne(BECount->getType()), SCEV::FlagNUW),
+        SE->getAddExpr(BECount, SE->getOne(BECount->getType())),
         IntPtr);
   } else {
     TripCountS = SE->getAddExpr(SE->getTruncateOrZeroExtend(BECount, IntPtr),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148170.512964.patch
Type: text/x-patch
Size: 1597 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230412/1369c3de/attachment.bin>


More information about the llvm-commits mailing list