[llvm] 0be9940 - [SCEV] Don't check if propagation safe if there are no flags (NFC)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 5 14:40:20 PDT 2021
Good idea, thanks.
Philip
On 10/5/21 1:27 PM, Nikita Popov via llvm-commits wrote:
> 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
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list