projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PowerPC] Recurse through constants when looking for TLS globals
[oota-llvm.git]
/
lib
/
Target
/
PowerPC
/
PPCCTRLoops.cpp
diff --git
a/lib/Target/PowerPC/PPCCTRLoops.cpp
b/lib/Target/PowerPC/PPCCTRLoops.cpp
index a9687adfd379bb0ac95d8ff153b3b4e6cec77a2a..58ccb4a4cdcb084ec915a3ca2ef43c8ce7d94ee5 100644
(file)
--- a/
lib/Target/PowerPC/PPCCTRLoops.cpp
+++ b/
lib/Target/PowerPC/PPCCTRLoops.cpp
@@
-197,10
+197,18
@@
static bool isLargeIntegerTy(bool Is32Bit, Type *Ty) {
// Determining the address of a TLS variable results in a function call in
// certain TLS models.
static bool memAddrUsesCTR(const PPCTargetMachine *TM,
// Determining the address of a TLS variable results in a function call in
// certain TLS models.
static bool memAddrUsesCTR(const PPCTargetMachine *TM,
- const
llvm::
Value *MemAddr) {
+ const Value *MemAddr) {
const auto *GV = dyn_cast<GlobalValue>(MemAddr);
const auto *GV = dyn_cast<GlobalValue>(MemAddr);
- if (!GV)
+ if (!GV) {
+ // Recurse to check for constants that refer to TLS global variables.
+ if (const auto *CV = dyn_cast<Constant>(MemAddr))
+ for (const auto &CO : CV->operands())
+ if (memAddrUsesCTR(TM, CO))
+ return true;
+
return false;
return false;
+ }
+
if (!GV->isThreadLocal())
return false;
if (!TM)
if (!GV->isThreadLocal())
return false;
if (!TM)