From: Saleem Abdulrasool Date: Sun, 11 Sep 2016 01:25:15 +0000 (+0000) Subject: CodeGen: remove unnecessary else case X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=359c45534e46a8ef263db1a8b855740bbeca6998;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281150 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index dad49f5dbc..1b6f5c376d 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -3152,7 +3152,6 @@ CodeGenModule::GetAddrOfConstantCFString(const StringLiteral *Literal) { 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(const StringLiteral *Literal) { } // 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(const StringLiteral *Literal) { llvm::Constant *Fields[4]; // Class pointer. - Fields[0] = cast(V); + Fields[0] = cast(CFConstantStringClassRef); // Flags. llvm::Type *Ty = getTypes().ConvertType(getContext().UnsignedIntTy);