Re: [llvm] 08016ac - [NFC] Move code between functions as a preparation step for further improvement
David Zarzycki via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 13 06:14:45 PST 2020
Hi Max. I have an auto-bisecting multi-stage cron job that has identified this change as breaking a bunch of tests during during the second stage. Can we revert this or provide a quick fix?
Failed Tests (27):
LLVM-Unit :: ADT/./ADTTests/StringRefTest.Find
Clang :: ARCMT/objcmt-arc-cf-annotations.m
Clang :: Analysis/retain-release.m
Clang :: Driver/arm-features.c
Clang :: Driver/riscv-abi.c
Clang :: Driver/riscv-arch.c
Clang :: Driver/riscv-cpus.c
Clang :: Driver/riscv-gnutools.c
Clang :: Preprocessor/riscv-cmodel.c
Clang :: Preprocessor/riscv-target-features.c
LLVM :: CodeGen/AMDGPU/llvm.amdgcn.wavefrontsize.ll
LLVM :: FileCheck/check-ignore-case.txt
LLVM :: tools/llvm-ar/help-message.test
LLVM :: tools/llvm-ar/invalid-command-line.test
LLVM :: tools/llvm-ar/tool-name.test
LLVM :: tools/llvm-objcopy/ELF/binary-paddr.test
LLVM :: tools/llvm-objcopy/ELF/preserve-segment-contents.test
LLVM :: tools/llvm-objcopy/ELF/strip-all-gnu.test
LLVM :: tools/llvm-ranlib/bad-usage.test
LLVM :: tools/llvm-ranlib/help-message.test
LLVM :: tools/llvm-ranlib/tool-name.test
LLVM :: tools/yaml2obj/Archives/regular.yaml
LLVM :: tools/yaml2obj/ELF/DWARF/debug-gnu-pubnames.yaml
LLVM :: tools/yaml2obj/ELF/DWARF/debug-gnu-pubtypes.yaml
LLVM :: tools/yaml2obj/ELF/custom-fill.yaml
LLVM :: tools/yaml2obj/ELF/override-shsize.yaml
lld :: ELF/oformat-binary.s
On Fri, Nov 13, 2020, at 6:14 AM, Max Kazantsev via llvm-commits wrote:
>
> Author: Max Kazantsev
> Date: 2020-11-13T18:12:45+07:00
> New Revision: 08016ac32b746b27be43d92255bf22a12012e244
>
> URL:
> https://github.com/llvm/llvm-project/commit/08016ac32b746b27be43d92255bf22a12012e244
> DIFF:
> https://github.com/llvm/llvm-project/commit/08016ac32b746b27be43d92255bf22a12012e244.diff
>
> LOG: [NFC] Move code between functions as a preparation step for
> further improvement
>
> Added:
>
>
> Modified:
> llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
>
> Removed:
>
>
>
> ################################################################################
> diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
> b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
> index cc8a9976c303..55993c0a1513 100644
> --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
> +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
> @@ -1303,41 +1303,17 @@ enum ExitCondAnalysisResult {
> /// output parameters and return CanBeReplacedWithInvariant.
> /// Otherwise, return CannotOptimize.
> static ExitCondAnalysisResult
> -analyzeCond(const Loop *L, BranchInst *BI, ScalarEvolution *SE,
> - bool ProvingLoopExit, const SCEV *MaxIter,
> - ICmpInst::Predicate &InvariantPred, const SCEV
> *&InvariantLHS,
> - const SCEV *&InvariantRHS) {
> - ICmpInst::Predicate Pred;
> - Value *LHS, *RHS;
> - using namespace PatternMatch;
> - BasicBlock *TrueSucc, *FalseSucc;
> - if (!match(BI, m_Br(m_ICmp(Pred, m_Value(LHS), m_Value(RHS)),
> - m_BasicBlock(TrueSucc),
> m_BasicBlock(FalseSucc))))
> - return CannotOptimize;
> -
> - assert((L->contains(TrueSucc) != L->contains(FalseSucc)) &&
> - "Not a loop exit!");
> -
> - // 'LHS pred RHS' should now mean that we stay in loop.
> - if (L->contains(FalseSucc))
> - Pred = CmpInst::getInversePredicate(Pred);
> -
> - // If we are proving loop exit, invert the predicate.
> - if (ProvingLoopExit)
> - Pred = CmpInst::getInversePredicate(Pred);
> -
> - const SCEV *LHSS = SE->getSCEVAtScope(LHS, L);
> - const SCEV *RHSS = SE->getSCEVAtScope(RHS, L);
> +analyzeCond(const Loop *L, ICmpInst::Predicate Pred, const SCEV *LHSS,
> + const SCEV *RHSS, BranchInst *Context, ScalarEvolution *SE,
> + const SCEV *MaxIter, ICmpInst::Predicate &InvariantPred,
> + const SCEV *&InvariantLHS, const SCEV *&InvariantRHS) {
> // Can we prove it to be trivially true?
> - if (SE->isKnownPredicateAt(Pred, LHSS, RHSS, BI))
> + if (SE->isKnownPredicateAt(Pred, LHSS, RHSS, Context))
> return CanBeRemoved;
>
> - if (ProvingLoopExit)
> - return CannotOptimize;
> -
> // Check if there is a loop-invariant predicate equivalent to our
> check.
> - auto LIP = SE->getLoopInvariantExitCondDuringFirstIterations(Pred,
> LHSS, RHSS,
> - L, BI,
> MaxIter);
> + auto LIP = SE->getLoopInvariantExitCondDuringFirstIterations(
> + Pred, LHSS, RHSS, L, Context, MaxIter);
> if (!LIP)
> return CannotOptimize;
> InvariantPred = LIP->Pred;
> @@ -1345,7 +1321,8 @@ analyzeCond(const Loop *L, BranchInst *BI,
> ScalarEvolution *SE,
> InvariantRHS = LIP->RHS;
>
> // Can we prove it to be trivially true?
> - if (SE->isKnownPredicateAt(InvariantPred, InvariantLHS,
> InvariantRHS, BI))
> + if (SE->isKnownPredicateAt(InvariantPred, InvariantLHS, InvariantRHS,
> + Context))
> return CanBeRemoved;
> return CanBeReplacedWithInvariant;
> }
> @@ -1390,14 +1367,36 @@ static bool
> optimizeLoopExitWithUnknownExitCount(
> const SCEV *MaxIter, bool Inverted, bool SkipLastIter,
> ScalarEvolution *SE, SCEVExpander &Rewriter,
> SmallVectorImpl<WeakTrackingVH> &DeadInsts) {
> + ICmpInst::Predicate Pred;
> + Value *LHS, *RHS;
> + using namespace PatternMatch;
> + BasicBlock *TrueSucc, *FalseSucc;
> + if (!match(BI, m_Br(m_ICmp(Pred, m_Value(LHS), m_Value(RHS)),
> + m_BasicBlock(TrueSucc),
> m_BasicBlock(FalseSucc))))
> + return false;
> +
> + assert((L->contains(TrueSucc) != L->contains(FalseSucc)) &&
> + "Not a loop exit!");
> +
> + // 'LHS pred RHS' should now mean that we stay in loop.
> + if (L->contains(FalseSucc))
> + Pred = CmpInst::getInversePredicate(Pred);
> +
> + // If we are proving loop exit, invert the predicate.
> + if (Inverted)
> + Pred = CmpInst::getInversePredicate(Pred);
> +
> + const SCEV *LHSS = SE->getSCEVAtScope(LHS, L);
> + const SCEV *RHSS = SE->getSCEVAtScope(RHS, L);
> +
> if (SkipLastIter) {
> const SCEV *One = SE->getOne(MaxIter->getType());
> MaxIter = SE->getMinusSCEV(MaxIter, One);
> }
> ICmpInst::Predicate InvariantPred;
> const SCEV *InvariantLHS, *InvariantRHS;
> - switch (analyzeCond(L, BI, SE, Inverted, MaxIter, InvariantPred,
> InvariantLHS,
> - InvariantRHS)) {
> + switch (analyzeCond(L, Pred, LHSS, RHSS, BI, SE, MaxIter,
> InvariantPred,
> + InvariantLHS, InvariantRHS)) {
> case CanBeRemoved:
> foldExit(L, ExitingBB, Inverted, DeadInsts);
> return true;
>
>
>
> _______________________________________________
> 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