[PATCH] D29344: [AArch64] Extend redundant copy elimination pass to handle non-zero stores.

Chad Rosier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 22 09:35:54 PST 2017


mcrosier marked 5 inline comments as done.
mcrosier added inline comments.


================
Comment at: lib/Target/AArch64/AArch64RedundantCopyElimination.cpp:283
+    //     ret
+    if (MI->isMoveImmediate() && MI->getOperand(0).isReg() &&
+        MI->getOperand(1).isImm()) {
----------------
mcrosier wrote:
> junbuml wrote:
> > junbuml wrote:
> > > The comment in MachineInstr.h mention that isMoveImmediate() return true for a move immediate (including conditional moves).  I think the conditional move is not the case for AArch64, but just want to double confirm. 
> > We can move KnownRegVal in line 283.  It seems that both ZeroRegVal and KnownRegVal cannot be true at the same time.  Then we can use if-else, instead of if-if.
> For AArch64, only the MOVi32imm and MOVi64imm pseudos will return true for isMoveImmediate() and these instructions are unconditionally executed.
I hoisted the ZeroRegVal and KnownRegVal to the outer checks, but left the code as an if-if, rather thank if-else to reduce indention.  Let me know if you strongly prefer the the if-else and I'll happily 


https://reviews.llvm.org/D29344





More information about the llvm-commits mailing list