Chromium Code Reviews| Index: src/IceTargetLoweringX86BaseImpl.h |
| diff --git a/src/IceTargetLoweringX86BaseImpl.h b/src/IceTargetLoweringX86BaseImpl.h |
| index ebdfb1e86b7e94dc86c2ad4f413da5dc754a41a0..d06474c1a602ab347fa66cb1d088467e93017ed9 100644 |
| --- a/src/IceTargetLoweringX86BaseImpl.h |
| +++ b/src/IceTargetLoweringX86BaseImpl.h |
| @@ -1283,6 +1283,11 @@ void TargetX86Base<Machine>::lowerArithmetic(const InstArithmetic *Inst) { |
| std::swap(Src0, Src1); |
| if (llvm::isa<Constant>(Src0) && !llvm::isa<Constant>(Src1)) |
| std::swap(Src0, Src1); |
| + // Improve two-address code patterns by avoiding a copy to the dest |
| + // register when one of the source operands ends its lifetime here. |
| + if (!Inst->isLastUse(Src0) && Inst->isLastUse(Src1)) |
| + std::swap(Src0, Src1); |
|
Jim Stichnoth
2015/09/25 21:12:09
I'm starting to get nervous about "swap wars". Co
sehr
2015/10/06 18:42:00
I added the counter.
|
| + |
| } |
| if (!Traits::Is64Bit && Dest->getType() == IceType_i64) { |
| // These x86-32 helper-call-involved instructions are lowered in this |