diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-06-29 19:58:21 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-06-29 19:58:21 +0000 |
| commit | 396b3adc10e44fd4be4898e05db0794eaac5dbe5 (patch) | |
| tree | 8dc08447624d0f6b0f83a4d401e65580153bba9a | |
| parent | 2794ad59aad48c6b3088bb2cd40ad4fa13d695f8 (diff) | |
| download | bcm5719-llvm-396b3adc10e44fd4be4898e05db0794eaac5dbe5.tar.gz bcm5719-llvm-396b3adc10e44fd4be4898e05db0794eaac5dbe5.zip | |
CodeGenPrepare: Don't crash when TLI is not available.
This happens when codegenprepare is invoked via opt.
llvm-svn: 159457
| -rw-r--r-- | llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp index c95d36af0b3..cbc089ab788 100644 --- a/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/llvm/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -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) || |

