[PATCH] D100717: [InstCombine] Transform memcpy to ptr load/stores if TBAA says so
Juneyoung Lee via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 26 17:40:37 PDT 2021
aqjune added a comment.
In D100717#2713553 <https://reviews.llvm.org/D100717#2713553>, @penzn wrote:
> Aside from may be generic pointer handling, I am not super comfortable in baking this kind of logic into the backend and would be interested in finding a better solution in the long run. Though the challenge is that different source languages have completely unrelated pointer rules, which would require different heuristics.
I think the underlying problem is that there are only two options of types when canonicalizing memcpy/load/store: either integer type or pointer type.
Once it is canonicalized into one of these two, memory accesses with another type requires introduction of casting that is not easy to be removed due to the miscompilation issues.
In D100717#2716900 <https://reviews.llvm.org/D100717#2716900>, @fhahn wrote:
> But my suggestion/question is the other way around: check if a pointer is used to load a pointer instead of checking if `tbaa` claims it should be treated as pointer.
Well, actually this sounds like a great idea... Let me check whether it works.
In D100717#2716812 <https://reviews.llvm.org/D100717#2716812>, @lebedev.ri wrote:
> @aqjune please can you prepare the same change for SROA?
I'm not familiar with SROA, but will try.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100717/new/
https://reviews.llvm.org/D100717
More information about the llvm-commits
mailing list