OSDN Git Service

[CodeGenPrepare] Fix r265264 (again).
authorPeter Zotov <whitequark@whitequark.org>
Sun, 3 Apr 2016 19:32:13 +0000 (19:32 +0000)
committerPeter Zotov <whitequark@whitequark.org>
Sun, 3 Apr 2016 19:32:13 +0000 (19:32 +0000)
Don't require TLI for SinkCmpExpression, like it wasn't before
r265264.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265271 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenPrepare.cpp

index ba68a4e..89ffab4 100644 (file)
@@ -855,11 +855,11 @@ static bool CombineUAddWithOverflow(CmpInst *CI) {
 /// lose; some adjustment may be wanted there.
 ///
 /// Return true if any changes are made.
-static bool SinkCmpExpression(CmpInst *CI, const TargetLowering &TLI) {
+static bool SinkCmpExpression(CmpInst *CI, const TargetLowering *TLI) {
   BasicBlock *DefBB = CI->getParent();
 
   // Avoid sinking soft-FP comparisons, since this can move them into a loop.
-  if (TLI.useSoftFloat() && isa<FCmpInst>(CI))
+  if (TLI && TLI->useSoftFloat() && isa<FCmpInst>(CI))
     return false;
 
   // Only insert a cmp in each block once.
@@ -911,7 +911,7 @@ static bool SinkCmpExpression(CmpInst *CI, const TargetLowering &TLI) {
 }
 
 static bool OptimizeCmpExpression(CmpInst *CI, const TargetLowering *TLI) {
-  if (TLI && SinkCmpExpression(CI, *TLI))
+  if (SinkCmpExpression(CI, TLI))
     return true;
 
   if (CombineUAddWithOverflow(CI))