aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/Scalar/CodeGenPrepare.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp
index c95d36a..cbc089a 100644
--- a/lib/Transforms/Scalar/CodeGenPrepare.cpp
+++ b/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) ||