diff options
author | Sanjay Patel <spatel@rotateright.com> | 2015-09-28 22:14:51 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2015-09-28 22:14:51 +0000 |
commit | 4e6527682a7f828611d23693507da1911a30c431 (patch) | |
tree | abf623ccf972dca341092ae9477d299c1734b94c /llvm/lib/CodeGen/CodeGenPrepare.cpp | |
parent | 27322355080e30ad1ce3be04557219442944f667 (diff) | |
download | bcm5719-llvm-4e6527682a7f828611d23693507da1911a30c431.tar.gz bcm5719-llvm-4e6527682a7f828611d23693507da1911a30c431.zip |
tidy up comments; NFC
llvm-svn: 248750
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index c69b0388471..c4c97ff0a3d 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -3849,19 +3849,19 @@ static bool isFormingBranchFromSelectProfitable(SelectInst *SI) { CmpInst *Cmp = dyn_cast<CmpInst>(SI->getCondition()); - // If the branch is predicted right, an out of order CPU can avoid blocking on - // the compare. Emit cmovs on compares with a memory operand as branches to - // 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 a branch is predictable, an out-of-order CPU can avoid blocking on its + // comparison condition. 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 || !Cmp->hasOneUse()) return false; Value *CmpOp0 = Cmp->getOperand(0); Value *CmpOp1 = Cmp->getOperand(1); - // We check that the memory operand has one use to avoid uses of the loaded - // value directly after the compare, making branches unprofitable. + // Emit "cmov on compare with a memory operand" as a branch to avoid stalls + // on a load from memory. But if the load is used more than once, do not + // change the select to a branch because the load is probably needed + // regardless of whether the branch is taken or not. return ((isa<LoadInst>(CmpOp0) && CmpOp0->hasOneUse()) || (isa<LoadInst>(CmpOp1) && CmpOp1->hasOneUse())); } |