mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-09 11:25:55 +00:00
fold compare of null pointer into compare with 0.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57553 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -549,6 +549,10 @@ bool X86FastISel::X86FastEmitCompare(Value *Op0, Value *Op1, MVT VT) {
|
|||||||
unsigned Op0Reg = getRegForValue(Op0);
|
unsigned Op0Reg = getRegForValue(Op0);
|
||||||
if (Op0Reg == 0) return false;
|
if (Op0Reg == 0) return false;
|
||||||
|
|
||||||
|
// Handle 'null' like i32/i64 0.
|
||||||
|
if (isa<ConstantPointerNull>(Op1))
|
||||||
|
Op1 = Constant::getNullValue(TD.getIntPtrType());
|
||||||
|
|
||||||
// We have two options: compare with register or immediate. If the RHS of
|
// 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
|
// the compare is an immediate that we can fold into this compare, use
|
||||||
// CMPri, otherwise use CMPrr.
|
// CMPri, otherwise use CMPrr.
|
||||||
|
Reference in New Issue
Block a user