summaryrefslogtreecommitdiffstats
path: root/test/Bitcode
diff options
context:
space:
mode:
authorSean Fertile <sfertile@ca.ibm.com>2017-10-26 15:00:26 +0000
committerSean Fertile <sfertile@ca.ibm.com>2017-10-26 15:00:26 +0000
commit509132b368efed10bbdad825403f45e9cf1d6e38 (patch)
tree0188bf3a173be5db35a9f51aaf443311357eab97 /test/Bitcode
parentb25352f371cca1ddf19a7b0c1db681148da8ac66 (diff)
Represent runtime preemption in the IR.
Currently we do not represent runtime preemption in the IR, which has several drawbacks: 1) The semantics of GlobalValues differ depending on the object file format you are targeting (as well as the relocation-model and -fPIE value). 2) We have no way of disabling inlining of run time interposable functions, since in the IR we only know if a function is link-time interposable. Because of this llvm cannot support elf-interposition semantics. 3) In LTO builds of executables we will have extra knowledge that a symbol resolved to a local definition and can't be preemptable, but have no way to propagate that knowledge through the compiler. This patch adds preemptability specifiers to the IR with the following meaning: dso_local --> means the compiler may assume the symbol will resolve to a definition within the current linkage unit and the symbol may be accessed directly even if the definition is not within this compilation unit. dso_preemptable --> means that the compiler must assume the GlobalValue may be replaced with a definition from outside the current linkage unit at runtime. To ease transitioning dso_preemptable is treated as a 'default' in that low-level codegen will still do the same checks it did previously to see if a symbol should be accessed indirectly. Eventually when IR producers emit the specifiers on all Globalvalues we can change dso_preemptable to mean 'always access indirectly', and remove the current logic. Differential Revision: https://reviews.llvm.org/D20217 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316668 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Bitcode')
-rw-r--r--test/Bitcode/dso_location.ll47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/Bitcode/dso_location.ll b/test/Bitcode/dso_location.ll
new file mode 100644
index 000000000000..4dc9fe24c198
--- /dev/null
+++ b/test/Bitcode/dso_location.ll
@@ -0,0 +1,47 @@
+; RUN: llvm-as < %s | llvm-dis | FileCheck %s
+
+; Tests parsing for the dso_local keyword as well as the serialization/
+; deserialization of the dso_local value on GlobalValues.
+
+@local_global = dso_local global i32 0
+; CHECK: @local_global = dso_local global i32 0
+
+@weak_local_global = weak dso_local global i32 0
+; CHECK: @weak_local_global = weak dso_local global i32 0
+
+@external_local_global = external dso_local global i32
+; CHECK: @external_local_global = external dso_local global i32
+
+@default_local_global = dso_local default global i32 0
+; CHECK: @default_local_global = dso_local global i32 0
+
+@hidden_local_global = dso_local hidden global i32 0
+; CHECK: @hidden_local_global = dso_local hidden global i32 0
+
+@protected_local_global = dso_local protected global i32 0
+; CHECK: @protected_local_global = dso_local protected global i32 0
+
+@local_alias = dso_local alias i32, i32* @local_global
+; CHECK-DAG: @local_alias = dso_local alias i32, i32* @local_global
+
+@preemptable_alias = dso_preemptable alias i32, i32* @hidden_local_global
+; CHECK-DAG: @preemptable_alias = alias i32, i32* @hidden_local_global
+
+@preemptable_ifunc = dso_preemptable ifunc void (), i8* ()* @ifunc_resolver
+; CHECK-DAG: @preemptable_ifunc = ifunc void (), i8* ()* @ifunc_resolver
+declare dso_local default void @default_local()
+; CHECK: declare dso_local void @default_local()
+
+declare dso_local hidden void @hidden_local()
+; CHECK: declare dso_local hidden void @hidden_local()
+
+define dso_local protected void @protected_local() {
+; CHECK: define dso_local protected void @protected_local()
+entry:
+ ret void
+}
+
+define i8* @ifunc_resolver() {
+entry:
+ ret i8* null
+}