[llvm] [DSE] Consider the aliasing through global variable while checking clobber (PR #120044)
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 16 15:13:23 PST 2024
================
@@ -299,3 +313,23 @@ define i16 @large_p2_may_or_partial_alias_caller2(ptr %base1, ptr %base2) {
ret i16 %l
}
+ at g = global i16 123, align 2
+
+declare void @read_global(ptr nocapture noundef initializes((0, 2)))
+ memory(read, argmem: write, inaccessiblemem: none) nounwind
+
+define i16 @global_var_alias() {
+; CHECK-LABEL: @global_var_alias(
+; CHECK-NEXT: store i32 0, ptr @g, align 4
+; CHECK-NEXT: [[G_ADDR:%.*]] = getelementptr i32, ptr @g, i64 1
+; CHECK-NEXT: call void @read_global(ptr [[G_ADDR]])
+; CHECK-NEXT: [[L:%.*]] = load i16, ptr @g, align 2
+; CHECK-NEXT: ret i16 [[L]]
+;
+ store i32 0, ptr @g, align 4
----------------
aeubanks wrote:
isn't this storing an i32 value to an i16 global? and the gep is out of bounds?
https://github.com/llvm/llvm-project/pull/120044
More information about the llvm-commits
mailing list