llvm-project/llvm/test/CodeGen/X86/spill-zero-x86_64.ll

76 lines
2.5 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s
; This test checks that we use "movq $0, (%rsp)" to spill a 0 to the stack. It
; was reduced from a larger function.
; CHECK: movq $0, (%rsp) # 8-byte Folded Spill
%struct.foo = type { i8*, i32 }
declare void @pluto()
define void @spam() {
bb:
br label %bb13
bb1: ; preds = %bb18
call void @pluto()
%tmp = getelementptr inbounds %struct.foo, %struct.foo* %tmp20, i64 0, i32 1
%tmp2 = bitcast i32* %tmp to %struct.foo**
store %struct.foo* null, %struct.foo** %tmp2
unreachable
bb3: ; preds = %bb18
call void @pluto()
store i8* %tmp22, i8** undef
unreachable
bb4: ; preds = %bb18
call void @pluto()
br label %bb13
bb5: ; preds = %bb18
%tmp7 = add nsw i32 %tmp23, 1
store i8* %tmp22, i8** undef
unreachable
bb8: ; preds = %bb18
store %struct.foo* %tmp14, %struct.foo** undef
unreachable
bb9: ; preds = %bb18
%tmp10 = load %struct.foo*, %struct.foo** undef
br label %bb13
bb13: ; preds = %bb18, %bb9, %bb4, %bb
%tmp14 = phi %struct.foo* [ %tmp14, %bb18 ], [ %tmp14, %bb4 ], [ null, %bb ], [ %tmp10, %bb9 ]
%tmp15 = phi %struct.foo* [ %tmp26, %bb18 ], [ %tmp26, %bb4 ], [ null, %bb ], [ %tmp26, %bb9 ]
%tmp16 = phi i32 [ %tmp23, %bb18 ], [ %tmp23, %bb4 ], [ 0, %bb ], [ %tmp23, %bb9 ]
br label %bb17
bb17: ; preds = %bb13
br i1 false, label %bb27, label %bb18
bb18: ; preds = %bb17
%tmp19 = load %struct.foo*, %struct.foo** undef
%tmp20 = getelementptr inbounds %struct.foo, %struct.foo* %tmp19, i64 0
%tmp21 = getelementptr inbounds %struct.foo, %struct.foo* %tmp20, i64 0, i32 0
%tmp22 = load i8*, i8** %tmp21
%tmp23 = add nsw i32 %tmp16, -1
%tmp24 = getelementptr inbounds %struct.foo, %struct.foo* %tmp15, i64 0, i32 1
%tmp25 = bitcast i32* %tmp24 to %struct.foo**
%tmp26 = load %struct.foo*, %struct.foo** %tmp25
switch i32 undef, label %bb9 [
i32 1, label %bb1
i32 2, label %bb3
i32 3, label %bb4
i32 4, label %bb5
i32 5, label %bb13
i32 6, label %bb8
]
bb27: ; preds = %bb17
ret void
}