xref: /llvm-project/llvm/test/Transforms/DeadArgElim/NoundefAttrs.ll (revision 055fb7795aa219a3d274d280ec9129784f169f56)
1; RUN: opt -passes=deadargelim -S < %s | FileCheck %s
2
3; If caller is changed to pass in poison, noundef, dereferenceable and other
4; attributes that imply immediate undefined behavior must be deleted.
5; Other attributes like nonnull, which only imply poison, can be safely kept.
6
7; CHECK:   define i64 @bar(ptr nonnull %0, i64 %1)
8define i64 @bar(ptr nonnull dereferenceable(8) %0, i64 %1) {
9entry:
10  %2 = add i64 %1, 8
11  ret i64 %2
12}
13
14define i64 @foo(ptr %p, i64 %v) {
15; CHECK:   %retval = call i64 @bar(ptr nonnull poison, i64 %v)
16  %retval = call i64 @bar(ptr nonnull dereferenceable(8) %p, i64 %v)
17  ret i64 %retval
18}
19