[PATCH] D36104: [AArch64] Coalesce Copy Zero during instruction selection

Geoff Berry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 13:15:10 PDT 2017


gberry added inline comments.


================
Comment at: lib/Target/AArch64/AArch64ISelDAGToDAG.cpp:2767
   case ISD::Constant: {
-    // Materialize zero constants as copies from WZR/XZR.  This allows
-    // the coalescer to propagate these into other instructions.
+    // If all uses of zero constants are copies to virutal regs, replace the
+    // conatants with WZR/XZR.  Otherwise, materialize zero constants as copies
----------------
Would it not make sense to replace any use of constant 0 with wzr/xzr when it is legal?


================
Comment at: test/CodeGen/AArch64/arm64-addr-type-promotion.ll:31
 ; CHECK-NEXT: ldrb [[LOADEDVAL4:w[0-9]+]], {{\[}}[[BLOCKBASE2]], #2]
+; CHECK-NEXT: mov w0, wzr
 ; CHECK-NEXT: cmp [[LOADEDVAL3]], [[LOADEDVAL4]]
----------------
haicheng wrote:
> gberry wrote:
> > Is this a regression?
> This corresponds to block if.end25.  Do you think it is better to create a new block to sink mov wzr here?  I think neither sinking or not is a clear win since it depends on which path the control flow takes.  Also, the cost of mov wzr can be as cheap as zero.   So, I am bias to keep the current CFG.
That seems fine, it just wasn't clear from the CHECK diffs if this was a new 'mov'


Repository:
  rL LLVM

https://reviews.llvm.org/D36104





More information about the llvm-commits mailing list