mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-02 05:12:20 +00:00
Correctly propagate thread-local flag from aliasee to alias. This fixes PR2137
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48257 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
bfae83139d
commit
4d86e2a6b8
@ -13,6 +13,7 @@
|
||||
|
||||
#include "llvm/CodeGen/SelectionDAG.h"
|
||||
#include "llvm/Constants.h"
|
||||
#include "llvm/GlobalAlias.h"
|
||||
#include "llvm/GlobalVariable.h"
|
||||
#include "llvm/Intrinsics.h"
|
||||
#include "llvm/DerivedTypes.h"
|
||||
@ -814,12 +815,20 @@ SDOperand SelectionDAG::getConstantFP(double Val, MVT::ValueType VT,
|
||||
SDOperand SelectionDAG::getGlobalAddress(const GlobalValue *GV,
|
||||
MVT::ValueType VT, int Offset,
|
||||
bool isTargetGA) {
|
||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
|
||||
unsigned Opc;
|
||||
|
||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
|
||||
if (!GVar) {
|
||||
// If GV is an alias - use aliasee for determing thread-localness
|
||||
if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
|
||||
GVar = dyn_cast_or_null<GlobalVariable>(GA->resolveAliasedGlobal());
|
||||
}
|
||||
|
||||
if (GVar && GVar->isThreadLocal())
|
||||
Opc = isTargetGA ? ISD::TargetGlobalTLSAddress : ISD::GlobalTLSAddress;
|
||||
else
|
||||
Opc = isTargetGA ? ISD::TargetGlobalAddress : ISD::GlobalAddress;
|
||||
|
||||
FoldingSetNodeID ID;
|
||||
AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
|
||||
ID.AddPointer(GV);
|
||||
|
@ -279,8 +279,14 @@ void X86ATTAsmPrinter::printOperand(const MachineInstr *MI, unsigned OpNo,
|
||||
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||
bool needCloseParen = false;
|
||||
|
||||
GlobalValue *GV = MO.getGlobal();
|
||||
GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
|
||||
const GlobalValue *GV = MO.getGlobal();
|
||||
const GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV);
|
||||
if (!GVar) {
|
||||
// If GV is an alias - use aliasee for determing thread-localness
|
||||
if (const GlobalAlias *GA = dyn_cast<GlobalAlias>(GV))
|
||||
GVar = dyn_cast_or_null<GlobalVariable>(GA->resolveAliasedGlobal());
|
||||
}
|
||||
|
||||
bool isThreadLocal = GVar && GVar->isThreadLocal();
|
||||
|
||||
std::string Name = Mang->getValueName(GV);
|
||||
|
Loading…
x
Reference in New Issue
Block a user