[llvm] 0be9940 - [SCEV] Don't check if propagation safe if there are no flags (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 13:27:57 PDT 2021
Author: Nikita Popov
Date: 2021-10-05T22:25:41+02:00
New Revision: 0be9940ef240d04111c7ef7df360c3b4209dfdea
URL: https://github.com/llvm/llvm-project/commit/0be9940ef240d04111c7ef7df360c3b4209dfdea
DIFF: https://github.com/llvm/llvm-project/commit/0be9940ef240d04111c7ef7df360c3b4209dfdea.diff
LOG: [SCEV] Don't check if propagation safe if there are no flags (NFC)
If there are no nowrap flags, then we don't need to determine
whether propagating flags is safe -- it will make no difference.
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index c09180b2c197..6683b1a5205c 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -2802,11 +2802,13 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl<const SCEV *> &Ops,
// Proving that entry to the outer scope neccesitates entry to the inner
// scope, thus proves the program undefined if the flags would be violated
// in the outer scope.
- auto *DefI = getDefiningScopeBound(LIOps);
- auto *ReachI = &*AddRecLoop->getHeader()->begin();
- const bool CanPropagateFlags =
- isGuaranteedToTransferExecutionTo(DefI, ReachI);
- auto AddFlags = CanPropagateFlags ? Flags : SCEV::FlagAnyWrap;
+ SCEV::NoWrapFlags AddFlags = Flags;
+ if (AddFlags != SCEV::FlagAnyWrap) {
+ auto *DefI = getDefiningScopeBound(LIOps);
+ auto *ReachI = &*AddRecLoop->getHeader()->begin();
+ if (!isGuaranteedToTransferExecutionTo(DefI, ReachI))
+ AddFlags = SCEV::FlagAnyWrap;
+ }
AddRecOps[0] = getAddExpr(LIOps, AddFlags, Depth + 1);
// Build the new addrec. Propagate the NUW and NSW flags if both the
More information about the llvm-commits
mailing list