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 | 6c50551e9a555230f34e1abb467d575d8f11df19 (patch) | |
tree | 56102c9e4580c157fc3c3092507d734cb8727ede /lib | |
parent | 54d69668b22b8c37aa6e45f14445f3988cc430d4 (diff) |
CodeGenPrepare: Don't crash when TLI is not available.
This happens when codegenprepare is invoked via opt.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159457 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/CodeGenPrepare.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index c95d36af0b..cbc089ab78 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) || |