[PATCH] D138766: [InstCombine] If loading from small alloca, load whole alloca and perform variable extraction
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 8 06:24:56 PST 2022
nikic added inline comments.
================
Comment at: llvm/test/Transforms/InstCombine/widen-load-of-small-alloca.ll:111
+; CHECK-BE-32-NEXT: call void @use.v1i8(<1 x i8> [[TMP1]])
+; CHECK-BE-32-NEXT: ret void
;
----------------
As far as I can tell, this transform can only ever be profitable if we actually do end up promoting the alloca. In your tests here this is not going to happen because the pointer escapes. In this case, we just end up replacing a simple load with a complex large load and extract pattern. That's generally going to be a pretty significant regression, no?
So I think promotion has to be a pre-condition for the transform, in which case this might potentially fit into SROA? Basically allow a whole-alloca promotion by rewriting the dynamic offset access in terms of operations like these. Not sure how well that would work in practice, and of course that leaves the cost modelling question.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D138766/new/
https://reviews.llvm.org/D138766
More information about the llvm-commits
mailing list