summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorPeter Zotov <whitequark@whitequark.org>2016-04-03 17:11:53 +0000
committerPeter Zotov <whitequark@whitequark.org>2016-04-03 17:11:53 +0000
commitf87e550e89f932d042855572a55cb8a2b3f7dcad (patch)
tree5111ca607e78dbabd6c3109a09c975b3fb0c4ccd /llvm/lib/CodeGen/CodeGenPrepare.cpp
parent0b6d7bc6820702a803ec180435b899e692e8c229 (diff)
downloadbcm5719-llvm-f87e550e89f932d042855572a55cb8a2b3f7dcad.tar.gz
bcm5719-llvm-f87e550e89f932d042855572a55cb8a2b3f7dcad.zip
[CodeGenPrepare] Fix r265264.
The case where there was no TargetLowering was not handled, leading to null pointer dereferences. llvm-svn: 265265
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index afd37a0efe7..ba68a4ec252 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -910,8 +910,8 @@ static bool SinkCmpExpression(CmpInst *CI, const TargetLowering &TLI) {
return MadeChange;
}
-static bool OptimizeCmpExpression(CmpInst *CI, const TargetLowering &TLI) {
- if (SinkCmpExpression(CI, TLI))
+static bool OptimizeCmpExpression(CmpInst *CI, const TargetLowering *TLI) {
+ if (TLI && SinkCmpExpression(CI, *TLI))
return true;
if (CombineUAddWithOverflow(CI))
@@ -5177,7 +5177,7 @@ bool CodeGenPrepare::optimizeInst(Instruction *I, bool& ModifiedDT) {
if (CmpInst *CI = dyn_cast<CmpInst>(I))
if (!TLI || !TLI->hasMultipleConditionRegisters())
- return OptimizeCmpExpression(CI, *TLI);
+ return OptimizeCmpExpression(CI, TLI);
if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
stripInvariantGroupMetadata(*LI);
OpenPOWER on IntegriCloud