mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 11:13:28 +01:00
Fix assertion in jump threading (PR13405).
GetBestDestForJumpOnUndef() assumes there is at least 1 successor, which isn't true if the block ends in an indirect branch with no successors. Fix this by bailing out earlier in this case. llvm-svn: 160546
This commit is contained in:
parent
a57ebfbe10
commit
f82086baa5
@ -670,6 +670,8 @@ bool JumpThreading::ProcessBlock(BasicBlock *BB) {
|
||||
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(Terminator)) {
|
||||
Condition = SI->getCondition();
|
||||
} else if (IndirectBrInst *IB = dyn_cast<IndirectBrInst>(Terminator)) {
|
||||
// Can't thread indirect branch with no successors.
|
||||
if (IB->getNumSuccessors() == 0) return false;
|
||||
Condition = IB->getAddress()->stripPointerCasts();
|
||||
Preference = WantBlockAddress;
|
||||
} else {
|
||||
|
@ -0,0 +1,8 @@
|
||||
; RUN: opt < %s -jump-threading
|
||||
; PR 13405
|
||||
; Just check that it doesn't crash / assert
|
||||
|
||||
define i32 @f() nounwind {
|
||||
entry:
|
||||
indirectbr i8* undef, []
|
||||
}
|
Loading…
Reference in New Issue
Block a user