summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-09-11 01:25:15 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-09-11 01:25:15 +0000
commit4fab7454c5480bc68732ba456bb3aff3ffdedfa0 (patch)
tree0476aa398b3b8063d45db97d7d617639330b43d7
parente45b9a8c992e49fd42cc673b96ba08a44bc74d07 (diff)
downloadbcm5719-llvm-4fab7454c5480bc68732ba456bb3aff3ffdedfa0.tar.gz
bcm5719-llvm-4fab7454c5480bc68732ba456bb3aff3ffdedfa0.zip
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
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index dad49f5dbca..1b6f5c376d8 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/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<llvm::ConstantExpr>(V);
+ Fields[0] = cast<llvm::ConstantExpr>(CFConstantStringClassRef);
// Flags.
llvm::Type *Ty = getTypes().ConvertType(getContext().UnsignedIntTy);
OpenPOWER on IntegriCloud