xref: /llvm-project/llvm/test/CodeGen/X86/fake-use-zero-length.ll (revision 822f74a91106b7ca10e85508eb642e62ef945afa)
1; RUN: llc < %s -stop-after=finalize-isel -mtriple=x86_64-unknown-linux | FileCheck %s --implicit-check-not=FAKE_USE
2;
3; Make sure SelectionDAG does not crash handling fake uses of zero-length arrays
4; and structs. Check also that they are not propagated.
5;
6; Generated from the following source with
7; clang -fextend-variable-liveness -S -emit-llvm -O2 -mllvm -stop-after=safe-stack -o test.mir test.cpp
8;
9; int main ()
10; { int array[0]; }
11;
12;
13; CHECK: liveins: $[[IN_REG:[a-zA-Z0-9]+]]
14; CHECK: %[[IN_VREG:[a-zA-Z0-9]+]]:gr32 = COPY $[[IN_REG]]
15; CHECK: FAKE_USE %[[IN_VREG]]
16
17source_filename = "test.ll"
18target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19
20define hidden i32 @main([0 x i32] %zero, [1 x i32] %one) local_unnamed_addr optdebug {
21entry:
22  notail call void (...) @bar([0 x i32] %zero)
23  notail call void (...) @baz([1 x i32] %one)
24  notail call void (...) @llvm.fake.use([0 x i32] %zero)
25  notail call void (...) @llvm.fake.use([1 x i32] %one)
26  ret i32 0
27}
28
29declare void @bar([0 x i32] %a)
30declare void @baz([1 x i32] %a)
31