forked from OSchip/llvm-project
CodeGenPrepare: Don't crash when TLI is not available.
This happens when codegenprepare is invoked via opt. llvm-svn: 159457
This commit is contained in:
parent
2794ad59aa
commit
396b3adc10
|
@ -1133,7 +1133,8 @@ static bool isFormingBranchFromSelectProfitable(SelectInst *SI) {
|
|||
bool CodeGenPrepare::OptimizeSelectInst(SelectInst *SI) {
|
||||
// If we have a SelectInst that will likely profit from branch prediction,
|
||||
// turn it into a branch.
|
||||
if (DisableSelectToBranch || OptSize || !TLI->isPredictableSelectExpensive())
|
||||
if (DisableSelectToBranch || OptSize || !TLI ||
|
||||
!TLI->isPredictableSelectExpensive())
|
||||
return false;
|
||||
|
||||
if (!SI->getCondition()->getType()->isIntegerTy(1) ||
|
||||
|
|
Loading…
Reference in New Issue