[llvm-commits] [llvm] r126191 - in /llvm/trunk: lib/Target/ARM/ARMSubtarget.cpp test/CodeGen/ARM/available_externally.ll

Evan Cheng evan.cheng at apple.com
Mon Feb 21 22:58:35 PST 2011


Author: evancheng
Date: Tue Feb 22 00:58:34 2011
New Revision: 126191

URL: http://llvm.org/viewvc/llvm-project?rev=126191&view=rev
Log:
available_externally (hidden or not) GVs are always accessed via stubs. rdar://9027648.

Added:
    llvm/trunk/test/CodeGen/ARM/available_externally.ll
Modified:
    llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp?rev=126191&r1=126190&r2=126191&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMSubtarget.cpp Tue Feb 22 00:58:34 2011
@@ -171,7 +171,9 @@
 
   // Materializable GVs (in JIT lazy compilation mode) do not require an extra
   // load from stub.
-  bool isDecl = GV->isDeclaration() && !GV->isMaterializable();
+  bool isDecl = GV->hasAvailableExternallyLinkage();
+  if (GV->isDeclaration() && !GV->isMaterializable())
+    isDecl = true;
 
   if (!isTargetDarwin()) {
     // Extra load is needed for all externally visible.

Added: llvm/trunk/test/CodeGen/ARM/available_externally.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/available_externally.ll?rev=126191&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/available_externally.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/available_externally.ll Tue Feb 22 00:58:34 2011
@@ -0,0 +1,16 @@
+; RUN: llc < %s -mtriple=arm-apple-darwin -relocation-model=pic | FileCheck %s
+; rdar://9027648
+
+ at A = available_externally hidden constant i32 1
+ at B = external hidden constant i32
+
+define i32 @t1() {
+  %tmp = load i32* @A
+  store i32 %tmp, i32* @B
+  ret i32 %tmp
+}
+
+; CHECK:      L_A$non_lazy_ptr:
+; CHECK-NEXT: .long _A
+; CHECK:      L_B$non_lazy_ptr:
+; CHECK-NEXT: .long _B





More information about the llvm-commits mailing list