[PATCH] D146629: [SimplifyCFG][LICM] Preserve nonnull, range and align metadata when speculating
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 6 09:18:11 PDT 2023
nikic added a comment.
Reduced to a miscompile in GVN:
declare void @use(i64)
define void @test(ptr %p) {
%val = load ptr, ptr %p, align 8, !nonnull !{}
%val.int = ptrtoint ptr %val to i64
%val2 = load i64, ptr %p, align 8
call void @use(i64 %val.int)
call void @use(i64 %val2)
ret void
}
; RUN: opt -passes=gvn < %s
define void @test(ptr %p) {
%val = load ptr, ptr %p, align 8, !nonnull !0
%val.int = ptrtoint ptr %val to i64
call void @use(i64 %val.int)
call void @use(i64 %val.int)
ret void
}
I believe the problem here is that this goes through VNCoercion and the replacement we do is not with a plain load, but a ptrtoint cast of the load. As such, we end up not performing the combineMetadataForCSE adjustment.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146629/new/
https://reviews.llvm.org/D146629
More information about the llvm-commits
mailing list