[PATCH] D138186: InstCombine: Simplify vector load based on demanded elements

Ruiling, Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 17 05:11:13 PST 2022


ruiling added a comment.

In D138186#3933180 <https://reviews.llvm.org/D138186#3933180>, @piotr wrote:

> I've always thought we didn't have such a transformation in the generic instcombine, because it may hurt some targets, but I don't immediately see how. (We do have a similar one for intrinsic loads in the AMDGPU-specific file).

For X86, the vector load will be scalarized, thus it is easy to be optimized during instruction selection or later on MachineIR. I guess this may contribute to why we were not doing such optimization before. I could not see why this would hurt other targets.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1716
+      InsertNewInstWith(NewPtr, *LI);
+    InsertNewInstWith(NewLI, *LI);
+    InsertNewInstWith(NewI, *LI);
----------------
piotr wrote:
> Should the original load be replaced rather than kept around?
The original load becomes dead and will be deleted afterwards in this pass.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138186



More information about the llvm-commits mailing list