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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 10:26:43 PDT 2023


craig.topper updated this revision to Diff 513297.
craig.topper added a comment.

Remove other NUW.


Repository:
  rG LLVM Github Monorepo

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

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,11 +1003,11 @@
           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),
-                                SE->getOne(IntPtr), SCEV::FlagNUW);
+                                SE->getOne(IntPtr));
   }
 
   return TripCountS;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148170.513297.patch
Type: text/x-patch
Size: 1751 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230413/700916b8/attachment.bin>


More information about the llvm-commits mailing list