summaryrefslogtreecommitdiff
path: root/test/LTO
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2016-11-08 21:53:35 +0000
committerTeresa Johnson <tejohnson@google.com>2016-11-08 21:53:35 +0000
commit92bee0fe987bf0e8e7e74bdafc7eb20eed8a5dc0 (patch)
treec32f405ae4ba8f61a0958e2de3a5de6bd47e4dd1 /test/LTO
parent4f349ace2b812688edfb3fe303c328074e28ac36 (diff)
[ThinLTO] Prevent exporting of locals used/defined in module level asm
Summary: This patch uses the same approach added for inline asm in r285513 to similarly prevent promotion/renaming of locals used or defined in module level asm. All static global values defined in normal IR and used in module level asm should be included on either the llvm.used or llvm.compiler.used global. The former were already being flagged as NoRename in the summary, and I've simply added llvm.compiler.used values to this handling. Module level asm may also contain defs of values. We need to prevent export of any refs to local values defined in module level asm (e.g. a ref in normal IR), since that also requires renaming/promotion of the local. To do that, the summary index builder looks at all values in the module level asm string that are not marked Weak or Global, which is exactly the set of locals that are defined. A summary is created for each of these local defs and flagged as NoRename. This required adding handling to the BitcodeWriter to look at GV declarations to see if they have a summary (rather than skipping them all). Finally, added an assert to IRObjectFile::CollectAsmUndefinedRefs to ensure that an MCAsmParser is available, otherwise the module asm parse would silently fail. Initialized the asm parser in the opt tool for use in testing this fix. Fixes PR30610. Reviewers: mehdi_amini Subscribers: johanengelen, krasin, llvm-commits Differential Revision: https://reviews.llvm.org/D26146 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286297 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/LTO')
-rw-r--r--test/LTO/X86/current-section.ll3
1 files changed, 3 insertions, 0 deletions
diff --git a/test/LTO/X86/current-section.ll b/test/LTO/X86/current-section.ll
index 49eee49ae62..69f8bfaac3b 100644
--- a/test/LTO/X86/current-section.ll
+++ b/test/LTO/X86/current-section.ll
@@ -2,4 +2,7 @@
; RUN: llvm-lto -o %t2 %t1
; REQUIRES: default_triple
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "x86_64-unknown-linux-gnu"
+
module asm ".align 4"