[llvm] [LICM] allow MemoryAccess creation failure (PR #116813)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 14:52:42 PST 2024
DianQK wrote:
> If I understand correctly, you're basically trying to fix this problem by preventing simplifications that may make a call `memory(none)` from occurring. This is definitely not a battle you can win :) SimpleLoopUnswitch is not the only pass that can do such simplifications. LoopInstSimplify is usually the easier way to produce such cases.
>
> The more robust way to fix this is, when creating a new memory access that is essentially a clone of an existing one, to pass CreationMustSucceed=false to createDefinedAccess() and then handle no access being created.
>
> The relevant code here (
>
> https://github.com/llvm/llvm-project/blob/0611a668d1389c8573e83eeafa6d5f6172c4cbc2/llvm/lib/Transforms/Scalar/LICM.cpp#L1468
> ) already handles no access being created, but the API it goes through (createMemoryAccessInBB) currently doesn't have the CreationMustSucceed flag, so you'll have to add it first.
That was my initial thought. But, as I kept digging into the root cause of the failure, I noticed the MemorySSA being outdated. Then, I found that many calls to `removePredecessor(BB, /*KeepOneInputPHIs*/ true)` so I made this somewhat wired PR. Upon reconsideration, I realized I could think this outdated result as a conservative analysis result.
https://github.com/llvm/llvm-project/pull/116813
More information about the llvm-commits
mailing list