move one-use check under the comment that describes it; NFCI
authorSanjay Patel <spatel@rotateright.com>
Mon, 28 Sep 2015 21:44:46 +0000 (21:44 +0000)
committerSanjay Patel <spatel@rotateright.com>
Mon, 28 Sep 2015 21:44:46 +0000 (21:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@248745 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenPrepare.cpp

index c667601ccf331c3e477233ca213de5ea2cf82610..c69b03884719732ddf737bdde45393b6a84cef4a 100644 (file)
@@ -3854,7 +3854,7 @@ static bool isFormingBranchFromSelectProfitable(SelectInst *SI) {
   // 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 isFormingBranchFromSelectProfitable(SelectInst *SI) {
 
   // 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()));
 }