[llvm-commits] [llvm] r159457 - /llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Benjamin Kramer
benny.kra at googlemail.com
Fri Jun 29 12:58:21 PDT 2012
Author: d0k
Date: Fri Jun 29 14:58:21 2012
New Revision: 159457
URL: http://llvm.org/viewvc/llvm-project?rev=159457&view=rev
Log:
CodeGenPrepare: Don't crash when TLI is not available.
This happens when codegenprepare is invoked via opt.
Modified:
llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp?rev=159457&r1=159456&r2=159457&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/CodeGenPrepare.cpp Fri Jun 29 14:58:21 2012
@@ -1133,7 +1133,8 @@
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) ||
More information about the llvm-commits
mailing list