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.

llvm-svn: 281150
This commit is contained in:
Saleem Abdulrasool 2016-09-11 01:25:15 +00:00
parent e45b9a8c99
commit 4fab7454c5
1 changed files with 3 additions and 6 deletions

View File

@ -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<llvm::ConstantExpr>(V);
Fields[0] = cast<llvm::ConstantExpr>(CFConstantStringClassRef);
// Flags.
llvm::Type *Ty = getTypes().ConvertType(getContext().UnsignedIntTy);