[llvm] r273457 - Start using shouldAssumeDSOLocal on Hexagon.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 22 12:09:14 PDT 2016
Author: rafael
Date: Wed Jun 22 14:09:14 2016
New Revision: 273457
URL: http://llvm.org/viewvc/llvm-project?rev=273457&view=rev
Log:
Start using shouldAssumeDSOLocal on Hexagon.
Include a token test showing that access to private is now the same as
to internal.
Added:
llvm/trunk/test/CodeGen/Hexagon/pic-local.ll
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp?rev=273457&r1=273456&r2=273457&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.cpp Wed Jun 22 14:09:14 2016
@@ -17,6 +17,7 @@
#include "HexagonSubtarget.h"
#include "HexagonTargetMachine.h"
#include "HexagonTargetObjectFile.h"
+#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -1503,8 +1504,8 @@ HexagonTargetLowering::LowerGLOBALADDRES
return DAG.getNode(HexagonISD::CONST32, dl, PtrVT, GA);
}
- bool UsePCRel = GV->hasInternalLinkage() || GV->hasHiddenVisibility() ||
- (GV->hasLocalLinkage() && !isa<Function>(GV));
+ const Triple &TargetTriple = HTM.getTargetTriple();
+ bool UsePCRel = shouldAssumeDSOLocal(RM, TargetTriple, *GV->getParent(), GV);
if (UsePCRel) {
SDValue GA = DAG.getTargetGlobalAddress(GV, dl, PtrVT, Offset,
HexagonII::MO_PCREL);
Added: llvm/trunk/test/CodeGen/Hexagon/pic-local.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Hexagon/pic-local.ll?rev=273457&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/Hexagon/pic-local.ll (added)
+++ llvm/trunk/test/CodeGen/Hexagon/pic-local.ll Wed Jun 22 14:09:14 2016
@@ -0,0 +1,19 @@
+; RUN: llc -march=hexagon -mcpu=hexagonv5 -relocation-model=pic < %s | FileCheck %s
+
+define private void @f1() {
+ ret void
+}
+
+define internal void @f2() {
+ ret void
+}
+
+define void()* @get_f1() {
+ ; CHECK: r0 = add(pc, ##.Lf1 at PCREL)
+ ret void()* @f1
+}
+
+define void()* @get_f2() {
+ ; CHECK: r0 = add(pc, ##f2 at PCREL)
+ ret void()* @f2
+}
More information about the llvm-commits
mailing list