xref: /llvm-project/llvm/test/Transforms/GVN/2009-11-12-MemDepMallocBitCast.ll (revision 23abf931386002fb9d2c11d026846475c224c641)
1; Test to make sure malloc's bitcast does not block detection of a store
2; to aliased memory; GVN should not optimize away the load in this program.
3; RUN: opt < %s -passes=gvn -S | FileCheck %s
4
5define i64 @test() {
6  %1 = tail call ptr @malloc(i64 mul (i64 4, i64 ptrtoint (ptr getelementptr (i64, ptr null, i64 1) to i64))) ; <ptr> [#uses=2]
7  store i8 42, ptr %1
8  %Y = load i64, ptr %1                               ; <i64> [#uses=1]
9  ret i64 %Y
10; CHECK: %Y = load i64, ptr %1
11; CHECK: ret i64 %Y
12}
13
14declare noalias ptr @malloc(i64)
15