mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 10:56:01 +00:00
[JumpThread] Add some assertions for expected ConstantInt/BlockAddress
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301808 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4d5ff6d8d6
commit
4c37a844b1
@ -1268,13 +1268,16 @@ bool JumpThreadingPass::ProcessThreadableEdges(Value *Cond, BasicBlock *BB,
|
||||
BasicBlock *DestBB;
|
||||
if (isa<UndefValue>(Val))
|
||||
DestBB = nullptr;
|
||||
else if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator()))
|
||||
else if (BranchInst *BI = dyn_cast<BranchInst>(BB->getTerminator())) {
|
||||
assert(isa<ConstantInt>(Val) && "Expecting a constant integer");
|
||||
DestBB = BI->getSuccessor(cast<ConstantInt>(Val)->isZero());
|
||||
else if (SwitchInst *SI = dyn_cast<SwitchInst>(BB->getTerminator())) {
|
||||
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(BB->getTerminator())) {
|
||||
assert(isa<ConstantInt>(Val) && "Expecting a constant integer");
|
||||
DestBB = SI->findCaseValue(cast<ConstantInt>(Val))->getCaseSuccessor();
|
||||
} else {
|
||||
assert(isa<IndirectBrInst>(BB->getTerminator())
|
||||
&& "Unexpected terminator");
|
||||
assert(isa<BlockAddress>(Val) && "Expecting a constant blockaddress");
|
||||
DestBB = cast<BlockAddress>(Val)->getBasicBlock();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user