[PATCH] D140965: [GlobalISel] Add G_BUILD_VECTOR[_TRUNC] to CSE

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 02:09:32 PST 2023


foad added inline comments.


================
Comment at: llvm/test/CodeGen/AArch64/GlobalISel/prelegalizer-combiner-mulo-zero.mir:91
+    ; CHECK-NEXT: %zero_vec:_(<2 x s64>) = G_BUILD_VECTOR %zero(s64), %zero(s64)
+    ; CHECK-NEXT: %mulo:_(<2 x s64>) = COPY %zero_vec(<2 x s64>)
     ; CHECK-NEXT: [[C:%[0-9]+]]:_(s1) = G_CONSTANT i1 false
----------------
rovka wrote:
> foad wrote:
> > What happened here?
> Well, my hypothesis is that:
> Without CSE for G_BUILD_VECTOR, we replace the G_UMULO with a brand new G_BUILD_VECTOR, thus leaving the already existing G_BUILD_VECTOR (%zero_vec) without a use, so it just gets removed.
> With CSE enabled, when we try to build the new G_BUILD_VECTOR for our combine, we notice we already have one and just copy it, so now it has a use and can't be dropped. I'm not sure why we don't notice that we can use it directly instead of copying though.
> I could dig deeper into this, unless we have some code elsewhere in the pipeline that gets rid of redundant copies?
There is a "copy_prop" combine that should do that, and AArch64PreLegalizerCombiner runs "all_combines", so I don't understand why it's not happening.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D140965/new/

https://reviews.llvm.org/D140965



More information about the llvm-commits mailing list