aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-09-22 20:16:48 +0000
committerChris Lattner <sabre@nondot.org>2007-09-22 20:16:48 +0000
commit96b207c380569c61d3a9edb6ea8cd5fd086060c5 (patch)
tree043a6c1e9f431d7056c4f18d99aca84d3493ae81
parentd40bc4ad433b45445bbdf2d187f853d67cb9eb9a (diff)
downloadexternal_llvm-96b207c380569c61d3a9edb6ea8cd5fd086060c5.zip
external_llvm-96b207c380569c61d3a9edb6ea8cd5fd086060c5.tar.gz
external_llvm-96b207c380569c61d3a9edb6ea8cd5fd086060c5.tar.bz2
Fix PR1679, by printing GEP indices as signed values instead of unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42239 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/CBackend/CBackend.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index 294f975..bc08524 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -1238,6 +1238,7 @@ void CWriter::writeOperandWithCast(Value* Operand, unsigned Opcode) {
shouldCast = true;
castIsSigned = false;
break;
+ case Instruction::GetElementPtr:
case Instruction::AShr:
case Instruction::SDiv:
case Instruction::SRem: // Cast to signed first
@@ -2859,7 +2860,7 @@ void CWriter::printIndexingExpression(Value *Ptr, gep_type_iterator I,
Out << ".field" << cast<ConstantInt>(I.getOperand())->getZExtValue();
} else {
Out << '[';
- writeOperand(I.getOperand());
+ writeOperandWithCast(I.getOperand(), Instruction::GetElementPtr);
Out << ']';
}
}