[llvm] r248745 - move one-use check under the comment that describes it; NFCI

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 14:44:47 PDT 2015


Author: spatel
Date: Mon Sep 28 16:44:46 2015
New Revision: 248745

URL: http://llvm.org/viewvc/llvm-project?rev=248745&view=rev
Log:
move one-use check under the comment that describes it; NFCI

Modified:
    llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp

Modified: llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp?rev=248745&r1=248744&r2=248745&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/trunk/lib/CodeGen/CodeGenPrepare.cpp Mon Sep 28 16:44:46 2015
@@ -3854,7 +3854,7 @@ static bool isFormingBranchFromSelectPro
   // avoid stalls on the load from memory.  If the compare has more than one use
   // there's probably another cmov or setcc around so it's not worth emitting a
   // branch.
-  if (!Cmp)
+  if (!Cmp || !Cmp->hasOneUse())
     return false;
 
   Value *CmpOp0 = Cmp->getOperand(0);
@@ -3862,8 +3862,7 @@ static bool isFormingBranchFromSelectPro
 
   // We check that the memory operand has one use to avoid uses of the loaded
   // value directly after the compare, making branches unprofitable.
-  return Cmp->hasOneUse() &&
-         ((isa<LoadInst>(CmpOp0) && CmpOp0->hasOneUse()) ||
+  return ((isa<LoadInst>(CmpOp0) && CmpOp0->hasOneUse()) ||
           (isa<LoadInst>(CmpOp1) && CmpOp1->hasOneUse()));
 }
 




More information about the llvm-commits mailing list