From: Xin Tong Date: Sat, 17 Jun 2017 16:55:12 +0000 (+0000) Subject: [TRE] Add assertion for folding trivial return block X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9bca842196de4664bdc2b2e94ba512b0668b4ff7;p=llvm [TRE] Add assertion for folding trivial return block git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305637 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/TailRecursionElimination.cpp b/lib/Transforms/Scalar/TailRecursionElimination.cpp index 93c4b57514c..365566c07f4 100644 --- a/lib/Transforms/Scalar/TailRecursionElimination.cpp +++ b/lib/Transforms/Scalar/TailRecursionElimination.cpp @@ -677,6 +677,10 @@ static bool foldReturnAndProcessPred(BasicBlock *BB, ReturnInst *Ret, const TargetTransformInfo *TTI) { bool Change = false; + // Make sure this block is a trivial return block. + assert(BB->getFirstNonPHIOrDbg() == Ret && + "Trying to fold non-trivial return block"); + // If the return block contains nothing but the return and PHI's, // there might be an opportunity to duplicate the return in its // predecessors and perform TRE there. Look for predecessors that end