diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2021-08-12 20:02:48 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2021-08-12 20:03:09 +0300 |
commit | f30a7dff8a5b32919951dcbf92e4a9d56c4679ff (patch) | |
tree | 81d71d761f9658172d79d62ea20ce96247e7604b /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 628f63d3d5ab71ab68e496443d261d91549c5ca6 (diff) | |
download | llvm-f30a7dff8a5b32919951dcbf92e4a9d56c4679ff.zip llvm-f30a7dff8a5b32919951dcbf92e4a9d56c4679ff.tar.gz llvm-f30a7dff8a5b32919951dcbf92e4a9d56c4679ff.tar.bz2 |
[NFCI][SimplifyCFG] simplifyCondBranch(): assert that branch is non-tautological
We really shouldn't deal with a conditional branch that can be trivially
constant-folded into an unconditional branch.
Indeed, barring failure to trigger BB reprocessing, that should be true,
so let's assert as much, and hope the assertion never fires.
If it does, we have a bug to fix.
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 482316c..5cd7cd7 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -6394,6 +6394,11 @@ static BasicBlock *allPredecessorsComeFromSameSource(BasicBlock *BB) { } bool SimplifyCFGOpt::simplifyCondBranch(BranchInst *BI, IRBuilder<> &Builder) { + assert( + !isa<ConstantInt>(BI->getCondition()) && + BI->getSuccessor(0) != BI->getSuccessor(1) && + "Tautological conditional branch should have been eliminated already."); + BasicBlock *BB = BI->getParent(); if (!Options.SimplifyCondBranch) return false; |