aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/CBackend/CBackend.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/CBackend/CBackend.cpp')
-rw-r--r--lib/Target/CBackend/CBackend.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 139320f640..c1cd657cf2 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -620,8 +620,8 @@ void CWriter::printConstant(Constant *CPV) {
printType(Out, CPV->getType());
Out << ")/*NULL*/0)";
break;
- } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(CPV)) {
- writeOperand(CPR->getValue());
+ } else if (GlobalValue *GV = dyn_cast<GlobalValue>(CPV)) {
+ writeOperand(GV);
break;
}
// FALL THROUGH
@@ -641,7 +641,8 @@ void CWriter::writeOperandInternal(Value *Operand) {
return;
}
- if (Constant *CPV = dyn_cast<Constant>(Operand)) {
+ Constant* CPV = dyn_cast<Constant>(Operand);
+ if (CPV && !isa<GlobalValue>(CPV)) {
printConstant(CPV);
} else {
Out << Mang->getValueName(Operand);
@@ -1412,9 +1413,6 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
// If accessing a global value with no indexing, avoid *(&GV) syndrome
if (GlobalValue *V = dyn_cast<GlobalValue>(Ptr)) {
HasImplicitAddress = true;
- } else if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(Ptr)) {
- HasImplicitAddress = true;
- Ptr = CPR->getValue(); // Get to the global...
} else if (isDirectAlloca(Ptr)) {
HasImplicitAddress = true;
}