[llvm-commits] CVS: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Feb 24 11:36:09 PST 2005
Changes in directory llvm-poolalloc/lib/PoolAllocate:
PointerCompress.cpp updated: 1.23 -> 1.24
---
Log message:
'load null' does not really make any sense, but we have to support it
correctly. Particularly since bugpoint is fond of producing these when
reducing testcases.
---
Diffs of the changes: (+9 -1)
PointerCompress.cpp | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletion(-)
Index: llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp
diff -u llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.23 llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.24
--- llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp:1.23 Thu Feb 24 13:22:32 2005
+++ llvm-poolalloc/lib/PoolAllocate/PointerCompress.cpp Thu Feb 24 13:35:56 2005
@@ -353,6 +353,8 @@
Value *getTransformedValue(Value *V) {
if (isa<ConstantPointerNull>(V)) // null -> uint 0
return Constant::getNullValue(SCALARUINTTYPE);
+ if (isa<UndefValue>(V)) // undef -> uint undef
+ return UndefValue::get(SCALARUINTTYPE);
assert(getNodeIfCompressed(V) && "Value is not compressed!");
Value *&RV = OldToNewValueMap[V];
@@ -582,7 +584,13 @@
}
void InstructionRewriter::visitLoadInst(LoadInst &LI) {
- if (isa<ConstantPointerNull>(LI.getOperand(0))) return; // load null ??
+ if (isa<ConstantPointerNull>(LI.getOperand(0))) { // load null ??
+ // Load null doesn't make any sense, but if the result is a pointer into a
+ // compressed pool, we have to transform it.
+ if (isa<PointerType>(LI.getType()) && getPoolInfo(&LI))
+ setTransformedValue(LI, UndefValue::get(SCALARUINTTYPE));
+ return;
+ }
const CompressedPoolInfo *SrcPI = getPoolInfo(LI.getOperand(0));
if (SrcPI == 0) {
More information about the llvm-commits
mailing list