summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/FunctionAttrs
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-12-08 19:01:00 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-12-08 19:01:00 +0000
commit235c275b20d44e3aeb8bfe98dc34b2ead704bf32 (patch)
tree538eadab86e6bfd2ee1a401abcfe3c67355524ae /llvm/test/Transforms/FunctionAttrs
parentaa4f4450af0b6e5406189679713b61f225d0ab1b (diff)
downloadbcm5719-llvm-235c275b20d44e3aeb8bfe98dc34b2ead704bf32.tar.gz
bcm5719-llvm-235c275b20d44e3aeb8bfe98dc34b2ead704bf32.zip
IR, X86: Understand !absolute_symbol metadata on global variables.
Summary: Attaching !absolute_symbol to a global variable does two things: 1) Marks it as an absolute symbol reference. 2) Specifies the value range of that symbol's address. Teach the X86 backend to allow absolute symbols to appear in place of immediates by extending the relocImm and mov64imm32 matchers. Start using relocImm in more places where it is legal. As previously proposed on llvm-dev: http://lists.llvm.org/pipermail/llvm-dev/2016-October/105800.html Differential Revision: https://reviews.llvm.org/D25878 llvm-svn: 289087
Diffstat (limited to 'llvm/test/Transforms/FunctionAttrs')
-rw-r--r--llvm/test/Transforms/FunctionAttrs/nonnull-global.ll10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull-global.ll b/llvm/test/Transforms/FunctionAttrs/nonnull-global.ll
new file mode 100644
index 00000000000..43353e82270
--- /dev/null
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull-global.ll
@@ -0,0 +1,10 @@
+; RUN: opt -S -functionattrs %s | FileCheck %s
+
+@a = external global i8, !absolute_symbol !0
+
+; CHECK-NOT: define nonnull
+define i8* @foo() {
+ ret i8* @a
+}
+
+!0 = !{i64 0, i64 256}
OpenPOWER on IntegriCloud