[PATCH] D126354: [GuardWidening] Remove nuw/nsw flags for hoisted instructions
Serguei Katkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 25 23:32:06 PDT 2022
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc2eccc67ce07: [GuardWidening] Remove nuw/nsw flags for hoisted instructions (authored by skatkov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126354/new/
https://reviews.llvm.org/D126354
Files:
llvm/lib/Transforms/Scalar/GuardWidening.cpp
llvm/test/Transforms/GuardWidening/range-check-merging.ll
Index: llvm/test/Transforms/GuardWidening/range-check-merging.ll
===================================================================
--- llvm/test/Transforms/GuardWidening/range-check-merging.ll
+++ llvm/test/Transforms/GuardWidening/range-check-merging.ll
@@ -340,7 +340,7 @@
; CHECK-NEXT: entry:
; CHECK-NEXT: [[LENGTH:%.*]] = load i32, i32* [[LENGTH_BUF:%.*]], align 4, !range [[RNG0]]
; CHECK-NEXT: [[CHK0:%.*]] = icmp ult i32 [[X:%.*]], [[LENGTH]]
-; CHECK-NEXT: [[X_INC1:%.*]] = add nuw nsw i32 [[X]], 1
+; CHECK-NEXT: [[X_INC1:%.*]] = add i32 [[X]], 1
; CHECK-NEXT: [[CHK1:%.*]] = icmp ult i32 [[X_INC1]], [[LENGTH]]
; CHECK-NEXT: [[WIDE_CHK:%.*]] = and i1 [[CHK0]], [[CHK1]]
; CHECK-NEXT: call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
Index: llvm/lib/Transforms/Scalar/GuardWidening.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/GuardWidening.cpp
+++ llvm/lib/Transforms/Scalar/GuardWidening.cpp
@@ -495,6 +495,9 @@
makeAvailableAt(Op, Loc);
Inst->moveBefore(Loc);
+ // If we moved instruction before guard we must clean nuw, nsw flags.
+ Inst->setHasNoUnsignedWrap(false);
+ Inst->setHasNoSignedWrap(false);
}
bool GuardWideningImpl::widenCondCommon(Value *Cond0, Value *Cond1,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126354.432200.patch
Type: text/x-patch
Size: 1319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220526/37be762e/attachment.bin>
More information about the llvm-commits
mailing list