[llvm] [SimpleLoopUnswitch] Keep one PHI when removing a predecessor of a BB (PR #116813)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 09:27:39 PST 2024
https://github.com/nikic requested changes to this pull request.
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.
https://github.com/llvm/llvm-project/pull/116813
More information about the llvm-commits
mailing list