[llvm-commits] [llvm] r172271 - /llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp

Michael Gottesman mgottesman at apple.com
Fri Jan 11 15:08:52 PST 2013


Author: mgottesman
Date: Fri Jan 11 17:08:52 2013
New Revision: 172271

URL: http://llvm.org/viewvc/llvm-project?rev=172271&view=rev
Log:
Fixed whitespace.

Modified:
    llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp

Modified: llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp?rev=172271&r1=172270&r2=172271&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/GlobalOpt.cpp Fri Jan 11 17:08:52 2013
@@ -448,8 +448,8 @@
       Dead[i].second->eraseFromParent();
       Instruction *I = Dead[i].first;
       do {
-	if (isAllocationFn(I, TLI))
-	  break;
+        if (isAllocationFn(I, TLI))
+          break;
         Instruction *J = dyn_cast<Instruction>(I->getOperand(0));
         if (!J)
           break;
@@ -2589,18 +2589,18 @@
 
     if (StoreInst *SI = dyn_cast<StoreInst>(CurInst)) {
       if (!SI->isSimple()) {
-	DEBUG(dbgs() << "Store is not simple! Can not evaluate.\n");
-	return false;  // no volatile/atomic accesses.
+        DEBUG(dbgs() << "Store is not simple! Can not evaluate.\n");
+        return false;  // no volatile/atomic accesses.
       }
       Constant *Ptr = getVal(SI->getOperand(1));
       if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr)) {
-	DEBUG(dbgs() << "Folding constant ptr expression: " << *Ptr);
+        DEBUG(dbgs() << "Folding constant ptr expression: " << *Ptr);
         Ptr = ConstantFoldConstantExpression(CE, TD, TLI);
-	DEBUG(dbgs() << "; To: " << *Ptr << "\n");
+        DEBUG(dbgs() << "; To: " << *Ptr << "\n");
       }
       if (!isSimpleEnoughPointerToCommit(Ptr)) {
         // If this is too complex for us to commit, reject it.
-	DEBUG(dbgs() << "Pointer is too complex for us to evaluate store.");
+        DEBUG(dbgs() << "Pointer is too complex for us to evaluate store.");
         return false;
       }
 
@@ -2609,14 +2609,14 @@
       // If this might be too difficult for the backend to handle (e.g. the addr
       // of one global variable divided by another) then we can't commit it.
       if (!isSimpleEnoughValueToCommit(Val, SimpleConstants, TD)) {
-	DEBUG(dbgs() << "Store value is too complex to evaluate store. " << *Val
-	      << "\n");
+        DEBUG(dbgs() << "Store value is too complex to evaluate store. " << *Val
+              << "\n");
         return false;
       }
 
       if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr)) {
         if (CE->getOpcode() == Instruction::BitCast) {
-	  DEBUG(dbgs() << "Attempting to resolve bitcast on constant ptr.\n");
+          DEBUG(dbgs() << "Attempting to resolve bitcast on constant ptr.\n");
           // If we're evaluating a store through a bitcast, then we need
           // to pull the bitcast off the pointer type and push it onto the
           // stored value.
@@ -2645,8 +2645,8 @@
             // If we can't improve the situation by introspecting NewTy,
             // we have to give up.
             } else {
-	      DEBUG(dbgs() << "Failed to bitcast constant ptr, can not "
-		    "evaluate.\n");
+              DEBUG(dbgs() << "Failed to bitcast constant ptr, can not "
+                    "evaluate.\n");
               return false;
             }
           }
@@ -2655,7 +2655,7 @@
           // onto the stored value.
           Val = ConstantExpr::getBitCast(Val, NewTy);
 
-	  DEBUG(dbgs() << "Evaluated bitcast: " << *Val << "\n");
+          DEBUG(dbgs() << "Evaluated bitcast: " << *Val << "\n");
         }
       }
 
