[vmkit-commits] [vmkit] r60481 - /vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp

Nicolas Geoffray nicolas.geoffray at lip6.fr
Wed Dec 3 04:16:58 PST 2008


Author: geoffray
Date: Wed Dec  3 06:16:52 2008
New Revision: 60481

URL: http://llvm.org/viewvc/llvm-project?rev=60481&view=rev
Log:
Remove null checks of the "this" parameter.


Modified:
    vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp

Modified: vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp?rev=60481&r1=60480&r2=60481&view=diff

==============================================================================
--- vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp (original)
+++ vmkit/trunk/lib/JnJVM/VMCore/LowerConstantCalls.cpp Wed Dec  3 06:16:52 2008
@@ -142,12 +142,25 @@
 
 bool LowerConstantCalls::runOnFunction(Function& F) {
   JnjvmModule* module = (JnjvmModule*)F.getParent();
+  JavaMethod* meth = LLVMMethodInfo::get(&F);
   bool Changed = false;
   for (Function::iterator BI = F.begin(), BE = F.end(); BI != BE; BI++) { 
     BasicBlock *Cur = BI; 
     for (BasicBlock::iterator II = Cur->begin(), IE = Cur->end(); II != IE;) {
       Instruction *I = II;
       II++;
+
+      if (ICmpInst* Cmp = dyn_cast<ICmpInst>(I)) {
+        if (isVirtual(meth->access)) {
+          if (Cmp->getOperand(1) == module->JavaObjectNullConstant && 
+              Cmp->getOperand(0) == F.arg_begin()) {
+            Cmp->replaceAllUsesWith(ConstantInt::getFalse());
+            Cmp->eraseFromParent();
+            continue;
+          }
+        }
+      }
+
       CallSite Call = CallSite::get(I);
       Instruction* CI = Call.getInstruction();
       if (CI) {





More information about the vmkit-commits mailing list