diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-11-16 20:24:41 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2013-11-16 20:24:41 +0000 |
commit | 4fe5b640ee935f983db9445dc9fdb4009d4fa639 (patch) | |
tree | f56b897eeafcba15c04a1ae64365283171c4dbc0 /lib | |
parent | 2905440bdd9627f202398137aab5ded38f681fc9 (diff) | |
download | external_llvm-4fe5b640ee935f983db9445dc9fdb4009d4fa639.zip external_llvm-4fe5b640ee935f983db9445dc9fdb4009d4fa639.tar.gz external_llvm-4fe5b640ee935f983db9445dc9fdb4009d4fa639.tar.bz2 |
Fix codegen for null different sized pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@194932 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 009c590..b960544 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -1064,8 +1064,10 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) { if (const GlobalValue *GV = dyn_cast<GlobalValue>(C)) return DAG.getGlobalAddress(GV, getCurSDLoc(), VT); - if (isa<ConstantPointerNull>(C)) - return DAG.getConstant(0, TLI->getPointerTy()); + if (isa<ConstantPointerNull>(C)) { + unsigned AS = V->getType()->getPointerAddressSpace(); + return DAG.getConstant(0, TLI->getPointerTy(AS)); + } if (const ConstantFP *CFP = dyn_cast<ConstantFP>(C)) return DAG.getConstantFP(*CFP, VT); |