llvm.org GIT mirror llvm / 5d7afdb
Avoids DCE on write_register git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209222 91177308-0d34-0410-b5e6-96231b3b80d8 Renato Golin 5 years ago
2 changed file(s) with 4 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
252252 def int_read_register : Intrinsic<[llvm_anyint_ty], [llvm_metadata_ty],
253253 [IntrNoMem], "llvm.read_register">;
254254 def int_write_register : Intrinsic<[], [llvm_metadata_ty, llvm_anyint_ty],
255 [IntrNoMem], "llvm.write_register">;
255 [], "llvm.write_register">;
256256
257257 // Note: we treat stacksave/stackrestore as writemem because we don't otherwise
258258 // model their dependencies on allocas.
0 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
11 ; RUN: llc < %s -mtriple=x86_64-linux-gnueabi | FileCheck %s
2 ; RUN: opt < %s -O3 -S -mtriple=x86_64-linux-gnueabi | FileCheck %s --check-prefix=OPT
23
34 define i64 @get_stack() nounwind {
45 entry:
56 ; CHECK-LABEL: get_stack:
67 ; CHECK: movq %rsp, %rax
78 %sp = call i64 @llvm.read_register.i64(metadata !0)
9 ; OPT: @llvm.read_register.i64
810 ret i64 %sp
911 }
1012
1315 ; CHECK-LABEL: set_stack:
1416 ; CHECK: movq %rdi, %rsp
1517 call void @llvm.write_register.i64(metadata !0, i64 %val)
18 ; OPT: @llvm.write_register.i64
1619 ret void
1720 }
1821