[llvm-commits] [llvm] r57553 - /llvm/trunk/lib/Target/X86/X86FastISel.cpp

Chris Lattner sabre at nondot.org
Tue Oct 14 22:18:04 PDT 2008


Author: lattner
Date: Wed Oct 15 00:18:04 2008
New Revision: 57553

URL: http://llvm.org/viewvc/llvm-project?rev=57553&view=rev
Log:
fold compare of null pointer into compare with 0.

Modified:
    llvm/trunk/lib/Target/X86/X86FastISel.cpp

Modified: llvm/trunk/lib/Target/X86/X86FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FastISel.cpp?rev=57553&r1=57552&r2=57553&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86FastISel.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FastISel.cpp Wed Oct 15 00:18:04 2008
@@ -549,6 +549,10 @@
   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.





More information about the llvm-commits mailing list