@@ -2665,25 +2665,25 @@
                                      getVal(BO->getOperand(0)),
                                      getVal(BO->getOperand(1)));
       DEBUG(dbgs() << "Found a BinaryOperator! Simplifying: " << *InstResult
-	    << "\n");
+            << "\n");
     } else if (CmpInst *CI = dyn_cast<CmpInst>(CurInst)) {
       InstResult = ConstantExpr::getCompare(CI->getPredicate(),
                                             getVal(CI->getOperand(0)),
                                             getVal(CI->getOperand(1)));
       DEBUG(dbgs() << "Found a CmpInst! Simplifying: " << *InstResult
-	    << "\n");
+            << "\n");
     } else if (CastInst *CI = dyn_cast<CastInst>(CurInst)) {
       InstResult = ConstantExpr::getCast(CI->getOpcode(),
                                          getVal(CI->getOperand(0)),
                                          CI->getType());
       DEBUG(dbgs() << "Found a Cast! Simplifying: " << *InstResult
-	    << "\n");
+            << "\n");
     } else if (SelectInst *SI = dyn_cast<SelectInst>(CurInst)) {
       InstResult = ConstantExpr::getSelect(getVal(SI->getOperand(0)),
                                            getVal(SI->getOperand(1)),
                                            getVal(SI->getOperand(2)));
       DEBUG(dbgs() << "Found a Select! Simplifying: " << *InstResult
-	    << "\n");
+            << "\n");
     } else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(CurInst)) {
       Constant *P = getVal(GEP->getOperand(0));
       SmallVector<Constant*, 8> GEPOps;
@@ -2694,32 +2694,32 @@
         ConstantExpr::getGetElementPtr(P, GEPOps,
                                        cast<GEPOperator>(GEP)->isInBounds());
       DEBUG(dbgs() << "Found a GEP! Simplifying: " << *InstResult
-	    << "\n");
+            << "\n");
     } else if (LoadInst *LI = dyn_cast<LoadInst>(CurInst)) {
 
       if (!LI->isSimple()) {
-	DEBUG(dbgs() << "Found a Load! Not a simple load, can not evaluate.\n");
-	return false;  // no volatile/atomic accesses.
+        DEBUG(dbgs() << "Found a Load! Not a simple load, can not evaluate.\n");
+        return false;  // no volatile/atomic accesses.
       }
 
       Constant *Ptr = getVal(LI->getOperand(0));
       if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr)) {
         Ptr = ConstantFoldConstantExpression(CE, TD, TLI);
-	DEBUG(dbgs() << "Found a constant pointer expression, constant "
-	      "folding: " << *Ptr << "\n");
+        DEBUG(dbgs() << "Found a constant pointer expression, constant "
+              "folding: " << *Ptr << "\n");
       }
       InstResult = ComputeLoadResult(Ptr);
       if (InstResult == 0) {
-	DEBUG(dbgs() << "Failed to compute load result. Can not evaluate load."
-	      "\n");
-	return false; // Could not evaluate load.
+        DEBUG(dbgs() << "Failed to compute load result. Can not evaluate load."
+              "\n");
+        return false; // Could not evaluate load.
       }
 
       DEBUG(dbgs() << "Evaluated load: " << *InstResult << "\n");
     } else if (AllocaInst *AI = dyn_cast<AllocaInst>(CurInst)) {
       if (AI->isArrayAllocation()) {
-	DEBUG(dbgs() << "Found an array alloca. Can not evaluate.\n");
-	return false;  // Cannot handle array allocs.
+        DEBUG(dbgs() << "Found an array alloca. Can not evaluate.\n");
+        return false;  // Cannot handle array allocs.
       }
       Type *Ty = AI->getType()->getElementType();
       AllocaTmps.push_back(new GlobalVariable(Ty, false,
@@ -2733,30 +2733,30 @@
 
       // Debug info can safely be ignored here.
       if (isa<DbgInfoIntrinsic>(CS.getInstruction())) {
-	DEBUG(dbgs() << "Ignoring debug info.\n");
+        DEBUG(dbgs() << "Ignoring debug info.\n");
         ++CurInst;
         continue;
       }
 
       // Cannot handle inline asm.
       if (isa<InlineAsm>(CS.getCalledValue())) {
-	DEBUG(dbgs() << "Found inline asm, can not evaluate.\n");
-	return false;
+        DEBUG(dbgs() << "Found inline asm, can not evaluate.\n");
+        return false;
       }
 
       if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(CS.getInstruction())) {
         if (MemSetInst *MSI = dyn_cast<MemSetInst>(II)) {
           if (MSI->isVolatile()) {
-	    DEBUG(dbgs() << "Can not optimize a volatile memset " <<
-		  "intrinsic.\n");
-	    return false;
-	  }
+            DEBUG(dbgs() << "Can not optimize a volatile memset " <<
+                  "intrinsic.\n");
+            return false;
+          }
           Constant *Ptr = getVal(MSI->getDest());
           Constant *Val = getVal(MSI->getValue());
           Constant *DestVal = ComputeLoadResult(getVal(Ptr));
           if (Val->isNullValue() && DestVal && DestVal->isNullValue()) {
             // This memset is a no-op.
-	    DEBUG(dbgs() << "Ignoring no-op memset.\n");
+            DEBUG(dbgs() << "Ignoring no-op memset.\n");
             ++CurInst;
             continue;
           }
@@ -2764,7 +2764,7 @@
 
         if (II->getIntrinsicID() == Intrinsic::lifetime_start ||
             II->getIntrinsicID() == Intrinsic::lifetime_end) {
-	  DEBUG(dbgs() << "Ignoring lifetime intrinsic.\n");
+          DEBUG(dbgs() << "Ignoring lifetime intrinsic.\n");
           ++CurInst;
           continue;
         }
@@ -2773,9 +2773,9 @@
           // We don't insert an entry into Values, as it doesn't have a
           // meaningful return value.
           if (!II->use_empty()) {
-	    DEBUG(dbgs() << "Found unused invariant_start. Cant evaluate.\n");
+            DEBUG(dbgs() << "Found unused invariant_start. Cant evaluate.\n");
             return false;
-	  }
+          }
           ConstantInt *Size = cast<ConstantInt>(II->getArgOperand(0));
           Value *PtrArg = getVal(II->getArgOperand(1));
           Value *Ptr = PtrArg->stripPointerCasts();
@@ -2785,26 +2785,26 @@
                 Size->getValue().getLimitedValue() >=
                 TD->getTypeStoreSize(ElemTy)) {
               Invariants.insert(GV);
-	      DEBUG(dbgs() << "Found a global var that is an invariant: " << *GV
-		    << "\n");
-	    } else {
-	      DEBUG(dbgs() << "Found a global var, but can not treat it as an "
-		    "invariant.\n");
-	    }
+              DEBUG(dbgs() << "Found a global var that is an invariant: " << *GV
+                    << "\n");
+            } else {
+              DEBUG(dbgs() << "Found a global var, but can not treat it as an "
+                    "invariant.\n");
+            }
           }
           // Continue even if we do nothing.
           ++CurInst;
           continue;
         }
 
