[llvm] r335183 - Generalize MergeBlockIntoPredecessor. Replace uses of MergeBasicBlockIntoOnlyPred.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 8 09:55:49 PDT 2018
Thank you, Maxim!
Sent out https://reviews.llvm.org/D50422.
On Tue, Aug 7, 2018 at 7:25 PM Maxim Kazantsev <max.kazantsev at azul.com>
wrote:
> Hi Alina,
>
>
>
> We've faced a bunch of similar issues before, and I believe that this can
> be just one another example. The story is following: after we've improved
> calculation of exact backedge taken count for loops, the algorithm started
> considering exiting blocks of inner loops in calculation of exit count of
> outer loops, which did not happen before because of old algorithm's
> limitation. Therefore, whenever we make changes to exiting blocks of inner
> loops or their exit conditions, we also may need to update all loops that
> contain it.
>
>
>
> I believe that the function you need is "forgetTopmostLoop". We've fixed
> it in many passes, but apparently still not in all of them. Try calling it
> instead of forgetLoop, it should help your example. I will gladly review
> the fix patch.
>
>
>
> Thanks,
>
> Max
>
>
>
> *From:* Alina Sbirlea [mailto:asbirlea at google.com]
> *Sent:* Wednesday, August 8, 2018 5:00 AM
> *To:* mikael.holmen at ericsson.com; Maxim Kazantsev <max.kazantsev at azul.com>
> *Cc:* llvm-commits <llvm-commits at lists.llvm.org>
> *Subject:* Re: [llvm] r335183 - Generalize MergeBlockIntoPredecessor.
> Replace uses of MergeBasicBlockIntoOnlyPred.
>
>
>
> FWIW, the assertion is no longer triggered with invalidating the parent
> loop in ScEv in this particular case.
>
> I'm not clear of the larger scope yet though, e.g. how loop nesting can
> change in general; and, does this require updating LoopInfo too?
>
>
>
> *diff --git a/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
> b/lib/Transforms/Scalar/LoopSimplifyCFG.cpp*
>
> *index 3f31d8efeb4..dd36468696a 100644*
>
> *--- a/lib/Transforms/Scalar/LoopSimplifyCFG.cpp*
>
> *+++ b/lib/Transforms/Scalar/LoopSimplifyCFG.cpp*
>
> @@ -62,6 +62,7 @@ static bool simplifyLoopCFG(Loop &L, DominatorTree &DT,
> LoopInfo &LI,
>
> MergeBlockIntoPredecessor(Succ, &DTU, &LI);
>
>
>
> SE.forgetLoop(&L);
>
> + SE.forgetLoop(L.getParentLoop());
>
> Changed = true;
>
> }
>
>
>
>
>
> On Tue, Aug 7, 2018 at 2:30 PM Alina Sbirlea <asbirlea at google.com> wrote:
>
> This looks like an issue in ScEv, looking into it.
>
>
>
> +CC Maxim Kazantsev who may have more background than me and faster
> turn-around.
>
>
>
> On Tue, Aug 7, 2018 at 6:49 AM Mikael Holmén <mikael.holmen at ericsson.com>
> wrote:
>
> Hi Alina,
>
> I've found a case that hits an assertion with your commit. If I do
>
> opt -S -o - bbi-16360.ll -loop-idiom -verify -loop-simplifycfg
> -loop-idiom
>
> I get
>
> opt: ../include/llvm/IR/ValueHandle.h:494: ValueTy
> *llvm::PoisoningVH<llvm::BasicBlock>::getValPtr() const [ValueTy =
> llvm::BasicBlock]: Assertion `!Poisoned && "Accessed a poisoned value
> handle!"' failed.
> Stack dump:
> 0. Program arguments: /data/repo/llvm-patch/build-all/bin/opt -S -o
> - bbi-16360.ll -loop-idiom -verify -loop-simplifycfg -loop-idiom
> 1. Running pass 'Function Pass Manager' on module 'bbi-16360.ll'.
> 2. Running pass 'Loop Pass Manager' on function '@f1'
> 3. Running pass 'Recognize loop idioms' on basic block '%lbl1'
> #0 0x0000000002085c94 PrintStackTraceSignalHandler(void*)
> (/data/repo/llvm-patch/build-all/bin/opt+0x2085c94)
> #1 0x0000000002083df0 llvm::sys::RunSignalHandlers()
> (/data/repo/llvm-patch/build-all/bin/opt+0x2083df0)
> #2 0x0000000002085ff8 SignalHandler(int)
> (/data/repo/llvm-patch/build-all/bin/opt+0x2085ff8)
> #3 0x00007f47ba77a330 __restore_rt
> (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
> #4 0x00007f47b9369c37 gsignal
>
> /build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
> #5 0x00007f47b936d028 abort
> /build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
> #6 0x00007f47b9362bf6 __assert_fail_base
> /build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
> #7 0x00007f47b9362ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
> #8 0x000000000160feca
> llvm::ScalarEvolution::BackedgeTakenInfo::getExact(llvm::Loop const*,
> llvm::ScalarEvolution*, llvm::SCEVUnionPredicate*) const
> (/data/repo/llvm-patch/build-all/bin/opt+0x160feca)
> #9 0x000000000162a69f
> llvm::ScalarEvolution::hasLoopInvariantBackedgeTakenCount(llvm::Loop
> const*) (/data/repo/llvm-patch/build-all/bin/opt+0x162a69f)
> #10 0x0000000001eb153e (anonymous
> namespace)::LoopIdiomRecognize::runOnLoop(llvm::Loop*)
> (/data/repo/llvm-patch/build-all/bin/opt+0x1eb153e)
> #11 0x0000000001eba15b (anonymous
> namespace)::LoopIdiomRecognizeLegacyPass::runOnLoop(llvm::Loop*,
> llvm::LPPassManager&) (/data/repo/llvm-patch/build-all/bin/opt+0x1eba15b)
> #12 0x0000000001590e64
> llvm::LPPassManager::runOnFunction(llvm::Function&)
> (/data/repo/llvm-patch/build-all/bin/opt+0x1590e64)
> #13 0x0000000001af7273
> llvm::FPPassManager::runOnFunction(llvm::Function&)
> (/data/repo/llvm-patch/build-all/bin/opt+0x1af7273)
> #14 0x0000000001af7488 llvm::FPPassManager::runOnModule(llvm::Module&)
> (/data/repo/llvm-patch/build-all/bin/opt+0x1af7488)
> #15 0x0000000001af793a llvm::legacy::PassManagerImpl::run(llvm::Module&)
> (/data/repo/llvm-patch/build-all/bin/opt+0x1af793a)
> #16 0x0000000000754e44 main
> (/data/repo/llvm-patch/build-all/bin/opt+0x754e44)
> #17 0x00007f47b9354f45 __libc_start_main
> /build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
> #18 0x000000000073d58d _start
> (/data/repo/llvm-patch/build-all/bin/opt+0x73d58d)
> Abort
>
> It starts crashing with your commit and it still crashes on trunk today.
>
> Regards,
> Mikael
>
> On 06/21/2018 12:01 AM, Alina Sbirlea via llvm-commits wrote:
> > Author: asbirlea
> > Date: Wed Jun 20 15:01:04 2018
> > New Revision: 335183
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=335183&view=rev
> > Log:
> > Generalize MergeBlockIntoPredecessor. Replace uses of
> MergeBasicBlockIntoOnlyPred.
> >
> > Summary:
> > Two utils methods have essentially the same functionality. This is an
> attempt to merge them into one.
> > 1. lib/Transforms/Utils/Local.cpp : MergeBasicBlockIntoOnlyPred
> > 2. lib/Transforms/Utils/BasicBlockUtils.cpp : MergeBlockIntoPredecessor
> >
> > Prior to the patch:
> > 1. MergeBasicBlockIntoOnlyPred
> > Updates either DomTree or DeferredDominance
> > Moves all instructions from Pred to BB, deletes Pred
> > Asserts BB has single predecessor
> > If address was taken, replace the block address with constant 1 (?)
> >
> > 2. MergeBlockIntoPredecessor
> > Updates DomTree, LoopInfo and MemoryDependenceResults
> > Moves all instruction from BB to Pred, deletes BB
> > Returns if doesn't have a single predecessor
> > Returns if BB's address was taken
> >
> > After the patch:
> > Method 2. MergeBlockIntoPredecessor is attempting to become the new
> default:
> > Updates DomTree or DeferredDominance, and LoopInfo and
> MemoryDependenceResults
> > Moves all instruction from BB to Pred, deletes BB
> > Returns if doesn't have a single predecessor
> > Returns if BB's address was taken
> >
> > Uses of MergeBasicBlockIntoOnlyPred that need to be replaced:
> >
> > 1. lib/Transforms/Scalar/LoopSimplifyCFG.cpp
> > Updated in this patch. No challenges.
> >
> > 2. lib/CodeGen/CodeGenPrepare.cpp
> > Updated in this patch.
> > i. eliminateFallThrough is straightforward, but I added using a
> temporary array to avoid the iterator invalidation.
> > ii. eliminateMostlyEmptyBlock(s) methods also now use a temporary
> array for blocks
> > Some interesting aspects:
> > - Since Pred is not deleted (BB is), the entry block does not need
> updating.
> > - The entry block was being updated with the deleted block in
> eliminateMostlyEmptyBlock. Added assert to make obvious that BB=SinglePred.
> > - isMergingEmptyBlockProfitable assumes BB is the one to be deleted.
> > - eliminateMostlyEmptyBlock(BB) does not delete BB on one path, it
> deletes its unique predecessor instead.
> > - adding some test owner as subscribers for the interesting tests
> modified:
> > test/CodeGen/X86/avx-cmp.ll
> > test/CodeGen/AMDGPU/nested-loop-conditions.ll
> > test/CodeGen/AMDGPU/si-annotate-cf.ll
> > test/CodeGen/X86/hoist-spill.ll
> > test/CodeGen/X86/2006-11-17-IllegalMove.ll
> >
> > 3. lib/Transforms/Scalar/JumpThreading.cpp
> > Not covered in this patch. It is the only use case using the
> DeferredDominance.
> > I would defer to Brian Rzycki to make this replacement.
> >
> > Reviewers: chandlerc, spatel, davide, brzycki, bkramer, javed.absar
> >
> > Subscribers: qcolombet, sanjoy, nemanjai, nhaehnle, jlebar, tpr,
> kbarton, RKSimon, wmi, arsenm, llvm-commits
> >
> > Differential Revision: https://reviews.llvm.org/D48202
> >
> > Modified:
> > llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
> > llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
> > llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
> > llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
> > llvm/trunk/test/CodeGen/AMDGPU/branch-relaxation.ll
> > llvm/trunk/test/CodeGen/AMDGPU/nested-loop-conditions.ll
> > llvm/trunk/test/CodeGen/AMDGPU/si-annotate-cf.ll
> > llvm/trunk/test/CodeGen/ARM/indirectbr.ll
> >
> llvm/trunk/test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll
> > llvm/trunk/test/CodeGen/PowerPC/memcmp-mergeexpand.ll
> > llvm/trunk/test/CodeGen/PowerPC/ppc-shrink-wrapping.ll
> > llvm/trunk/test/CodeGen/PowerPC/simplifyConstCmpToISEL.ll
> > llvm/trunk/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll
> > llvm/trunk/test/CodeGen/Thumb2/thumb2-jtb.ll
> > llvm/trunk/test/CodeGen/X86/2006-11-17-IllegalMove.ll
> > llvm/trunk/test/CodeGen/X86/avx-cmp.ll
> > llvm/trunk/test/CodeGen/X86/avx-splat.ll
> > llvm/trunk/test/CodeGen/X86/avx2-vbroadcast.ll
> > llvm/trunk/test/CodeGen/X86/avx512-i1test.ll
> > llvm/trunk/test/CodeGen/X86/block-placement.ll
> > llvm/trunk/test/CodeGen/X86/hoist-spill.ll
> > llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-1.ll
> > llvm/trunk/test/CodeGen/X86/memcmp-mergeexpand.ll
> > llvm/trunk/test/CodeGen/X86/pr32108.ll
> > llvm/trunk/test/CodeGen/X86/setcc-lowering.ll
> > llvm/trunk/test/CodeGen/X86/split-store.ll
> > llvm/trunk/test/CodeGen/X86/tail-dup-merge-loop-headers.ll
> > llvm/trunk/test/DebugInfo/Generic/sunk-compare.ll
> > llvm/trunk/test/Transforms/CodeGenPrepare/X86/computedgoto.ll
> > llvm/trunk/test/Transforms/CodeGenPrepare/basic.ll
> > llvm/trunk/test/Transforms/LoopSimplifyCFG/scev.ll
> >
> llvm/trunk/test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll
> >
> llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll
> >
> llvm/trunk/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-iteration.ll
> >
> > Modified: llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h (original)
> > +++ llvm/trunk/include/llvm/Transforms/Utils/BasicBlockUtils.h Wed Jun
> 20 15:01:04 2018
> > @@ -58,7 +58,8 @@ bool DeleteDeadPHIs(BasicBlock *BB, cons
> > /// value indicates success or failure.
> > bool MergeBlockIntoPredecessor(BasicBlock *BB, DominatorTree *DT =
> nullptr,
> > LoopInfo *LI = nullptr,
> > - MemoryDependenceResults *MemDep =
> nullptr);
> > + MemoryDependenceResults *MemDep =
> nullptr,
> > + DeferredDominance *DDT = nullptr);
> >
> > /// Replace all uses of an instruction (specified by BI) with a value,
> then
> > /// remove and delete the original instruction.
> >
> > Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
> > +++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Wed Jun 20 15:01:04 2018
> > @@ -516,8 +516,16 @@ bool CodeGenPrepare::runOnFunction(Funct
> > bool CodeGenPrepare::eliminateFallThrough(Function &F) {
> > bool Changed = false;
> > // Scan all of the blocks in the function, except for the entry
> block.
> > - for (Function::iterator I = std::next(F.begin()), E = F.end(); I !=
> E;) {
> > - BasicBlock *BB = &*I++;
> > + // Use a temporary array to avoid iterator being invalidated when
> > + // deleting blocks.
> > + SmallVector<WeakTrackingVH, 16> Blocks;
> > + for (auto &Block : llvm::make_range(std::next(F.begin()), F.end()))
> > + Blocks.push_back(&Block);
> > +
> > + for (auto &Block : Blocks) {
> > + auto *BB = cast_or_null<BasicBlock>(Block);
> > + if (!BB)
> > + continue;
> > // If the destination block has a single pred, then this is a
> trivial
> > // edge, just collapse it.
> > BasicBlock *SinglePred = BB->getSinglePredecessor();
> > @@ -528,17 +536,10 @@ bool CodeGenPrepare::eliminateFallThroug
> > BranchInst *Term =
> dyn_cast<BranchInst>(SinglePred->getTerminator());
> > if (Term && !Term->isConditional()) {
> > Changed = true;
> > - LLVM_DEBUG(dbgs() << "To merge:\n" << *SinglePred << "\n\n\n");
> > - // Remember if SinglePred was the entry block of the function.
> > - // If so, we will need to move BB back to the entry position.
> > - bool isEntry = SinglePred ==
> &SinglePred->getParent()->getEntryBlock();
> > - MergeBasicBlockIntoOnlyPred(BB, nullptr);
> > -
> > - if (isEntry && BB != &BB->getParent()->getEntryBlock())
> > - BB->moveBefore(&BB->getParent()->getEntryBlock());
> > + LLVM_DEBUG(dbgs() << "To merge:\n" << *BB << "\n\n\n");
> >
> > - // We have erased a block. Update the iterator.
> > - I = BB->getIterator();
> > + // Merge BB into SinglePred and delete it.
> > + MergeBlockIntoPredecessor(BB);
> > }
> > }
> > return Changed;
> > @@ -591,9 +592,17 @@ bool CodeGenPrepare::eliminateMostlyEmpt
> > }
> >
> > bool MadeChange = false;
> > + // Copy blocks into a temporary array to avoid iterator invalidation
> issues
> > + // as we remove them.
> > // Note that this intentionally skips the entry block.
> > - for (Function::iterator I = std::next(F.begin()), E = F.end(); I !=
> E;) {
> > - BasicBlock *BB = &*I++;
> > + SmallVector<WeakTrackingVH, 16> Blocks;
> > + for (auto &Block : llvm::make_range(std::next(F.begin()), F.end()))
> > + Blocks.push_back(&Block);
> > +
> > + for (auto &Block : Blocks) {
> > + BasicBlock *BB = cast_or_null<BasicBlock>(Block);
> > + if (!BB)
> > + continue;
> > BasicBlock *DestBB = findDestBlockOfMergeableEmptyBlock(BB);
> > if (!DestBB ||
> > !isMergingEmptyBlockProfitable(BB, DestBB,
> Preheaders.count(BB)))
> > @@ -762,15 +771,13 @@ void CodeGenPrepare::eliminateMostlyEmpt
> > // just collapse it.
> > if (BasicBlock *SinglePred = DestBB->getSinglePredecessor()) {
> > if (SinglePred != DestBB) {
> > - // Remember if SinglePred was the entry block of the function.
> If so, we
> > - // will need to move BB back to the entry position.
> > - bool isEntry = SinglePred ==
> &SinglePred->getParent()->getEntryBlock();
> > - MergeBasicBlockIntoOnlyPred(DestBB, nullptr);
> > -
> > - if (isEntry && BB != &BB->getParent()->getEntryBlock())
> > - BB->moveBefore(&BB->getParent()->getEntryBlock());
> > -
> > - LLVM_DEBUG(dbgs() << "AFTER:\n" << *DestBB << "\n\n\n");
> > + assert(SinglePred == BB &&
> > + "Single predecessor not the same as predecessor");
> > + // Merge DestBB into SinglePred/BB and delete it.
> > + MergeBlockIntoPredecessor(DestBB);
> > + // Note: BB(=SinglePred) will not be deleted on this path.
> > + // DestBB(=its single successor) is the one that was deleted.
> > + LLVM_DEBUG(dbgs() << "AFTER:\n" << *SinglePred << "\n\n\n");
> > return;
> > }
> > }
> >
> > Modified: llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp (original)
> > +++ llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp Wed Jun 20
> 15:01:04 2018
> > @@ -27,11 +27,12 @@
> > #include "llvm/Analysis/ScalarEvolution.h"
> > #include "llvm/Analysis/ScalarEvolutionAliasAnalysis.h"
> > #include "llvm/Analysis/TargetTransformInfo.h"
> > -#include "llvm/Transforms/Utils/Local.h"
> > #include "llvm/IR/Dominators.h"
> > #include "llvm/Transforms/Scalar.h"
> > #include "llvm/Transforms/Scalar/LoopPassManager.h"
> > #include "llvm/Transforms/Utils.h"
> > +#include "llvm/Transforms/Utils/BasicBlockUtils.h"
> > +#include "llvm/Transforms/Utils/Local.h"
> > #include "llvm/Transforms/Utils/LoopUtils.h"
> > using namespace llvm;
> >
> > @@ -55,11 +56,8 @@ static bool simplifyLoopCFG(Loop &L, Dom
> > if (!Pred || !Pred->getSingleSuccessor() || LI.getLoopFor(Pred) !=
> &L)
> > continue;
> >
> > - // Pred is going to disappear, so we need to update the loop info.
> > - if (L.getHeader() == Pred)
> > - L.moveToHeader(Succ);
> > - LI.removeBlock(Pred);
> > - MergeBasicBlockIntoOnlyPred(Succ, &DT);
> > + // Merge Succ into Pred and delete it.
> > + MergeBlockIntoPredecessor(Succ, &DT, &LI);
> >
> > SE.forgetLoop(&L);
> > Changed = true;
> >
> > Modified: llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp (original)
> > +++ llvm/trunk/lib/Transforms/Utils/BasicBlockUtils.cpp Wed Jun 20
> 15:01:04 2018
> > @@ -117,9 +117,12 @@ bool llvm::DeleteDeadPHIs(BasicBlock *BB
> >
> > bool llvm::MergeBlockIntoPredecessor(BasicBlock *BB, DominatorTree *DT,
> > LoopInfo *LI,
> > - MemoryDependenceResults *MemDep) {
> > - // Don't merge away blocks who have their address taken.
> > - if (BB->hasAddressTaken()) return false;
> > + MemoryDependenceResults *MemDep,
> > + DeferredDominance *DDT) {
> > + assert(!(DT && DDT) && "Cannot call with both DT and DDT.");
> > +
> > + if (BB->hasAddressTaken())
> > + return false;
> >
> > // Can't merge if there are multiple predecessors, or no
> predecessors.
> > BasicBlock *PredBB = BB->getUniquePredecessor();
> > @@ -131,16 +134,9 @@ bool llvm::MergeBlockIntoPredecessor(Bas
> > if (PredBB->getTerminator()->isExceptional())
> > return false;
> >
> > - succ_iterator SI(succ_begin(PredBB)), SE(succ_end(PredBB));
> > - BasicBlock *OnlySucc = BB;
> > - for (; SI != SE; ++SI)
> > - if (*SI != OnlySucc) {
> > - OnlySucc = nullptr; // There are multiple distinct successors!
> > - break;
> > - }
> > -
> > - // Can't merge if there are multiple successors.
> > - if (!OnlySucc) return false;
> > + // Can't merge if there are multiple distinct successors.
> > + if (PredBB->getUniqueSuccessor() != BB)
> > + return false;
> >
> > // Can't merge if there is PHI loop.
> > for (PHINode &PN : BB->phis())
> > @@ -158,6 +154,18 @@ bool llvm::MergeBlockIntoPredecessor(Bas
> > FoldSingleEntryPHINodes(BB, MemDep);
> > }
> >
> > + // Deferred DT update: Collect all the edges that exit BB. These
> > + // dominator edges will be redirected from Pred.
> > + std::vector<DominatorTree::UpdateType> Updates;
> > + if (DDT) {
> > + Updates.reserve(1 + (2 * succ_size(BB)));
> > + Updates.push_back({DominatorTree::Delete, PredBB, BB});
> > + for (auto I = succ_begin(BB), E = succ_end(BB); I != E; ++I) {
> > + Updates.push_back({DominatorTree::Delete, BB, *I});
> > + Updates.push_back({DominatorTree::Insert, PredBB, *I});
> > + }
> > + }
> > +
> > // Delete the unconditional branch from the predecessor...
> > PredBB->getInstList().pop_back();
> >
> > @@ -204,7 +212,12 @@ bool llvm::MergeBlockIntoPredecessor(Bas
> > if (MemDep)
> > MemDep->invalidateCachedPredecessors();
> >
> > - BB->eraseFromParent();
> > + if (DDT) {
> > + DDT->deleteBB(BB); // Deferred deletion of BB.
> > + DDT->applyUpdates(Updates);
> > + } else {
> > + BB->eraseFromParent(); // Nuke BB.
> > + }
> > return true;
> > }
> >
> >
> > Modified: llvm/trunk/test/CodeGen/AMDGPU/branch-relaxation.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/branch-relaxation.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/AMDGPU/branch-relaxation.ll (original)
> > +++ llvm/trunk/test/CodeGen/AMDGPU/branch-relaxation.ll Wed Jun 20
> 15:01:04 2018
> > @@ -441,7 +441,7 @@ endif:
> > ; GCN-NEXT: s_xor_b64 exec, exec, [[TEMP_MASK1]]
> > ; GCN-NEXT: ; mask branch [[RET:BB[0-9]+_[0-9]+]]
> >
> > -; GCN: [[LOOP_BODY:BB[0-9]+_[0-9]+]]: ; %loop_body
> > +; GCN: [[LOOP_BODY:BB[0-9]+_[0-9]+]]: ; %loop
> > ; GCN: ;;#ASMSTART
> > ; GCN: v_nop_e64
> > ; GCN: v_nop_e64
> > @@ -452,7 +452,7 @@ endif:
> > ; GCN: ;;#ASMEND
> > ; GCN: s_cbranch_vccz [[RET]]
> >
> > -; GCN-NEXT: [[LONGBB:BB[0-9]+_[0-9]+]]: ; %loop_body
> > +; GCN-NEXT: [[LONGBB:BB[0-9]+_[0-9]+]]: ; %loop
> > ; GCN-NEXT: ; in Loop: Header=[[LOOP_BODY]] Depth=1
> > ; GCN-NEXT: s_getpc_b64 vcc
> > ; GCN-NEXT: s_sub_u32 vcc_lo, vcc_lo, ([[LONGBB]]+4)-[[LOOP_BODY]]
> >
> > Modified: llvm/trunk/test/CodeGen/AMDGPU/nested-loop-conditions.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/nested-loop-conditions.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/AMDGPU/nested-loop-conditions.ll (original)
> > +++ llvm/trunk/test/CodeGen/AMDGPU/nested-loop-conditions.ll Wed Jun 20
> 15:01:04 2018
> > @@ -59,12 +59,12 @@
> >
> > ; GCN-LABEL: {{^}}reduced_nested_loop_conditions:
> >
> > -; GCN: s_cmp_eq_u32 s{{[0-9]+}}, 1
> > -; GCN-NEXT: s_cbranch_scc1
> > +; GCN: s_cmp_lg_u32 s{{[0-9]+}}, 1
> > +; GCN-NEXT: s_cbranch_scc0
> >
> > ; FIXME: Should fold to unconditional branch?
> > ; GCN: ; implicit-def
> > -; GCN: s_cbranch_vccz
> > +; GCN: s_cbranch_vccnz
> >
> > ; GCN: ds_read_b32
> >
> >
> > Modified: llvm/trunk/test/CodeGen/AMDGPU/si-annotate-cf.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AMDGPU/si-annotate-cf.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/AMDGPU/si-annotate-cf.ll (original)
> > +++ llvm/trunk/test/CodeGen/AMDGPU/si-annotate-cf.ll Wed Jun 20 15:01:04
> 2018
> > @@ -89,11 +89,11 @@ declare float @llvm.fabs.f32(float) noun
> >
> > ; This broke the old AMDIL cfg structurizer
> > ; FUNC-LABEL: {{^}}loop_land_info_assert:
> > -; SI: s_cmp_gt_i32
> > -; SI-NEXT: s_cbranch_scc0 [[ENDPGM:BB[0-9]+_[0-9]+]]
> > +; SI: s_cmp_lt_i32
> > +; SI-NEXT: s_cbranch_scc1 [[ENDPGM:BB[0-9]+_[0-9]+]]
> >
> > -; SI: s_cmpk_gt_i32
> > -; SI-NEXT: s_cbranch_scc1 [[ENDPGM]]
> > +; SI: s_cmpk_lt_i32
> > +; SI-NEXT: s_cbranch_scc0 [[ENDPGM]]
> >
> > ; SI: [[INFLOOP:BB[0-9]+_[0-9]+]]
> > ; SI: s_cbranch_vccnz [[INFLOOP]]
> >
> > Modified: llvm/trunk/test/CodeGen/ARM/indirectbr.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/indirectbr.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/ARM/indirectbr.ll (original)
> > +++ llvm/trunk/test/CodeGen/ARM/indirectbr.ll Wed Jun 20 15:01:04 2018
> > @@ -47,7 +47,7 @@ L3:
> > br label %L2
> >
> > L2: ; preds = %L3, %bb2
> > -; THUMB-LABEL: %L1.clone
> > +; THUMB-LABEL: %.split4
> > ; THUMB: muls
> > %res.2 = phi i32 [ %res.1, %L3 ], [ 1, %bb2 ] ; <i32> [#uses=1]
> > %phitmp = mul i32 %res.2, 6 ; <i32> [#uses=1]
> >
> > Modified:
> llvm/trunk/test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > ---
> llvm/trunk/test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll
> (original)
> > +++
> llvm/trunk/test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll Wed
> Jun 20 15:01:04 2018
> > @@ -160,7 +160,7 @@ define signext i32 @zeroEqualityTest05()
> > ; Validate with memcmp()?:
> > define signext i32 @equalityFoldTwoConstants() {
> > ; CHECK-LABEL: equalityFoldTwoConstants:
> > -; CHECK: # %bb.0: # %endblock
> > +; CHECK: # %bb.0: # %loadbb
> > ; CHECK-NEXT: li 3, 1
> > ; CHECK-NEXT: blr
> > %call = tail call signext i32 @memcmp(i8* bitcast ([15 x i32]*
> @zeroEqualityTest04.buffer1 to i8*), i8* bitcast ([15 x i32]*
> @zeroEqualityTest04.buffer2 to i8*), i64 16)
> >
> > Modified: llvm/trunk/test/CodeGen/PowerPC/memcmp-mergeexpand.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/memcmp-mergeexpand.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/PowerPC/memcmp-mergeexpand.ll (original)
> > +++ llvm/trunk/test/CodeGen/PowerPC/memcmp-mergeexpand.ll Wed Jun 20
> 15:01:04 2018
> > @@ -7,7 +7,7 @@
> >
> > define zeroext i1 @opeq1(
> > ; PPC64LE-LABEL: opeq1:
> > -; PPC64LE: # %bb.0: # %opeq1.exit
> > +; PPC64LE: # %bb.0: # %entry
> > ; PPC64LE-NEXT: ld 3, 0(3)
> > ; PPC64LE-NEXT: ld 4, 0(4)
> > ; PPC64LE-NEXT: xor 3, 3, 4
> >
> > Modified: llvm/trunk/test/CodeGen/PowerPC/ppc-shrink-wrapping.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/ppc-shrink-wrapping.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/PowerPC/ppc-shrink-wrapping.ll (original)
> > +++ llvm/trunk/test/CodeGen/PowerPC/ppc-shrink-wrapping.ll Wed Jun 20
> 15:01:04 2018
> > @@ -169,7 +169,7 @@ declare i32 @something(...)
> > ; CHECK-NEXT: bne 0, .[[LOOP]]
> > ;
> > ; Next BB
> > -; CHECK: %for.end
> > +; CHECK: %for.exit
> > ; CHECK: mtlr {{[0-9]+}}
> > ; CHECK-NEXT: blr
> > define i32 @freqSaveAndRestoreOutsideLoop2(i32 %cond) {
> >
> > Modified: llvm/trunk/test/CodeGen/PowerPC/simplifyConstCmpToISEL.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/PowerPC/simplifyConstCmpToISEL.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/PowerPC/simplifyConstCmpToISEL.ll (original)
> > +++ llvm/trunk/test/CodeGen/PowerPC/simplifyConstCmpToISEL.ll Wed Jun 20
> 15:01:04 2018
> > @@ -3,7 +3,7 @@
> > ; RUN: -ppc-convert-rr-to-ri -verify-machineinstrs | FileCheck %s
> > define void @test(i32 zeroext %parts) {
> > ; CHECK-LABEL: test:
> > -; CHECK: # %bb.0: # %cond.end.i
> > +; CHECK: # %bb.0: # %entry
> > ; CHECK-NEXT: cmplwi 0, 3, 1
> > ; CHECK-NEXT: bnelr+ 0
> > ; CHECK-NEXT: # %bb.1: # %test2.exit.us.unr-lcssa
> >
> > Modified: llvm/trunk/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll (original)
> > +++ llvm/trunk/test/CodeGen/Thumb2/2010-11-22-EpilogueBug.ll Wed Jun 20
> 15:01:04 2018
> > @@ -25,7 +25,7 @@ bb3:
> > br i1 undef, label %return, label %bb
> >
> > return:
> > -; CHECK: %return
> > +; CHECK: %bb3
> > ; 'mov sp, r7' would have left sp in an invalid state
> > ; CHECK-NOT: mov sp, r7
> > ; CHECK-NOT: sub, sp, #4
> >
> > Modified: llvm/trunk/test/CodeGen/Thumb2/thumb2-jtb.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Thumb2/thumb2-jtb.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/Thumb2/thumb2-jtb.ll (original)
> > +++ llvm/trunk/test/CodeGen/Thumb2/thumb2-jtb.ll Wed Jun 20 15:01:04 2018
> > @@ -14,9 +14,6 @@ define i16 @main__getopt_internal_2E_exi
> > entry:
> > br i1 %b, label %codeRepl127.exitStub, label %newFuncRoot
> >
> > -newFuncRoot:
> > - br label %_getopt_internal.exit.ce
> > -
> > codeRepl127.exitStub: ; preds = %_getopt_internal.exit.ce
> > ; Add an explicit edge back to before the jump table to ensure this
> block
> > ; is placed first.
> > @@ -103,6 +100,9 @@ codeRepl57.exitStub: ; preds = %_getopt
> > codeRepl103.exitStub: ; preds = %_getopt_internal.exit.ce
> > ret i16 26
> >
> > +newFuncRoot:
> > + br label %_getopt_internal.exit.ce
> > +
> > _getopt_internal.exit.ce: ; preds = %newFuncRoot
> > switch i32 %0, label %codeRepl127.exitStub [
> > i32 -1, label %parse_options.exit.loopexit.exitStub
> >
> > Modified: llvm/trunk/test/CodeGen/X86/2006-11-17-IllegalMove.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/2006-11-17-IllegalMove.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/2006-11-17-IllegalMove.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/2006-11-17-IllegalMove.ll Wed Jun 20
> 15:01:04 2018
> > @@ -6,9 +6,9 @@ define void @handle_vector_size_attribut
> > ; CHECK: # %bb.0: # %entry
> > ; CHECK-NEXT: movl 0, %eax
> > ; CHECK-NEXT: decl %eax
> > -; CHECK-NEXT: cmpl $2, %eax
> > -; CHECK-NEXT: jae .LBB0_2
> > -; CHECK-NEXT: # %bb.1: # %cond_next129
> > +; CHECK-NEXT: cmpl $1, %eax
> > +; CHECK-NEXT: ja .LBB0_2
> > +; CHECK-NEXT: # %bb.1: # %bb77
> > ; CHECK-NEXT: movb 0, %al
> > ; CHECK-NEXT: movzbl %al, %eax
> > ; CHECK-NEXT: # kill: def $eax killed $eax def $ax
> >
> > Modified: llvm/trunk/test/CodeGen/X86/avx-cmp.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-cmp.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/avx-cmp.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/avx-cmp.ll Wed Jun 20 15:01:04 2018
> > @@ -26,12 +26,15 @@ declare void @scale() nounwind
> > define void @render() nounwind {
> > ; CHECK-LABEL: render:
> > ; CHECK: # %bb.0: # %entry
> > +; CHECK-NEXT: pushq %rbp
> > ; CHECK-NEXT: pushq %rbx
> > +; CHECK-NEXT: pushq %rax
> > ; CHECK-NEXT: xorl %eax, %eax
> > ; CHECK-NEXT: testb %al, %al
> > ; CHECK-NEXT: jne .LBB2_6
> > ; CHECK-NEXT: # %bb.1: # %for.cond5.preheader
> > ; CHECK-NEXT: xorl %ebx, %ebx
> > +; CHECK-NEXT: movb $1, %bpl
> > ; CHECK-NEXT: jmp .LBB2_2
> > ; CHECK-NEXT: .p2align 4, 0x90
> > ; CHECK-NEXT: .LBB2_5: # %if.then
> > @@ -43,8 +46,8 @@ define void @render() nounwind {
> > ; CHECK-NEXT: jne .LBB2_2
> > ; CHECK-NEXT: # %bb.3: # %for.cond5
> > ; CHECK-NEXT: # in Loop: Header=BB2_2 Depth=1
> > -; CHECK-NEXT: testb %bl, %bl
> > -; CHECK-NEXT: je .LBB2_2
> > +; CHECK-NEXT: testb %bpl, %bpl
> > +; CHECK-NEXT: jne .LBB2_2
> > ; CHECK-NEXT: # %bb.4: # %for.body33
> > ; CHECK-NEXT: # in Loop: Header=BB2_2 Depth=1
> > ; CHECK-NEXT: vucomisd {{\.LCPI.*}}, %xmm0
> > @@ -52,7 +55,9 @@ define void @render() nounwind {
> > ; CHECK-NEXT: jp .LBB2_5
> > ; CHECK-NEXT: jmp .LBB2_2
> > ; CHECK-NEXT: .LBB2_6: # %for.end52
> > +; CHECK-NEXT: addq $8, %rsp
> > ; CHECK-NEXT: popq %rbx
> > +; CHECK-NEXT: popq %rbp
> > ; CHECK-NEXT: retq
> > entry:
> > br i1 undef, label %for.cond5, label %for.end52
> >
> > Modified: llvm/trunk/test/CodeGen/X86/avx-splat.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx-splat.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/avx-splat.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/avx-splat.ll Wed Jun 20 15:01:04 2018
> > @@ -58,7 +58,7 @@ entry:
> > ;
> > define <8 x float> @funcE() nounwind {
> > ; CHECK-LABEL: funcE:
> > -; CHECK: # %bb.0: # %for_exit499
> > +; CHECK: # %bb.0: # %allocas
> > ; CHECK-NEXT: xorl %eax, %eax
> > ; CHECK-NEXT: testb %al, %al
> > ; CHECK-NEXT: # implicit-def: $ymm0
> >
> > Modified: llvm/trunk/test/CodeGen/X86/avx2-vbroadcast.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx2-vbroadcast.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/avx2-vbroadcast.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/avx2-vbroadcast.ll Wed Jun 20 15:01:04
> 2018
> > @@ -686,7 +686,7 @@ define void @crash() nounwind alwaysinli
> > ; X32-NEXT: ## %bb.2: ## %ret
> > ; X32-NEXT: retl
> > ; X32-NEXT: .p2align 4, 0x90
> > -; X32-NEXT: LBB33_1: ## %footer349VF
> > +; X32-NEXT: LBB33_1: ## %footer329VF
> > ; X32-NEXT: ## =>This Inner Loop Header: Depth=1
> > ; X32-NEXT: jmp LBB33_1
> > ;
> > @@ -698,7 +698,7 @@ define void @crash() nounwind alwaysinli
> > ; X64-NEXT: ## %bb.2: ## %ret
> > ; X64-NEXT: retq
> > ; X64-NEXT: .p2align 4, 0x90
> > -; X64-NEXT: LBB33_1: ## %footer349VF
> > +; X64-NEXT: LBB33_1: ## %footer329VF
> > ; X64-NEXT: ## =>This Inner Loop Header: Depth=1
> > ; X64-NEXT: jmp LBB33_1
> > WGLoopsEntry:
> >
> > Modified: llvm/trunk/test/CodeGen/X86/avx512-i1test.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx512-i1test.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/avx512-i1test.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/avx512-i1test.ll Wed Jun 20 15:01:04 2018
> > @@ -7,7 +7,7 @@ target triple = "x86_64-unknown-linux-gn
> >
> > define void @func() {
> > ; CHECK-LABEL: func:
> > -; CHECK: # %bb.0: # %L_10
> > +; CHECK: # %bb.0: # %bb1
> > ; CHECK-NEXT: xorl %eax, %eax
> > ; CHECK-NEXT: testb %al, %al
> > ; CHECK-NEXT: je .LBB0_1
> > @@ -70,7 +70,7 @@ define i64 @func2(i1 zeroext %i, i32 %j)
> > ; CHECK-NEXT: je .LBB1_1
> > ; CHECK-NEXT: # %bb.2: # %if.then
> > ; CHECK-NEXT: jmp bar # TAILCALL
> > -; CHECK-NEXT: .LBB1_1: # %return
> > +; CHECK-NEXT: .LBB1_1: # %if.end
> > ; CHECK-NEXT: movzbl %dil, %eax
> > ; CHECK-NEXT: orq $-2, %rax
> > ; CHECK-NEXT: retq
> >
> > Modified: llvm/trunk/test/CodeGen/X86/block-placement.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/block-placement.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/block-placement.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/block-placement.ll Wed Jun 20 15:01:04
> 2018
> > @@ -317,7 +317,7 @@ define void @unnatural_cfg1() {
> > ; a function. This is a gross CFG reduced out of the single source GCC.
> > ; CHECK-LABEL: unnatural_cfg1
> > ; CHECK: %entry
> > -; CHECK: %loop.body1
> > +; CHECK: %loop.header
> > ; CHECK: %loop.body2
> > ; CHECK: %loop.body3
> >
> > @@ -611,7 +611,7 @@ define void @test_unnatural_cfg_backward
> > ; CHECK-LABEL: test_unnatural_cfg_backwards_inner_loop
> > ; CHECK: %entry
> > ; CHECK: %loop2b
> > -; CHECK: %loop1
> > +; CHECK: %loop3
> >
> > entry:
> > br i1 undef, label %loop2a, label %body
> >
> > Modified: llvm/trunk/test/CodeGen/X86/hoist-spill.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/hoist-spill.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/hoist-spill.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/hoist-spill.ll Wed Jun 20 15:01:04 2018
> > @@ -48,9 +48,6 @@ for.cond:
> > %cmp326 = icmp sgt i32 %k.0, %p1
> > br i1 %cmp326, label %for.cond4.preheader, label %for.body.preheader
> >
> > -for.body.preheader: ; preds = %for.cond
> > - br label %for.body
> > -
> > for.cond4.preheader: ; preds = %for.body,
> %for.cond
> > %k.1.lcssa = phi i32 [ %k.0, %for.cond ], [ %add, %for.body ]
> > %cmp528 = icmp sgt i32 %sub., %p1
> > @@ -95,6 +92,9 @@ vector.body:
> > middle.block: ; preds =
> %vector.body, %vector.body.preheader.split
> > br i1 undef, label %for.inc14, label %for.body6
> >
> > +for.body.preheader: ; preds = %for.cond
> > + br label %for.body
> > +
> > for.body: ; preds = %for.body,
> %for.body.preheader
> > %k.127 = phi i32 [ %k.0, %for.body.preheader ], [ %add, %for.body ]
> > %add = add nsw i32 %k.127, 1
> >
> > Modified: llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-1.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-1.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-1.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/ins_subreg_coalesce-1.ll Wed Jun 20
> 15:01:04 2018
> > @@ -3,7 +3,7 @@
> >
> > define fastcc i32 @t() nounwind {
> > ; CHECK-LABEL: t:
> > -; CHECK: # %bb.0: # %walkExprTree.exit
> > +; CHECK: # %bb.0: # %entry
> > ; CHECK-NEXT: movzwl 0, %eax
> > ; CHECK-NEXT: orl $2, %eax
> > ; CHECK-NEXT: movw %ax, 0
> >
> > Modified: llvm/trunk/test/CodeGen/X86/memcmp-mergeexpand.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/memcmp-mergeexpand.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/memcmp-mergeexpand.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/memcmp-mergeexpand.ll Wed Jun 20
> 15:01:04 2018
> > @@ -8,7 +8,7 @@
> >
> > define zeroext i1 @opeq1(
> > ; X86-LABEL: opeq1:
> > -; X86: # %bb.0: # %opeq1.exit
> > +; X86: # %bb.0: # %entry
> > ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
> > ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
> > ; X86-NEXT: movl (%ecx), %edx
> > @@ -20,7 +20,7 @@ define zeroext i1 @opeq1(
> > ; X86-NEXT: retl
> > ;
> > ; X64-LABEL: opeq1:
> > -; X64: # %bb.0: # %opeq1.exit
> > +; X64: # %bb.0: # %entry
> > ; X64-NEXT: movq (%rdi), %rax
> > ; X64-NEXT: cmpq (%rsi), %rax
> > ; X64-NEXT: sete %al
> >
> > Modified: llvm/trunk/test/CodeGen/X86/pr32108.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr32108.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/pr32108.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/pr32108.ll Wed Jun 20 15:01:04 2018
> > @@ -3,7 +3,7 @@
> >
> > define void @pr32108() {
> > ; CHECK-LABEL: pr32108:
> > -; CHECK: # %bb.0: # %CF257
> > +; CHECK: # %bb.0: # %BB
> > ; CHECK-NEXT: movb $0, -{{[0-9]+}}(%rsp)
> > ; CHECK-NEXT: .p2align 4, 0x90
> > ; CHECK-NEXT: .LBB0_1: # %CF244
> >
> > Modified: llvm/trunk/test/CodeGen/X86/setcc-lowering.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/setcc-lowering.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/setcc-lowering.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/setcc-lowering.ll Wed Jun 20 15:01:04
> 2018
> > @@ -43,7 +43,7 @@ entry:
> >
> > define void @pr26232(i64 %a, <16 x i1> %b) {
> > ; AVX-LABEL: pr26232:
> > -; AVX: # %bb.0: # %for_loop599.preheader
> > +; AVX: # %bb.0: # %allocas
> > ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
> > ; AVX-NEXT: vmovdqa {{.*#+}} xmm2 =
> [128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128]
> > ; AVX-NEXT: .p2align 4, 0x90
> > @@ -64,7 +64,7 @@ define void @pr26232(i64 %a, <16 x i1> %
> > ; AVX-NEXT: retq
> > ;
> > ; KNL-32-LABEL: pr26232:
> > -; KNL-32: # %bb.0: # %for_loop599.preheader
> > +; KNL-32: # %bb.0: # %allocas
> > ; KNL-32-NEXT: pushl %esi
> > ; KNL-32-NEXT: .cfi_def_cfa_offset 8
> > ; KNL-32-NEXT: .cfi_offset %esi, -8
> >
> > Modified: llvm/trunk/test/CodeGen/X86/split-store.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/split-store.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/split-store.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/split-store.ll Wed Jun 20 15:01:04 2018
> > @@ -232,7 +232,7 @@ define void @int1_int1_pair(i1 signext %
> >
> > define void @mbb_int32_float_pair(i32 %tmp1, float %tmp2, i64*
> %ref.tmp) {
> > ; CHECK-LABEL: mbb_int32_float_pair:
> > -; CHECK: # %bb.0: # %next
> > +; CHECK: # %bb.0: # %entry
> > ; CHECK-NEXT: movl %edi, (%rsi)
> > ; CHECK-NEXT: movss %xmm0, 4(%rsi)
> > ; CHECK-NEXT: retq
> > @@ -250,7 +250,7 @@ next:
> >
> > define void @mbb_int32_float_multi_stores(i32 %tmp1, float %tmp2, i64*
> %ref.tmp, i64* %ref.tmp1, i1 %cmp) {
> > ; CHECK-LABEL: mbb_int32_float_multi_stores:
> > -; CHECK: # %bb.0: # %bb1
> > +; CHECK: # %bb.0: # %entry
> > ; CHECK-NEXT: movl %edi, (%rsi)
> > ; CHECK-NEXT: movss %xmm0, 4(%rsi)
> > ; CHECK-NEXT: testb $1, %cl
> >
> > Modified: llvm/trunk/test/CodeGen/X86/tail-dup-merge-loop-headers.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/tail-dup-merge-loop-headers.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/CodeGen/X86/tail-dup-merge-loop-headers.ll (original)
> > +++ llvm/trunk/test/CodeGen/X86/tail-dup-merge-loop-headers.ll Wed Jun
> 20 15:01:04 2018
> > @@ -10,7 +10,7 @@ target triple = "x86_64-unknown-linux-gn
> > ; CHECK-NOT: # %{{[a-zA-Z_]+}}
> > ; CHECK: # %inner_loop_latch
> > ; CHECK-NOT: # %{{[a-zA-Z_]+}}
> > -; CHECK: # %inner_loop_test
> > +; CHECK: # %inner_loop_top
> > ; CHECK-NOT: # %{{[a-zA-Z_]+}}
> > ; CHECK: # %exit
> > define void @tail_dup_merge_loops(i32 %a, i8* %b, i8* %c)
> local_unnamed_addr #0 {
> >
> > Modified: llvm/trunk/test/DebugInfo/Generic/sunk-compare.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/Generic/sunk-compare.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/DebugInfo/Generic/sunk-compare.ll (original)
> > +++ llvm/trunk/test/DebugInfo/Generic/sunk-compare.ll Wed Jun 20
> 15:01:04 2018
> > @@ -8,7 +8,7 @@
> > ; We check that the compare instruction retains its debug loc after
> > ; it is sunk into other.bb by the codegen prepare pass.
> > ;
> > -; CHECK: other.bb:
> > +; CHECK: entry:
> > ; CHECK-NEXT: icmp{{.*}}%x, 0, !dbg ![[MDHANDLE:[0-9]*]]
> > ; CHECK: ![[MDHANDLE]] = !DILocation(line: 2
> > ;
> >
> > Modified: llvm/trunk/test/Transforms/CodeGenPrepare/X86/computedgoto.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CodeGenPrepare/X86/computedgoto.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/Transforms/CodeGenPrepare/X86/computedgoto.ll
> (original)
> > +++ llvm/trunk/test/Transforms/CodeGenPrepare/X86/computedgoto.ll Wed
> Jun 20 15:01:04 2018
> > @@ -168,7 +168,7 @@ exit:
> > ; the block it terminates.
> > define void @loop(i64* nocapture readonly %p) {
> > ; CHECK-LABEL: @loop(
> > -; CHECK-NEXT: bb0.clone:
> > +; CHECK-NEXT: entry:
> > ; CHECK-NEXT: br label [[DOTSPLIT:%.*]]
> > ; CHECK: bb0:
> > ; CHECK-NEXT: br label [[DOTSPLIT]]
> >
> > Modified: llvm/trunk/test/Transforms/CodeGenPrepare/basic.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/CodeGenPrepare/basic.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/Transforms/CodeGenPrepare/basic.ll (original)
> > +++ llvm/trunk/test/Transforms/CodeGenPrepare/basic.ll Wed Jun 20
> 15:01:04 2018
> > @@ -13,7 +13,7 @@ entry:
> > %1 = icmp ugt i64 %0, 3
> > br i1 %1, label %T, label %trap
> >
> > -; CHECK: T:
> > +; CHECK: entry:
> > ; CHECK-NOT: br label %
> >
> > trap: ; preds = %0, %entry
> >
> > Modified: llvm/trunk/test/Transforms/LoopSimplifyCFG/scev.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopSimplifyCFG/scev.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/test/Transforms/LoopSimplifyCFG/scev.ll (original)
> > +++ llvm/trunk/test/Transforms/LoopSimplifyCFG/scev.ll Wed Jun 20
> 15:01:04 2018
> > @@ -6,22 +6,22 @@
> > define void @t_run_test() {
> > ; CHECK-LABEL: @t_run_test(
> > ; CHECK-NEXT: entry:
> > -; CHECK-NEXT: br label [[LOOP_PH:%.*]]
> > -; CHECK: loop.ph:
> > -; CHECK-NEXT: br label [[LOOP_BODY:%.*]]
> > -; CHECK: loop.body:
> > -; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[LOOP_PH]] ], [
> [[INC:%.*]], [[LOOP_BODY]] ]
> > +; CHECK-NEXT: br label %[[LOOP_PH:.*]]
> > +; CHECK: [[LOOP_PH]]:
> > +; CHECK-NEXT: br label %[[LOOP_BODY:.*]]
> > +; CHECK: [[LOOP_BODY]]:
> > +; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, %[[LOOP_PH]] ], [
> [[INC:%.*]], %[[LOOP_BODY]] ]
> > ; CHECK-NEXT: [[INC]] = add i32 [[IV]], 1
> > ; CHECK-NEXT: [[CMP:%.*]] = icmp ult i32 [[INC]], 10
> > -; CHECK-NEXT: br i1 [[CMP]], label [[LOOP_BODY]], label [[EXIT:%.*]]
> > -; CHECK: exit:
> > -; CHECK-NEXT: br label [[LOOP_BODY2:%.*]]
> > -; CHECK: loop.body2:
> > -; CHECK-NEXT: [[IV2:%.*]] = phi i32 [ 0, [[EXIT]] ], [ [[INC2:%.*]],
> [[LOOP_BODY2]] ]
> > +; CHECK-NEXT: br i1 [[CMP]], label %[[LOOP_BODY]], label %[[EXIT:.*]]
> > +; CHECK: [[EXIT]]:
> > +; CHECK-NEXT: br label %[[LOOP_BODY2:.*]]
> > +; CHECK: [[LOOP_BODY2]]:
> > +; CHECK-NEXT: [[IV2:%.*]] = phi i32 [ 0, %[[EXIT]] ], [
> [[INC2:%.*]], %[[LOOP_BODY2]] ]
> > ; CHECK-NEXT: [[INC2]] = add i32 [[IV2]], 1
> > ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[INC2]], 10
> > -; CHECK-NEXT: br i1 [[CMP2]], label [[LOOP_BODY2]], label
> [[EXIT2:%.*]]
> > -; CHECK: exit2:
> > +; CHECK-NEXT: br i1 [[CMP2]], label %[[LOOP_BODY2]], label
> %[[EXIT2:.*]]
> > +; CHECK: [[EXIT2]]:
> > ; CHECK-NEXT: ret void
> > ;
> > entry:
> >
> > Modified:
> llvm/trunk/test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > ---
> llvm/trunk/test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll
> (original)
> > +++
> llvm/trunk/test/Transforms/LoopStrengthReduce/ARM/2012-06-15-lsr-noaddrmode.ll
> Wed Jun 20 15:01:04 2018
> > @@ -44,7 +44,7 @@ declare %s* @getstruct() nounwind
> >
> > ; CHECK: @main
> > ; Check that the loop preheader contains no address computation.
> > -; CHECK: %end_of_chain
> > +; CHECK: %while.cond.i.i
> > ; CHECK-NOT: add{{.*}}lsl
> > ; CHECK: ldr{{.*}}lsl #2
> > ; CHECK: ldr{{.*}}lsl #2
> >
> > Modified:
> llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > ---
> llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll
> (original)
> > +++
> llvm/trunk/test/Transforms/LoopStrengthReduce/X86/2012-01-13-phielim.ll Wed
> Jun 20 15:01:04 2018
> > @@ -96,7 +96,8 @@ while.end:
> > ; itself a phi.
> > ;
> > ; CHECK: @test3
> > -; CHECK: %for.body3.lr.ph.us.i.loopexit
> > +; CHECK: %meshBB1
> > +; CHECK: %meshBB
> > ; CHECK-NEXT: Parent Loop
> > ; CHECK-NEXT: Inner Loop
> > ; CHECK-NEXT: incq
> >
> > Modified:
> llvm/trunk/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-iteration.ll
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-iteration.ll?rev=335183&r1=335182&r2=335183&view=diff
> >
> ==============================================================================
> > ---
> llvm/trunk/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-iteration.ll
> (original)
> > +++
> llvm/trunk/test/Transforms/SimpleLoopUnswitch/trivial-unswitch-iteration.ll
> Wed Jun 20 15:01:04 2018
> > @@ -13,7 +13,7 @@ entry:
> > ; CHECK-NEXT: br i1 %{{.*}}, label %entry.split.split, label
> %loop_exit
> > ;
> > ; CHECK: entry.split.split:
> > -; CHECK-NEXT: br label %do_something
> > +; CHECK-NEXT: br label %loop_begin
> >
> > loop_begin:
> > br i1 %cond1, label %continue, label %loop_exit ; first trivial
> condition
> > @@ -27,9 +27,9 @@ continue:
> > do_something:
> > call void @some_func() noreturn nounwind
> > br label %loop_begin
> > -; CHECK: do_something:
> > +; CHECK: loop_begin:
> > ; CHECK-NEXT: call
> > -; CHECK-NEXT: br label %do_something
> > +; CHECK-NEXT: br label %loop_begin
> >
> > loop_exit:
> > ret i32 0
> > @@ -38,4 +38,4 @@ loop_exit:
> > ;
> > ; CHECK: loop_exit.split:
> > ; CHECK-NEXT: ret
> > -}
> > \ No newline at end of file
> > +}
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180808/0b1e6d70/attachment.html>
More information about the llvm-commits
mailing list