[PATCH] D93927: [ArgPromotion] Copy !range metadata for loads.
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 26 14:04:21 PDT 2021
nikic reopened this revision.
nikic added a comment.
This revision is now accepted and ready to land.
Here is a further reduction:
define i32* @caller(i1 %c, i32** dereferenceable(8) %arg) {
%p = call i32* @func(i1 %c, i32** dereferenceable(8) %arg)
ret i32* %p
}
define internal i32* @func(i1 %c, i32** dereferenceable(8) %arg) {
bb:
br i1 %c, label %if, label %else
if:
%p = load i32*, i32** %arg, align 8, !nonnull !{}
ret i32* %p
else:
ret i32* null
}
It's okay to promote the load, because the pointer is dereferenceable, but it's not okay to transfer the metadata. There are two pre-existing bugs in this respect: We were already transfering the AA metadata, which is also incorrect. And we were transferring the load alignment (this probably shouldn't be transferred at all but rather a precondition). We can only transfer metadata if the load is guaranteed-to-execute from the entry of the function.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93927/new/
https://reviews.llvm.org/D93927
More information about the llvm-commits
mailing list