-	DEBUG(dbgs() << "Unknown intrinsic. Can not evaluate.\n");
+        DEBUG(dbgs() << "Unknown intrinsic. Can not evaluate.\n");
         return false;
       }
 
       // Resolve function pointers.
       Function *Callee = dyn_cast<Function>(getVal(CS.getCalledValue()));
       if (!Callee || Callee->mayBeOverridden()) {
-	DEBUG(dbgs() << "Can not resolve function pointer.\n");
+        DEBUG(dbgs() << "Can not resolve function pointer.\n");
         return false;  // Cannot resolve.
       }
 
@@ -2816,34 +2816,34 @@
         // If this is a function we can constant fold, do it.
         if (Constant *C = ConstantFoldCall(Callee, Formals, TLI)) {
           InstResult = C;
-	  DEBUG(dbgs() << "Constant folded function call. Result: " <<
-		*InstResult << "\n");
+          DEBUG(dbgs() << "Constant folded function call. Result: " <<
+                *InstResult << "\n");
         } else {
-	  DEBUG(dbgs() << "Can not constant fold function call.\n");
+          DEBUG(dbgs() << "Can not constant fold function call.\n");
           return false;
         }
       } else {
         if (Callee->getFunctionType()->isVarArg()) {
-	  DEBUG(dbgs() << "Can not constant fold vararg function call.\n");
+          DEBUG(dbgs() << "Can not constant fold vararg function call.\n");
           return false;
-	}
+        }
 
         Constant *RetVal;
         // Execute the call, if successful, use the return value.
         ValueStack.push_back(new DenseMap<Value*, Constant*>);
         if (!EvaluateFunction(Callee, RetVal, Formals)) {
-	  DEBUG(dbgs() << "Failed to evaluate function.\n");
+          DEBUG(dbgs() << "Failed to evaluate function.\n");
           return false;
-	}
+        }
         delete ValueStack.pop_back_val();
         InstResult = RetVal;
 
-	if (InstResult != NULL) {
-	  DEBUG(dbgs() << "Successfully evaluated function. Result: " <<
-		InstResult << "\n\n");
-	} else {
-	  DEBUG(dbgs() << "Successfully evaluated function. Result: 0\n\n");
-	}
+        if (InstResult != NULL) {
+          DEBUG(dbgs() << "Successfully evaluated function. Result: " <<
+                InstResult << "\n\n");
+        } else {
+          DEBUG(dbgs() << "Successfully evaluated function. Result: 0\n\n");
+        }
       }
     } else if (isa<TerminatorInst>(CurInst)) {
       DEBUG(dbgs() << "Found a terminator instruction.\n");
@@ -2873,7 +2873,7 @@
         NextBB = 0;
       } else {
         // invoke, unwind, resume, unreachable.
-	DEBUG(dbgs() << "Can not handle terminator.");
+        DEBUG(dbgs() << "Can not handle terminator.");
         return false;  // Cannot handle this terminator.
       }
 
@@ -2883,7 +2883,7 @@
     } else {
       // Did not know how to evaluate this!
       DEBUG(dbgs() << "Failed to evaluate block due to unhandled instruction."
-	    "\n");
+            "\n");
       return false;
     }
 





More information about the llvm-commits mailing list