diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-10-15 05:18:04 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-10-15 05:18:04 +0000 |
| commit | e388725aefff3f7dbbbd1245eeb2baf29c06f2ea (patch) | |
| tree | aa67454144cdeddb48474f316f9cc67388e67c5f /llvm/lib/Target | |
| parent | a0f9d4972f6cbb337f3b6c572570f19415b74a63 (diff) | |
| download | bcm5719-llvm-e388725aefff3f7dbbbd1245eeb2baf29c06f2ea.tar.gz bcm5719-llvm-e388725aefff3f7dbbbd1245eeb2baf29c06f2ea.zip | |
fold compare of null pointer into compare with 0.
llvm-svn: 57553
Diffstat (limited to 'llvm/lib/Target')
| -rw-r--r-- | llvm/lib/Target/X86/X86FastISel.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Target/X86/X86FastISel.cpp b/llvm/lib/Target/X86/X86FastISel.cpp index 954a3a0640e..e04e91a7acd 100644 --- a/llvm/lib/Target/X86/X86FastISel.cpp +++ b/llvm/lib/Target/X86/X86FastISel.cpp @@ -549,6 +549,10 @@ bool X86FastISel::X86FastEmitCompare(Value *Op0, Value *Op1, MVT VT) { unsigned Op0Reg = getRegForValue(Op0); 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 // the compare is an immediate that we can fold into this compare, use // CMPri, otherwise use CMPrr. |

