forked from OSchip/llvm-project
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:
parent
e45b9a8c99
commit
4fab7454c5
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue