summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-05-21 00:14:04 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-05-21 00:14:04 +0000
commit2907e51246a8cf0a440fa1767f94dc10eda195eb (patch)
tree2d881318e120ee033cd3c1b26d0bbbdeba5afee4 /llvm/lib
parentbe8e2e0fa8076d6d6c9e1c4f84a1edd2949192dd (diff)
downloadbcm5719-llvm-2907e51246a8cf0a440fa1767f94dc10eda195eb.tar.gz
bcm5719-llvm-2907e51246a8cf0a440fa1767f94dc10eda195eb.zip
Fix constant folding of addrspacecast of null
This should not be making assumptions on the value of the casted pointer. llvm-svn: 270293
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index a338d01a83d..623ce701b60 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -531,7 +531,8 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
return UndefValue::get(DestTy);
}
- if (V->isNullValue() && !DestTy->isX86_MMXTy())
+ if (V->isNullValue() && !DestTy->isX86_MMXTy() &&
+ opc != Instruction::AddrSpaceCast)
return Constant::getNullValue(DestTy);
// If the cast operand is a constant expression, there's a few things we can
OpenPOWER on IntegriCloud