aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-11-18 21:08:54 +0100
committerNikita Popov <nikita.ppv@gmail.com>2020-11-18 21:22:50 +0100
commitf4a3969bffceac2df4bee10992ea48136122cae0 (patch)
tree615d6cc6a6c9cb6878c441edb6d78dcc31b98ec0 /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent0dca0b7034281015cfffb3c91fc89c53b220dc49 (diff)
downloadllvm-f4a3969bffceac2df4bee10992ea48136122cae0.zip
llvm-f4a3969bffceac2df4bee10992ea48136122cae0.tar.gz
llvm-f4a3969bffceac2df4bee10992ea48136122cae0.tar.bz2
[Inline] Fix incorrectly dropped noalias metadata
This is the same fix as 23aeadb89df38406dc4d929d08286f7ce31040eb, just for CloneScopedAliasMetadata rather than PropagateCallSiteMetadata. In this case the previous outcome was incorrectly dropped metadata, as it was not part of the computed metadata map. The real change in the test is that the first load now retains metadata, the rest of the changes are due to changes in metadata numbering.
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index c16433c..b148f45 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -892,7 +892,9 @@ static void CloneAliasScopeMetadata(CallBase &CB, ValueToValueMapTy &VMap) {
// repacements from the map.
for (ValueToValueMapTy::iterator VMI = VMap.begin(), VMIE = VMap.end();
VMI != VMIE; ++VMI) {
- if (!VMI->second)
+ // Check that key is an instruction, to skip the Argument mapping, which
+ // points to an instruction in the original function, not the inlined one.
+ if (!VMI->second || !isa<Instruction>(VMI->first))
continue;
Instruction *NI = dyn_cast<Instruction>(VMI->second);