[PATCH] D106242: [Inline] Fix noalias addition on simplified instructions (PR50589)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 18 11:28:44 PDT 2021
nikic created this revision.
nikic added reviewers: jeroen.dobbelaere, jdoerfert.
Herald added a subscriber: hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
When adding noalias/alias.scope metadata, we analyze the instructions of the original callee, and then place metadata on the corresponding inlined instructions in the caller as provided by VMap. However, this assumes that this actually a clone of the instruction, rather than the result of simplification. If simplification occurred, the instruction that VMap points to may not have any relationship as far as ModRef behavior is concerned.
Fix this by tracking simplified instructions during cloning and then only processing instructions that have not been simplified. This is done with an additional map form original to cloned instruction, into which we only insert if no simplification is performed. The mapping in VMap can then be compared to this map. If they're the same, the instruction hasn't been simplified. (I originally wanted to only track a set of simplified instructions, but that wouldn't work if the instruction only gets simplified afterwards, e.g. based on rewritten phis.)
Fixes https://bugs.llvm.org/show_bug.cgi?id=50589.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D106242
Files:
llvm/include/llvm/Transforms/Utils/Cloning.h
llvm/lib/Transforms/Utils/CloneFunction.cpp
llvm/lib/Transforms/Utils/InlineFunction.cpp
llvm/test/Transforms/Inline/pr50589.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D106242.359641.patch
Type: text/x-patch
Size: 4915 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210718/3738ca29/attachment.bin>
More information about the llvm-commits
mailing list