[llvm] 8bba57b - [LoopIdiomRecognize] Remove NUW flag from SCEV in getTripCount.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 13 11:58:26 PDT 2023
Author: Craig Topper
Date: 2023-04-13T11:58:10-07:00
New Revision: 8bba57b1f12e9e4bc4800f632ab544456ba500f3
URL: https://github.com/llvm/llvm-project/commit/8bba57b1f12e9e4bc4800f632ab544456ba500f3
DIFF: https://github.com/llvm/llvm-project/commit/8bba57b1f12e9e4bc4800f632ab544456ba500f3.diff
LOG: [LoopIdiomRecognize] Remove NUW flag from SCEV in getTripCount.
Based on the conversation in D147355.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D148170
Added:
Modified:
llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
index 3e7d33a44c6b6..b4c2baf380282 100644
--- a/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
@@ -1003,11 +1003,11 @@ static const SCEV *getTripCount(const SCEV *BECount, Type *IntPtr,
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;
diff --git a/llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll b/llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll
index fb56e61509635..85561da0ffee7 100644
--- a/llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll
+++ b/llvm/test/Transforms/LoopIdiom/memcpy-intrinsic.ll
@@ -196,9 +196,9 @@ define dso_local i32 @copy_noalias_negative_stride(ptr noalias nocapture %arg, p
; 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:
More information about the llvm-commits
mailing list