Author: compnerd Date: Sat Sep 10 20:25:15 2016 New Revision: 281150 URL: http://llvm.org/viewvc/llvm-project?rev=281150&view=rev Log: CodeGen: remove unnecessary else case
Refactor the assignment so that its much more clear that the if-clause contains the lookup, and once cached is directly used. NFC. Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=281150&r1=281149&r2=281150&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Sat Sep 10 20:25:15 2016 @@ -3152,7 +3152,6 @@ CodeGenModule::GetAddrOfConstantCFString llvm::Constant *Zero = llvm::Constant::getNullValue(Int32Ty); llvm::Constant *Zeros[] = { Zero, Zero }; - llvm::Value *V; // If we don't already have it, get __CFConstantStringClassReference. if (!CFConstantStringClassRef) { @@ -3182,10 +3181,8 @@ CodeGenModule::GetAddrOfConstantCFString } // Decay array -> ptr - V = llvm::ConstantExpr::getGetElementPtr(Ty, GV, Zeros); - CFConstantStringClassRef = V; - } else { - V = CFConstantStringClassRef; + CFConstantStringClassRef = + llvm::ConstantExpr::getGetElementPtr(Ty, GV, Zeros); } QualType CFTy = getContext().getCFConstantStringType(); @@ -3195,7 +3192,7 @@ CodeGenModule::GetAddrOfConstantCFString llvm::Constant *Fields[4]; // Class pointer. - Fields[0] = cast<llvm::ConstantExpr>(V); + Fields[0] = cast<llvm::ConstantExpr>(CFConstantStringClassRef); // Flags. llvm::Type *Ty = getTypes().ConvertType(getContext().UnsignedIntTy); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits