]> granicus.if.org Git - clang/commitdiff
CodeGen: remove unnecessary else case
authorSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 11 Sep 2016 01:25:15 +0000 (01:25 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Sun, 11 Sep 2016 01:25:15 +0000 (01:25 +0000)
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

lib/CodeGen/CodeGenModule.cpp

index dad49f5dbca659e2d1646e79ceee81d472e70bbb..1b6f5c376d8e02f53900eb1b364b25e94e8a7f1a 100644 (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);