summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorYury Gribov <y.gribov@samsung.com>2015-12-01 11:40:55 +0000
committerYury Gribov <y.gribov@samsung.com>2015-12-01 11:40:55 +0000
commitd7dbb66eb8fbcc73891aca2bef750d6e5f1faf98 (patch)
treeb10e85909d2c0a0500be275e7f4b94850ae95d55 /llvm/test
parentdf55f522bd6eb42e81c5723375ac329dc3aa97be (diff)
downloadbcm5719-llvm-d7dbb66eb8fbcc73891aca2bef750d6e5f1faf98.tar.gz
bcm5719-llvm-d7dbb66eb8fbcc73891aca2bef750d6e5f1faf98.zip
Introduce new @llvm.get.dynamic.area.offset.i{32, 64} intrinsics.
The @llvm.get.dynamic.area.offset.* intrinsic family is used to get the offset from native stack pointer to the address of the most recent dynamic alloca on the caller's stack. These intrinsics are intendend for use in combination with @llvm.stacksave and @llvm.restore to get a pointer to the most recent dynamic alloca. This is useful, for example, for AddressSanitizer's stack unpoisoning routines. Patch by Max Ostapenko. Differential Revision: http://reviews.llvm.org/D14983 llvm-svn: 254404
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/CodeGen/PowerPC/dyn-alloca-offset.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/PowerPC/dyn-alloca-offset.ll b/llvm/test/CodeGen/PowerPC/dyn-alloca-offset.ll
new file mode 100644
index 00000000000..7159b9da736
--- /dev/null
+++ b/llvm/test/CodeGen/PowerPC/dyn-alloca-offset.ll
@@ -0,0 +1,21 @@
+; RUN: llc -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 < %s | FileCheck %s
+target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64"
+target triple = "powerpc64-unknown-linux-gnu"
+
+declare i64 @llvm.get.dynamic.area.offset.i64()
+
+declare i64 @bar(i64)
+
+attributes #0 = { nounwind }
+
+; Function Attrs: nounwind sanitize_address uwtable
+define signext i64 @foo(i32 signext %N, i32 signext %M) #0 {
+ %1 = alloca i64, align 32
+ %dynamic_area_offset = call i64 @llvm.get.dynamic.area.offset.i64()
+ %2 = call i64 @bar(i64 %dynamic_area_offset)
+ ret i64 %2
+
+; CHECK-DAG: li [[REG1:[0-9]+]], 112
+; CHECK: blr
+
+}
OpenPOWER on IntegriCloud