[llvm] [InstCombine] Fold align assume into load's !align metadata if possible. (PR #108958)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 17 13:27:34 PDT 2024


fhahn wrote:

> Based on https://github.com/dtcxzyw/llvm-opt-benchmark/pull/1320/files it looks like we end up losing the alignment information in ~most cases? Presumably because SROA later comes along and removes the load.
> 
> Note that for the existing non-null handling, SROA will actually rematerialize the nonnull assumption. But I'm reasonably confident that doing that for `!align` would have terrible effects, at least for frontends that use `!align` a lot.

Ah that is an unfortunate! For the particular case @dtcxzyw shared, looks like the issue is `early-cse`: https://llvm.godbolt.org/z/KfacPbzf7

Maybe for that case it would be sufficient to have early-cse re-materialize the assumption when CSE'ing an instruction with !align metadata that cannot be preserved.

https://github.com/llvm/llvm-project/pull/108958


More information about the llvm-commits mailing list