[llvm] r176641 - ArrayRef ca accept one element. Simplify code a little bit, also it matches now

Jakub Staszak kubastaszak at gmail.com
Thu Mar 7 12:01:19 PST 2013


Author: kuba
Date: Thu Mar  7 14:01:19 2013
New Revision: 176641

URL: http://llvm.org/viewvc/llvm-project?rev=176641&view=rev
Log:
ArrayRef ca accept one element. Simplify code a little bit, also it matches now
coding in the other places of the file.

Modified:
    llvm/trunk/lib/Analysis/IPA/InlineCost.cpp

Modified: llvm/trunk/lib/Analysis/IPA/InlineCost.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/InlineCost.cpp?rev=176641&r1=176640&r2=176641&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/InlineCost.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/InlineCost.cpp Thu Mar  7 14:01:19 2013
@@ -474,10 +474,12 @@ bool CallAnalyzer::visitCastInst(CastIns
 
 bool CallAnalyzer::visitUnaryInstruction(UnaryInstruction &I) {
   Value *Operand = I.getOperand(0);
-  Constant *Ops[1] = { dyn_cast<Constant>(Operand) };
-  if (Ops[0] || (Ops[0] = SimplifiedValues.lookup(Operand)))
+  Constant *COp = dyn_cast<Constant>(Operand);
+  if (!COp)
+    COp = SimplifiedValues.lookup(Operand);
+  if (COp)
     if (Constant *C = ConstantFoldInstOperands(I.getOpcode(), I.getType(),
-                                               Ops, TD)) {
+                                               COp, TD)) {
       SimplifiedValues[&I] = C;
       return true;
     }





More information about the llvm-commits mailing list