[llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Feb 24 13:47:16 PST 2005
Changes in directory llvm-poolalloc/lib/PoolAllocate:
PointerCompress.cpp updated: 1.25 -> 1.26
---
Log message:
Handle cast <compressed ptr> -> int.
---
Diffs of the changes: (+10 -4)
PointerCompress.cpp | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.25 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.26
--- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.25 Thu Feb 24 14:45:16 2005
+++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Thu Feb 24 15:47:00 2005
@@ -491,13 +491,12 @@
if (Instruction *Inst = dyn_cast<Instruction>(I->first)) {
Inst->eraseFromParent();
ValueRemoved(Inst);
- }
- else if (Argument *Arg = dyn_cast<Argument>(I->first)) {
+ } else if (Argument *Arg = dyn_cast<Argument>(I->first)) {
assert(Arg->getParent() == 0 && "Unexpected argument type here!");
delete Arg; // Marker node used when cloning.
} else {
assert(0 && "Unknown entry in this map!");
- }
+ }
}
}
@@ -512,7 +511,14 @@
void InstructionRewriter::visitCastInst(CastInst &CI) {
- if (!isa<PointerType>(CI.getType())) return;
+ if (!isa<PointerType>(CI.getType())) {
+ // If this is a pointer -> integer cast, turn this into an idx -> integer
+ // cast.
+ if (isa<PointerType>(CI.getOperand(0)->getType()) &&
+ getPoolInfo(CI.getOperand(0)))
+ CI.setOperand(0, getTransformedValue(CI.getOperand(0)));
+ return;
+ }
const CompressedPoolInfo *PI = getPoolInfo(&CI);
if (!PI) return;
More information about the llvm-commits
mailing list