[llvm] 87e3646 - [AArch64][GlobalISel] Add undef combines to postlegalizer combiner.

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 09:22:16 PDT 2022


Author: Amara Emerson
Date: 2022-05-05T09:22:08-07:00
New Revision: 87e3646a1f8addc18339a3b1c8bcb480c5339cd7

URL: https://github.com/llvm/llvm-project/commit/87e3646a1f8addc18339a3b1c8bcb480c5339cd7
DIFF: https://github.com/llvm/llvm-project/commit/87e3646a1f8addc18339a3b1c8bcb480c5339cd7.diff

LOG: [AArch64][GlobalISel] Add undef combines to postlegalizer combiner.

Added: 
    llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-undef.mir

Modified: 
    llvm/lib/Target/AArch64/AArch64Combine.td

Removed: 
    llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-store-undef.mir


################################################################################
diff  --git a/llvm/lib/Target/AArch64/AArch64Combine.td b/llvm/lib/Target/AArch64/AArch64Combine.td
index 1994e0eb7fb98..18c111255e538 100644
--- a/llvm/lib/Target/AArch64/AArch64Combine.td
+++ b/llvm/lib/Target/AArch64/AArch64Combine.td
@@ -217,7 +217,7 @@ def AArch64PostLegalizerLoweringHelper
 // Post-legalization combines which are primarily optimizations.
 def AArch64PostLegalizerCombinerHelper
     : GICombinerHelper<"AArch64GenPostLegalizerCombinerHelper",
-                       [copy_prop, erase_undef_store, combines_for_extload,
+                       [copy_prop, combines_for_extload,
                         sext_trunc_sextload, mutate_anyext_to_zext,
                         hoist_logic_op_with_same_opcode_hands,
                         redundant_and, xor_of_and_with_same_reg,
@@ -228,6 +228,6 @@ def AArch64PostLegalizerCombinerHelper
                         select_combines, fold_merge_to_zext,
                         constant_fold, identity_combines,
                         ptr_add_immed_chain, overlapping_and,
-                        split_store_zero_128]> {
+                        split_store_zero_128, undef_combines]> {
   let DisableRuleOption = "aarch64postlegalizercombiner-disable-rule";
 }

diff  --git a/llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-store-undef.mir b/llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-undef.mir
similarity index 52%
rename from llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-store-undef.mir
rename to llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-undef.mir
index 27e9b5c1f4523..085a6694995ff 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-store-undef.mir
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/postlegalizer-combiner-undef.mir
@@ -15,11 +15,32 @@ body:             |
 
     ; CHECK-LABEL: name: delete_store_undef
     ; CHECK: liveins: $x0
-    ; CHECK-NOT: G_STORE
-    ; CHECK: RET_ReallyLR
+    ; CHECK-NEXT: {{  $}}
+    ; CHECK-NEXT: RET_ReallyLR
     %0:_(p0) = COPY $x0
     %1:_(s32) = G_IMPLICIT_DEF
     G_STORE %1(s32), %0(p0) :: (store (s32))
     RET_ReallyLR
 
 ...
+---
+name:            delete_add_undef
+legalized:       true
+tracksRegLiveness: true
+body:             |
+  bb.1.entry:
+    liveins: $x0
+
+    ; CHECK-LABEL: name: delete_add_undef
+    ; CHECK: liveins: $x0
+    ; CHECK-NEXT: {{  $}}
+    ; CHECK-NEXT: [[DEF:%[0-9]+]]:_(s64) = G_IMPLICIT_DEF
+    ; CHECK-NEXT: $x0 = COPY [[DEF]](s64)
+    ; CHECK-NEXT: RET_ReallyLR
+    %0:_(s64) = COPY $x0
+    %1:_(s64) = G_IMPLICIT_DEF
+    %add:_(s64) = G_ADD %0(s64), %1(s64)
+    $x0 = COPY %add
+    RET_ReallyLR
+
+...


        


More information about the llvm-commits mailing list