[SROA] rewritePartition()/findCommonType(): if uses have conflicting type, try getTyp...
authorRoman Lebedev <lebedev.ri@gmail.com>
Wed, 7 Oct 2020 06:17:23 +0000 (09:17 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Wed, 7 Oct 2020 06:20:19 +0000 (09:20 +0300)
commit7fa503ef4aaddc1c31dd36d970aa6609383e1718
tree0788d5530acf9cfe9c7f3ceda7b2f97cab1e9e6b
parentedd71db38b0c2292e6a36fb789a3ec3cbde6a023
[SROA] rewritePartition()/findCommonType(): if uses have conflicting type, try getTypePartition() before falling back to largest integral use type (PR47592)

And another step towards transformss not introducing inttoptr and/or
ptrtoint casts that weren't there already.

In this case, when load/store uses have conflicting types,
instead of falling back to the iN, we can try to use allocated sub-type.
As disscussed, this isn't the best idea overall (we shouldn't rely on
allocated type), but it works fine as a temporary measure.

I've measured, and @ `-O3` as of vanilla llvm test-suite + RawSpeed,
this results in +0.05% more bitcasts, -5.51% less inttoptr
and -1.05% less ptrtoint (at the end of middle-end opt pipeline)

See https://bugs.llvm.org/show_bug.cgi?id=47592

Reviewed By: efriedma

Differential Revision: https://reviews.llvm.org/D88788
llvm/lib/Transforms/Scalar/SROA.cpp
llvm/test/DebugInfo/ARM/sroa-complex.ll
llvm/test/Transforms/SROA/ppcf128-no-fold.ll
llvm/test/Transforms/SROA/preserve-nonnull.ll