diff options
Diffstat (limited to 'lib/Target/X86/X86FastISel.cpp')
-rw-r--r-- | lib/Target/X86/X86FastISel.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Target/X86/X86FastISel.cpp b/lib/Target/X86/X86FastISel.cpp index c9301bb2c9..b8f7a6881f 100644 --- a/lib/Target/X86/X86FastISel.cpp +++ b/lib/Target/X86/X86FastISel.cpp @@ -282,8 +282,9 @@ X86FastISel::X86FastEmitStore(EVT VT, unsigned Val, const X86AddressMode &AM) { bool X86FastISel::X86FastEmitStore(EVT VT, const Value *Val, const X86AddressMode &AM) { // Handle 'null' like i32/i64 0. - if (isa<ConstantPointerNull>(Val)) - Val = Constant::getNullValue(TD.getIntPtrType(Val->getContext())); + if (isa<ConstantPointerNull>(Val)) { + Val = Constant::getNullValue(TD.getIntPtrType(Val->getType())); + } // If this is a store of a simple constant, fold the constant into the store. if (const ConstantInt *CI = dyn_cast<ConstantInt>(Val)) { @@ -908,8 +909,9 @@ bool X86FastISel::X86FastEmitCompare(const Value *Op0, const Value *Op1, if (Op0Reg == 0) return false; // Handle 'null' like i32/i64 0. - if (isa<ConstantPointerNull>(Op1)) - Op1 = Constant::getNullValue(TD.getIntPtrType(Op0->getContext())); + if (isa<ConstantPointerNull>(Op1)) { + Op1 = Constant::getNullValue(TD.getIntPtrType(Op0->getType())); + } // We have two options: compare with register or immediate. If the RHS of // the compare is an immediate that we can fold into this compare, use |