[PATCH] D64142: [SLP] try to create vector loads from bitcasted scalar pointers

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 12:56:43 PDT 2019


spatel added a comment.

In D64142#1568977 <https://reviews.llvm.org/D64142#1568977>, @vporpo wrote:

> Isn't this something that should be pattern-matched in instcombine/codegen and not in SLP?


Great question. I've been wondering how to solve PR16739 for about 5 years now! Here are my current answers:

1. It's not possible for instcombine to create vector loads from scalar loads because we have no legality/cost model there. In fact, we have a request to do an opposing transform in instcombine in PR42424:

https://bugs.llvm.org/show_bug.cgi?id=42424 (but as I said there, I don't think instcombine is allowed to do that transform either)

2. It is possible to handle the most basic case in DAGCombiner, but it requires propagating the dereferenceable attribute/metadata through the transition from IR to the SDAG. There's partial precedence for that, but I'm not sure if it's enough to handle the general case. The disadvantage of waiting that long is that we may miss IR-based (instcombine) transforms and then have to recreate those in SDAG.



> What I mean is that if we have multiple of these loads, then this transformation should obviously be performed by the vectorizer. But if we only have one scalar load, then it looks a bit odd to do it in SLP.

Yes, I'd like to extend this to handle the >1 load case, but I was starting with the minimal pattern and hoping to build on that. I'm imagining that if we have >1 load from a base pointer, then we'll group those together and create a sequence of extracts from a single vector load. If I need to show that as part of the initial patch, I'll extend this patch now.


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

https://reviews.llvm.org/D64142





More information about the llvm-commits mailing list