wingo created this revision.
Herald added a subscriber: lxfind.
wingo requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

Remove explicit uses of Address::invalid in initializers; the default
constructor makes an invalid address.

Depends on D108458 <https://reviews.llvm.org/D108458>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108459

Files:
  clang/lib/CodeGen/CGAtomic.cpp
  clang/lib/CodeGen/CGBlocks.cpp
  clang/lib/CodeGen/CGBuiltin.cpp
  clang/lib/CodeGen/CGCall.cpp
  clang/lib/CodeGen/CGCall.h
  clang/lib/CodeGen/CGCoroutine.cpp
  clang/lib/CodeGen/CGDecl.cpp
  clang/lib/CodeGen/CGException.cpp
  clang/lib/CodeGen/CGExpr.cpp
  clang/lib/CodeGen/CGExprAgg.cpp
  clang/lib/CodeGen/CGExprCXX.cpp
  clang/lib/CodeGen/CGExprComplex.cpp
  clang/lib/CodeGen/CGExprScalar.cpp
  clang/lib/CodeGen/CGObjC.cpp
  clang/lib/CodeGen/CGObjCMac.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.cpp
  clang/lib/CodeGen/CGOpenMPRuntime.h
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
  clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
  clang/lib/CodeGen/CGStmt.cpp
  clang/lib/CodeGen/CGStmtOpenMP.cpp
  clang/lib/CodeGen/CodeGenFunction.h
  clang/lib/CodeGen/TargetInfo.cpp

Index: clang/lib/CodeGen/TargetInfo.cpp
===================================================================
--- clang/lib/CodeGen/TargetInfo.cpp
+++ clang/lib/CodeGen/TargetInfo.cpp
@@ -321,7 +321,7 @@
   llvm::Value *Ptr = CGF.Builder.CreateLoad(VAListAddr, "argp.cur");
 
   // If the CC aligns values higher than the slot size, do so if needed.
-  Address Addr = Address::invalid();
+  Address Addr;
   if (AllowHigherAlign && DirectAlign > SlotSize) {
     Addr = Address(emitRoundPointerUpToAlignment(CGF, Ptr, DirectAlign),
                                                  DirectAlign);
@@ -4064,7 +4064,7 @@
   // register save space).
 
   llvm::Value *InRegs = nullptr;
-  Address gp_offset_p = Address::invalid(), fp_offset_p = Address::invalid();
+  Address gp_offset_p, fp_offset_p;
   llvm::Value *gp_offset = nullptr, *fp_offset = nullptr;
   if (neededInt) {
     gp_offset_p = CGF.Builder.CreateStructGEP(VAListAddr, 0, "gp_offset_p");
@@ -4105,7 +4105,7 @@
   llvm::Value *RegSaveArea = CGF.Builder.CreateLoad(
       CGF.Builder.CreateStructGEP(VAListAddr, 3), "reg_save_area");
 
-  Address RegAddr = Address::invalid();
+  Address RegAddr;
   if (neededInt && neededSSE) {
     // FIXME: Cleanup.
     assert(AI.isDirect() && "Unexpected ABI info for mixed regs");
@@ -4787,7 +4787,7 @@
   CGBuilderTy &Builder = CGF.Builder;
 
   // The calling convention either uses 1-2 GPRs or 1 FPR.
-  Address NumRegsAddr = Address::invalid();
+  Address NumRegsAddr;
   if (isInt || IsSoftFloatABI) {
     NumRegsAddr = Builder.CreateStructGEP(VAList, 0, "gpr");
   } else {
@@ -4815,7 +4815,7 @@
   if (isIndirect) DirectTy = DirectTy->getPointerTo(0);
 
   // Case 1: consume registers.
-  Address RegAddr = Address::invalid();
+  Address RegAddr;
   {
     CGF.EmitBlock(UsingRegs);
 
@@ -4850,7 +4850,7 @@
   }
 
   // Case 2: consume space in the overflow area.
-  Address MemAddr = Address::invalid();
+  Address MemAddr;
   {
     CGF.EmitBlock(UsingOverflow);
 
@@ -5982,7 +5982,7 @@
   CharUnits TySize = getContext().getTypeSizeInChars(Ty);
   CharUnits TyAlign = getContext().getTypeUnadjustedAlignInChars(Ty);
 
-  Address reg_offs_p = Address::invalid();
+  Address reg_offs_p;
   llvm::Value *reg_offs = nullptr;
   int reg_top_index;
   int RegSize = IsIndirect ? 8 : TySize.getQuantity();
@@ -6063,7 +6063,7 @@
   reg_top = CGF.Builder.CreateLoad(reg_top_p, "reg_top");
   Address BaseAddr(CGF.Builder.CreateInBoundsGEP(CGF.Int8Ty, reg_top, reg_offs),
                    CharUnits::fromQuantity(IsFPR ? 16 : 8));
-  Address RegAddr = Address::invalid();
+  Address RegAddr;
   llvm::Type *MemTy = CGF.ConvertTypeForMem(Ty);
 
   if (IsIndirect) {
@@ -9636,7 +9636,7 @@
 
   auto TypeInfo = getContext().getTypeInfoInChars(Ty);
 
-  Address ArgAddr = Address::invalid();
+  Address ArgAddr;
   CharUnits Stride;
   switch (AI.getKind()) {
   case ABIArgInfo::Expand:
@@ -10006,7 +10006,7 @@
     AI.setCoerceToType(ArgTy);
   llvm::Type *ArgPtrTy = llvm::PointerType::getUnqual(ArgTy);
 
-  Address Val = Address::invalid();
+  Address Val;
   CharUnits ArgSize = CharUnits::Zero();
   switch (AI.getKind()) {
   case ABIArgInfo::Expand:
Index: clang/lib/CodeGen/CodeGenFunction.h
===================================================================
--- clang/lib/CodeGen/CodeGenFunction.h
+++ clang/lib/CodeGen/CodeGenFunction.h
@@ -354,11 +354,11 @@
 
   /// ReturnValue - The temporary alloca to hold the return
   /// value. This is invalid iff the function has no return value.
-  Address ReturnValue = Address::invalid();
+  Address ReturnValue;
 
   /// ReturnValuePointer - The temporary alloca to hold a pointer to sret.
   /// This is invalid if sret is not in use.
-  Address ReturnValuePointer = Address::invalid();
+  Address ReturnValuePointer;
 
   /// If a return statement is being visited, this holds the return statment's
   /// result expression.
@@ -614,7 +614,7 @@
   };
 
   /// i32s containing the indexes of the cleanup destinations.
-  Address NormalCleanupDest = Address::invalid();
+  Address NormalCleanupDest;
 
   unsigned NextCleanupDestIndex = 1;
 
@@ -1849,7 +1849,7 @@
 
   /// The value of 'this' to use when evaluating CXXDefaultInitExprs within
   /// this expression.
-  Address CXXDefaultInitExprThis = Address::invalid();
+  Address CXXDefaultInitExprThis;
 
   /// The current array initialization index when evaluating an
   /// ArrayInitIndexExpr within an ArrayInitLoopExpr.
@@ -1892,7 +1892,7 @@
 
   /// Used to store precise source locations for return statements by the
   /// runtime return value checks.
-  Address ReturnLocation = Address::invalid();
+  Address ReturnLocation;
 
   /// Check if the return value of this function requires sanitization.
   bool requiresReturnValueCheck() const;
@@ -3022,14 +3022,11 @@
     Address AllocaAddr;
 
     struct Invalid {};
-    AutoVarEmission(Invalid)
-        : Variable(nullptr), Addr(Address::invalid()),
-          AllocaAddr(Address::invalid()) {}
+    AutoVarEmission(Invalid) : Variable(nullptr) {}
 
     AutoVarEmission(const VarDecl &variable)
-        : Variable(&variable), Addr(Address::invalid()), NRVOFlag(nullptr),
-          IsEscapingByRef(false), IsConstantAggregate(false),
-          SizeForLifetimeMarkers(nullptr), AllocaAddr(Address::invalid()) {}
+        : Variable(&variable), NRVOFlag(nullptr), IsEscapingByRef(false),
+          IsConstantAggregate(false), SizeForLifetimeMarkers(nullptr) {}
 
     bool wasEmittedAsGlobal() const { return !Addr.isValid(); }
 
@@ -3421,10 +3418,10 @@
                                  const RegionCodeGenTy &BodyGen,
                                  const TaskGenTy &TaskGen, OMPTaskDataTy &Data);
   struct OMPTargetDataInfo {
-    Address BasePointersArray = Address::invalid();
-    Address PointersArray = Address::invalid();
-    Address SizesArray = Address::invalid();
-    Address MappersArray = Address::invalid();
+    Address BasePointersArray;
+    Address PointersArray;
+    Address SizesArray;
+    Address MappersArray;
     unsigned NumberOfTargetItems = 0;
     explicit OMPTargetDataInfo() = default;
     OMPTargetDataInfo(Address BasePointersArray, Address PointersArray,
@@ -3615,13 +3612,13 @@
   /// struct with the values to be passed to the OpenMP loop-related functions
   struct OMPLoopArguments {
     /// loop lower bound
-    Address LB = Address::invalid();
+    Address LB;
     /// loop upper bound
-    Address UB = Address::invalid();
+    Address UB;
     /// loop stride
-    Address ST = Address::invalid();
+    Address ST;
     /// isLastIteration argument for runtime functions
-    Address IL = Address::invalid();
+    Address IL;
     /// Chunk value generated by sema
     llvm::Value *Chunk = nullptr;
     /// EnsureUpperBound
Index: clang/lib/CodeGen/CGStmtOpenMP.cpp
===================================================================
--- clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -531,7 +531,7 @@
   I = FO.S->captures().begin();
   for (const FieldDecl *FD : RD->fields()) {
     // Do not map arguments if we emit function with non-original types.
-    Address LocalAddr(Address::invalid());
+    Address LocalAddr;
     if (!FO.UIntPtrCastRequired && Args[Cnt] != TargetArgs[Cnt]) {
       LocalAddr = CGM.getOpenMPRuntime().getParameterAddress(CGF, Args[Cnt],
                                                              TargetArgs[Cnt]);
@@ -993,7 +993,7 @@
         // Get the address of the master variable. If we are emitting code with
         // TLS support, the address is passed from the master as field in the
         // captured declaration.
-        Address MasterAddr = Address::invalid();
+        Address MasterAddr;
         if (getLangOpts().OpenMPUseTLS &&
             getContext().getTargetInfo().isTLSSupported()) {
           assert(CapturedStmtInfo->lookup(VD) &&
@@ -2397,7 +2397,7 @@
           EmitBlock(ThenBB);
         }
       }
-      Address OrigAddr = Address::invalid();
+      Address OrigAddr;
       if (CED) {
         OrigAddr =
             EmitLValue(CED->getInit()->IgnoreImpCasts()).getAddress(*this);
@@ -3488,7 +3488,7 @@
       for (const Expr *CopyArrayElem : CopyArrayElems) {
         const auto *LHSVD = cast<VarDecl>(cast<DeclRefExpr>(*ILHS)->getDecl());
         const auto *RHSVD = cast<VarDecl>(cast<DeclRefExpr>(*IRHS)->getDecl());
-        Address LHSAddr = Address::invalid();
+        Address LHSAddr;
         {
           CodeGenFunction::OpaqueValueMapping IdxMapping(
               CGF,
@@ -3498,7 +3498,7 @@
           LHSAddr = CGF.EmitLValue(CopyArrayElem).getAddress(CGF);
         }
         PrivScope.addPrivate(LHSVD, [LHSAddr]() { return LHSAddr; });
-        Address RHSAddr = Address::invalid();
+        Address RHSAddr;
         {
           llvm::Value *OffsetIVal = CGF.Builder.CreateNUWSub(IVal, Pow2K);
           CodeGenFunction::OpaqueValueMapping IdxMapping(
@@ -6860,7 +6860,7 @@
   assert(isOpenMPTaskLoopDirective(S.getDirectiveKind()));
   // Emit outlined function for task construct.
   const CapturedStmt *CS = S.getCapturedStmt(OMPD_taskloop);
-  Address CapturedStruct = Address::invalid();
+  Address CapturedStruct;
   {
     OMPLexicalScope Scope(*this, S, OMPD_taskloop, /*EmitPreInitStmt=*/false);
     CapturedStruct = GenerateCapturedStmtArgument(*CS);
Index: clang/lib/CodeGen/CGStmt.cpp
===================================================================
--- clang/lib/CodeGen/CGStmt.cpp
+++ clang/lib/CodeGen/CGStmt.cpp
@@ -456,7 +456,7 @@
   assert((!GetLast || (GetLast && ExprResult)) &&
          "If GetLast is true then the CompoundStmt must have a StmtExprResult");
 
-  Address RetAlloca = Address::invalid();
+  Address RetAlloca;
 
   for (auto *CurStmt : S.body()) {
     if (GetLast && ExprResult == CurStmt) {
Index: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
+++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.h
@@ -412,7 +412,7 @@
     /// Corresponding field in the global record.
     llvm::Value *GlobalizedVal = nullptr;
     /// Corresponding address.
-    Address PrivateAddr = Address::invalid();
+    Address PrivateAddr;
   };
   /// The map of local variables to their addresses in the global memory.
   using DeclToAddrMapTy = llvm::MapVector<const Decl *, MappedVarData>;
Index: clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
@@ -1855,9 +1855,9 @@
   unsigned Idx = 0;
   unsigned Size = Privates.size();
   for (const Expr *Private : Privates) {
-    Address SrcElementAddr = Address::invalid();
-    Address DestElementAddr = Address::invalid();
-    Address DestElementPtrAddr = Address::invalid();
+    Address SrcElementAddr;
+    Address DestElementAddr;
+    Address DestElementPtrAddr;
     // Should we shuffle in an element from a remote lane?
     bool ShuffleInElement = false;
     // Set to true to update the pointer in the dest Reduce list to a
@@ -2137,7 +2137,7 @@
       llvm::Type *CopyType = CGF.ConvertTypeForMem(CType);
       CharUnits Align = CharUnits::fromQuantity(TySize);
       llvm::Value *Cnt = nullptr;
-      Address CntAddr = Address::invalid();
+      Address CntAddr;
       llvm::BasicBlock *PrecondBB = nullptr;
       llvm::BasicBlock *ExitBB = nullptr;
       if (NumIters > 1) {
@@ -3498,7 +3498,7 @@
 
   // Retrieve the shared variables from the list of references returned
   // by the runtime. Pass the variables to the outlined function.
-  Address SharedArgListAddress = Address::invalid();
+  Address SharedArgListAddress;
   if (CS.capture_size() > 0 ||
       isOpenMPLoopBoundSharingDirective(D.getDirectiveKind())) {
     SharedArgListAddress = CGF.EmitLoadOfPointer(
Index: clang/lib/CodeGen/CGOpenMPRuntime.h
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.h
+++ clang/lib/CodeGen/CGOpenMPRuntime.h
@@ -1169,16 +1169,16 @@
     bool Ordered = false;
     /// Address of the output variable in which the flag of the last iteration
     /// is returned.
-    Address IL = Address::invalid();
+    Address IL;
     /// Address of the output variable in which the lower iteration number is
     /// returned.
-    Address LB = Address::invalid();
+    Address LB;
     /// Address of the output variable in which the upper iteration number is
     /// returned.
-    Address UB = Address::invalid();
+    Address UB;
     /// Address of the output variable in which the stride value is returned
     /// necessary to generated the static_chunked scheduled loop.
-    Address ST = Address::invalid();
+    Address ST;
     /// Value of the chunk for the static_chunked scheduled loop. For the
     /// default (nullptr) value, the chunk 1 will be used.
     llvm::Value *Chunk = nullptr;
Index: clang/lib/CodeGen/CGOpenMPRuntime.cpp
===================================================================
--- clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -714,7 +714,7 @@
   CharUnits ElementSize = CGF.getContext().getTypeSizeInChars(ElementTy);
 
   llvm::PHINode *SrcElementPHI = nullptr;
-  Address SrcElementCurrent = Address::invalid();
+  Address SrcElementCurrent;
   if (DRD) {
     SrcElementPHI = CGF.Builder.CreatePHI(SrcBegin->getType(), 2,
                                           "omp.arraycpy.srcElementPast");
@@ -959,9 +959,9 @@
 static Address castToBase(CodeGenFunction &CGF, QualType BaseTy, QualType ElTy,
                           llvm::Type *BaseLVType, CharUnits BaseLVAlignment,
                           llvm::Value *Addr) {
-  Address Tmp = Address::invalid();
-  Address TopTmp = Address::invalid();
-  Address MostTopTmp = Address::invalid();
+  Address Tmp;
+  Address TopTmp;
+  Address MostTopTmp;
   BaseTy = BaseTy.getNonReferenceType();
   while ((BaseTy->isPointerType() || BaseTy->isReferenceType()) &&
          !CGF.getContext().hasSameType(BaseTy, ElTy)) {
@@ -2443,7 +2443,7 @@
   // call __kmpc_copyprivate(ident_t *, gtid, <buf_size>, <copyprivate list>,
   // <copy_func>, did_it);
 
-  Address DidIt = Address::invalid();
+  Address DidIt;
   if (!CopyprivateVars.empty()) {
     // int32 did_it = 0;
     QualType KmpInt32Ty =
@@ -4022,7 +4022,7 @@
 
   // Emit initial values for private copies (if any).
   assert(!Privates.empty());
-  Address KmpTaskSharedsPtr = Address::invalid();
+  Address KmpTaskSharedsPtr;
   if (!Data.FirstprivateVars.empty()) {
     LValue TDBase = CGF.EmitLoadOfPointerLValue(
         CGF.GetAddrOfLocalVar(&SrcArg),
@@ -4376,7 +4376,7 @@
   if (D.hasClausesOfKind<OMPAffinityClause>()) {
     // Process list of affinity data.
     ASTContext &C = CGM.getContext();
-    Address AffinitiesArray = Address::invalid();
+    Address AffinitiesArray;
     // Calculate number of elements to form the array of affinity data.
     llvm::Value *NumOfElements = nullptr;
     unsigned NumAffinities = 0;
@@ -4518,7 +4518,7 @@
       CGF.EmitLValueForField(Base, *KmpTaskTWithPrivatesQTyRD->field_begin());
   // Fill the data in the resulting kmp_task_t record.
   // Copy shareds if there are any.
-  Address KmpTaskSharedsPtr = Address::invalid();
+  Address KmpTaskSharedsPtr;
   if (!SharedsTy->getAsStructureType()->getDecl()->field_empty()) {
     KmpTaskSharedsPtr =
         Address(CGF.EmitLoadOfScalar(
@@ -4846,7 +4846,7 @@
     return std::make_pair(nullptr, Address::invalid());
   // Process list of dependencies.
   ASTContext &C = CGM.getContext();
-  Address DependenciesArray = Address::invalid();
+  Address DependenciesArray;
   llvm::Value *NumOfElements = nullptr;
   unsigned NumDependencies = std::accumulate(
       Dependencies.begin(), Dependencies.end(), 0,
@@ -4965,7 +4965,7 @@
     return Address::invalid();
   // Process list of dependencies.
   ASTContext &C = CGM.getContext();
-  Address DependenciesArray = Address::invalid();
+  Address DependenciesArray;
   unsigned NumDependencies = Dependencies.DepExprs.size();
   QualType FlagsTy;
   getDependTypes(C, KmpDependInfoTy, FlagsTy);
@@ -5132,7 +5132,7 @@
   LValue TDBase = Result.TDBase;
   const RecordDecl *KmpTaskTQTyRD = Result.KmpTaskTQTyRD;
   // Process list of dependences.
-  Address DependenciesArray = Address::invalid();
+  Address DependenciesArray;
   llvm::Value *NumOfElements;
   std::tie(NumOfElements, DependenciesArray) =
       emitDependClause(CGF, Data.Dependences, Loc);
@@ -7379,8 +7379,8 @@
         0, Address::invalid()};
     std::pair<unsigned /*FieldIndex*/, Address /*Pointer*/> HighestElem = {
         0, Address::invalid()};
-    Address Base = Address::invalid();
-    Address LB = Address::invalid();
+    Address Base;
+    Address LB;
     bool IsArraySection = false;
     bool HasCompleteRecord = false;
   };
@@ -7812,7 +7812,7 @@
     // components.
     bool IsExpressionFirstInfo = true;
     bool FirstPointerInComplexData = false;
-    Address BP = Address::invalid();
+    Address BP;
     const Expr *AssocExpr = I->getAssociatedExpression();
     const auto *AE = dyn_cast<ArraySubscriptExpr>(AssocExpr);
     const auto *OASE = dyn_cast<OMPArraySectionExpr>(AssocExpr);
@@ -7978,8 +7978,8 @@
                 isa<BinaryOperator>(Next->getAssociatedExpression())) &&
                "Unexpected expression");
 
-        Address LB = Address::invalid();
-        Address LowestElem = Address::invalid();
+        Address LB;
+        Address LowestElem;
         auto &&EmitMemberExprBase = [](CodeGenFunction &CGF,
                                        const MemberExpr *E) {
           const Expr *BaseExpr = E->getBase();
@@ -8060,7 +8060,7 @@
           // Do bitcopy of all non-overlapped structure elements.
           for (OMPClauseMappableExprCommon::MappableExprComponentListRef
                    Component : OverlappedElements) {
-            Address ComponentLB = Address::invalid();
+            Address ComponentLB;
             for (const OMPClauseMappableExprCommon::MappableComponent &MC :
                  Component) {
               if (const ValueDecl *VD = MC.getAssociatedDeclaration()) {
@@ -12124,8 +12124,8 @@
                                                    const VarDecl *VD) {
   if (!VD)
     return Address::invalid();
-  Address UntiedAddr = Address::invalid();
-  Address UntiedRealAddr = Address::invalid();
+  Address UntiedAddr;
+  Address UntiedRealAddr;
   auto It = FunctionToUntiedTaskStackMap.find(CGF.CurFn);
   if (It != FunctionToUntiedTaskStackMap.end()) {
     const UntiedLocalVarsAddressesMap &UntiedData =
Index: clang/lib/CodeGen/CGObjCMac.cpp
===================================================================
--- clang/lib/CodeGen/CGObjCMac.cpp
+++ clang/lib/CodeGen/CGObjCMac.cpp
@@ -4644,7 +4644,7 @@
   // @synchronized.  We can't avoid a temp here because we need the
   // value to be preserved.  If the backend ever does liveness
   // correctly after setjmp, this will be unnecessary.
-  Address SyncArgSlot = Address::invalid();
+  Address SyncArgSlot;
   if (!isTry) {
     llvm::Value *SyncArg =
       CGF.EmitScalarExpr(cast<ObjCAtSynchronizedStmt>(S).getSynchExpr());
@@ -4682,7 +4682,7 @@
 
   // A slot containing the exception to rethrow.  Only needed when we
   // have both a @catch and a @finally.
-  Address PropagatingExnVar = Address::invalid();
+  Address PropagatingExnVar;
 
   // Push a normal cleanup to leave the try scope.
   CGF.EHStack.pushCleanup<PerformFragileFinally>(NormalAndEHCleanup, &S,
Index: clang/lib/CodeGen/CGObjC.cpp
===================================================================
--- clang/lib/CodeGen/CGObjC.cpp
+++ clang/lib/CodeGen/CGObjC.cpp
@@ -151,7 +151,7 @@
 
   // Allocate the temporary array(s).
   Address Objects = CreateMemTemp(ElementArrayType, "objects");
-  Address Keys = Address::invalid();
+  Address Keys;
   if (DLE)
     Keys = CreateMemTemp(ElementArrayType, "keys");
 
Index: clang/lib/CodeGen/CGExprScalar.cpp
===================================================================
--- clang/lib/CodeGen/CGExprScalar.cpp
+++ clang/lib/CodeGen/CGExprScalar.cpp
@@ -4684,7 +4684,7 @@
   if (Ty->isVariablyModifiedType())
     CGF.EmitVariablyModifiedType(Ty);
 
-  Address ArgValue = Address::invalid();
+  Address ArgValue;
   Address ArgPtr = CGF.EmitVAArg(VE, ArgValue);
 
   llvm::Type *ArgTy = ConvertType(VE->getType());
@@ -4867,7 +4867,7 @@
   // Generate code as for: *(Class*)object
 
   Expr *BaseExpr = E->getBase();
-  Address Addr = Address::invalid();
+  Address Addr;
   if (BaseExpr->isPRValue()) {
     Addr = Address(EmitScalarExpr(BaseExpr), getPointerAlign());
   } else {
Index: clang/lib/CodeGen/CGExprComplex.cpp
===================================================================
--- clang/lib/CodeGen/CGExprComplex.cpp
+++ clang/lib/CodeGen/CGExprComplex.cpp
@@ -1096,7 +1096,7 @@
 }
 
 ComplexPairTy ComplexExprEmitter::VisitVAArgExpr(VAArgExpr *E) {
-  Address ArgValue = Address::invalid();
+  Address ArgValue;
   Address ArgPtr = CGF.EmitVAArg(E, ArgValue);
 
   if (!ArgPtr.isValid()) {
Index: clang/lib/CodeGen/CGExprCXX.cpp
===================================================================
--- clang/lib/CodeGen/CGExprCXX.cpp
+++ clang/lib/CodeGen/CGExprCXX.cpp
@@ -125,7 +125,7 @@
     //   If the pseudo-expression names a retainable object with weak or
     //   strong lifetime, the object shall be released.
     Expr *BaseExpr = E->getBase();
-    Address BaseValue = Address::invalid();
+    Address BaseValue;
     Qualifiers BaseQuals;
 
     // If this is s.x, emit s as an lvalue. If it is s->x, emit s as a scalar.
@@ -441,7 +441,7 @@
       cast<CXXRecordDecl>(MPT->getClass()->castAs<RecordType>()->getDecl());
 
   // Emit the 'this' pointer.
-  Address This = Address::invalid();
+  Address This;
   if (BO->getOpcode() == BO_PtrMemI)
     This = EmitPointerWithAlignment(BaseExpr);
   else
@@ -992,7 +992,7 @@
   unsigned InitListElements = 0;
 
   const Expr *Init = E->getInitializer();
-  Address EndOfInit = Address::invalid();
+  Address EndOfInit;
   QualType::DestructionKind DtorKind = ElementType.isDestructedType();
   EHScopeStack::stable_iterator Cleanup;
   llvm::Instruction *CleanupDominator = nullptr;
@@ -1578,7 +1578,7 @@
 
   // Emit the allocation call.  If the allocator is a global placement
   // operator, just "inline" it directly.
-  Address allocation = Address::invalid();
+  Address allocation;
   CallArgList allocatorArgs;
   if (allocator->isReservedGlobalPlacementOperator()) {
     assert(E->getNumPlacementArgs() == 1);
Index: clang/lib/CodeGen/CGExprAgg.cpp
===================================================================
--- clang/lib/CodeGen/CGExprAgg.cpp
+++ clang/lib/CodeGen/CGExprAgg.cpp
@@ -266,8 +266,8 @@
   bool UseTemp = Dest.isPotentiallyAliased() || Dest.requiresGCollection() ||
                  (RequiresDestruction && !Dest.getAddress().isValid());
 
-  Address RetAddr = Address::invalid();
-  Address RetAllocaAddr = Address::invalid();
+  Address RetAddr;
+  Address RetAllocaAddr;
 
   EHScopeStack::stable_iterator LifetimeEndBlock;
   llvm::Value *LifetimeSizePtr = nullptr;
@@ -520,7 +520,7 @@
   // already-constructed members if an initializer throws.
   // For that, we'll need an EH cleanup.
   QualType::DestructionKind dtorKind = elementType.isDestructedType();
-  Address endOfInit = Address::invalid();
+  Address endOfInit;
   EHScopeStack::stable_iterator cleanup;
   llvm::Instruction *cleanupDominator = nullptr;
   if (CGF.needsEHCleanup(dtorKind)) {
@@ -1281,7 +1281,7 @@
 }
 
 void AggExprEmitter::VisitVAArgExpr(VAArgExpr *VE) {
-  Address ArgValue = Address::invalid();
+  Address ArgValue;
   Address ArgPtr = CGF.EmitVAArg(VE, ArgValue);
 
   // If EmitVAArg fails, emit an error.
Index: clang/lib/CodeGen/CGExpr.cpp
===================================================================
--- clang/lib/CodeGen/CGExpr.cpp
+++ clang/lib/CodeGen/CGExpr.cpp
@@ -507,7 +507,7 @@
   }
 
   // Create and initialize the reference temporary.
-  Address Alloca = Address::invalid();
+  Address Alloca;
   Address Object = createReferenceTemporary(*this, M, E, &Alloca);
   if (auto *Var = dyn_cast<llvm::GlobalVariable>(
           Object.getPointer()->stripPointerCasts())) {
@@ -2691,7 +2691,7 @@
           E->getLocation(), *VD->evaluateValue(), VD->getType());
       assert(Val && "failed to emit constant expression");
 
-      Address Addr = Address::invalid();
+      Address Addr;
       if (!VD->getType()->isReferenceType()) {
         // Spill the constant value to a global.
         Addr = CGM.createUnnamedGlobalFrom(*VD, Val,
@@ -2775,7 +2775,7 @@
     if (VD->hasLinkage() || VD->isStaticDataMember())
       return EmitGlobalVarDeclLValue(*this, E, VD);
 
-    Address addr = Address::invalid();
+    Address addr;
 
     // The variable should generally be present in the local decl map.
     auto iter = LocalDeclMap.find(VD);
@@ -3762,7 +3762,7 @@
 
   LValueBaseInfo EltBaseInfo;
   TBAAAccessInfo EltTBAAInfo;
-  Address Addr = Address::invalid();
+  Address Addr;
   if (const VariableArrayType *vla =
            getContext().getAsVariableArrayType(E->getType())) {
     // The base must be a pointer, which is not an aggregate.  Emit
@@ -4018,7 +4018,7 @@
   }
   assert(Idx);
 
-  Address EltPtr = Address::invalid();
+  Address EltPtr;
   LValueBaseInfo BaseInfo;
   TBAAAccessInfo TBAAInfo;
   if (auto *VLA = getContext().getAsVariableArrayType(ResultExprTy)) {
@@ -5316,7 +5316,7 @@
 
 LValue CodeGenFunction::
 EmitPointerToDataMemberBinaryExpr(const BinaryOperator *E) {
-  Address BaseAddr = Address::invalid();
+  Address BaseAddr;
   if (E->getOpcode() == BO_PtrMemI) {
     BaseAddr = EmitPointerWithAlignment(E->getLHS());
   } else {
Index: clang/lib/CodeGen/CGException.cpp
===================================================================
--- clang/lib/CodeGen/CGException.cpp
+++ clang/lib/CodeGen/CGException.cpp
@@ -1751,7 +1751,7 @@
   CodeGenFunction &ParentCGF;
   const VarDecl *ParentThis;
   llvm::SmallSetVector<const VarDecl *, 4> Captures;
-  Address SEHCodeSlot = Address::invalid();
+  Address SEHCodeSlot;
   CaptureFinder(CodeGenFunction &ParentCGF, const VarDecl *ParentThis)
       : ParentCGF(ParentCGF), ParentThis(ParentThis) {}
 
Index: clang/lib/CodeGen/CGDecl.cpp
===================================================================
--- clang/lib/CodeGen/CGDecl.cpp
+++ clang/lib/CodeGen/CGDecl.cpp
@@ -1432,9 +1432,9 @@
   auto *DI = getDebugInfo();
   bool EmitDebugInfo = DI && CGM.getCodeGenOpts().hasReducedDebugInfo();
 
-  Address address = Address::invalid();
-  Address AllocaAddr = Address::invalid();
-  Address OpenMPLocalAddr = Address::invalid();
+  Address address;
+  Address AllocaAddr;
+  Address OpenMPLocalAddr;
   if (CGM.getLangOpts().OpenMPIRBuilder)
     OpenMPLocalAddr = OMPBuilderCBHelpers::getAddressOfLocalVariable(*this, &D);
   else
@@ -2449,7 +2449,7 @@
     }
   }
 
-  Address DeclPtr = Address::invalid();
+  Address DeclPtr;
   bool DoStore = false;
   bool IsScalar = hasScalarEvaluationKind(Ty);
   // If we already have a pointer to the argument, reuse the input pointer.
Index: clang/lib/CodeGen/CGCoroutine.cpp
===================================================================
--- clang/lib/CodeGen/CGCoroutine.cpp
+++ clang/lib/CodeGen/CGCoroutine.cpp
@@ -475,7 +475,7 @@
   CodeGenFunction::AutoVarEmission GroEmission;
 
   GetReturnObjectManager(CodeGenFunction &CGF, const CoroutineBodyStmt &S)
-      : CGF(CGF), Builder(CGF.Builder), S(S), GroActiveFlag(Address::invalid()),
+      : CGF(CGF), Builder(CGF.Builder), S(S),
         GroEmission(CodeGenFunction::AutoVarEmission::invalid()) {}
 
   // The gro variable has to outlive coroutine frame and coroutine promise, but,
Index: clang/lib/CodeGen/CGCall.h
===================================================================
--- clang/lib/CodeGen/CGCall.h
+++ clang/lib/CodeGen/CGCall.h
@@ -360,7 +360,7 @@
 /// ReturnValueSlot - Contains the address where the return value of a
 /// function can be stored, and whether the address is volatile or not.
 class ReturnValueSlot {
-  Address Addr = Address::invalid();
+  Address Addr;
 
   // Return value slot flags
   unsigned IsVolatile : 1;
Index: clang/lib/CodeGen/CGCall.cpp
===================================================================
--- clang/lib/CodeGen/CGCall.cpp
+++ clang/lib/CodeGen/CGCall.cpp
@@ -2633,7 +2633,7 @@
 
   // If we're using inalloca, all the memory arguments are GEPs off of the last
   // parameter, which is a pointer to the complete memory area.
-  Address ArgStruct = Address::invalid();
+  Address ArgStruct;
   if (IRFunctionArgs.hasInallocaArg()) {
     ArgStruct = Address(Fn->getArg(IRFunctionArgs.getInallocaArgNo()),
                         FI.getArgStructAlignment());
@@ -2910,7 +2910,7 @@
         llvm::Type *DstTy = Ptr.getElementType();
         uint64_t DstSize = CGM.getDataLayout().getTypeAllocSize(DstTy);
 
-        Address AddrToStoreInto = Address::invalid();
+        Address AddrToStoreInto;
         if (SrcSize <= DstSize) {
           AddrToStoreInto = Builder.CreateElementBitCast(Ptr, STy);
         } else {
@@ -4674,7 +4674,7 @@
 
   // If we're using inalloca, insert the allocation after the stack save.
   // FIXME: Do this earlier rather than hacking it in here!
-  Address ArgMemory = Address::invalid();
+  Address ArgMemory;
   if (llvm::StructType *ArgStruct = CallInfo.getArgStruct()) {
     const llvm::DataLayout &DL = CGM.getDataLayout();
     llvm::Instruction *IP = CallArgs.getStackBase();
@@ -4698,8 +4698,8 @@
 
   // If the call returns a temporary with struct return, create a temporary
   // alloca to hold the result, unless one is given to us.
-  Address SRetPtr = Address::invalid();
-  Address SRetAlloca = Address::invalid();
+  Address SRetPtr;
+  Address SRetAlloca;
   llvm::Value *UnusedReturnSizePtr = nullptr;
   if (RetAI.isIndirect() || RetAI.isInAlloca() || RetAI.isCoerceAndExpand()) {
     if (!ReturnValue.isNull()) {
@@ -4721,8 +4721,8 @@
     }
   }
 
-  Address swiftErrorTemp = Address::invalid();
-  Address swiftErrorArg = Address::invalid();
+  Address swiftErrorTemp;
+  Address swiftErrorArg;
 
   // When passing arguments using temporary allocas, we need to add the
   // appropriate lifetime markers. This vector keeps track of all the lifetime
@@ -4944,7 +4944,7 @@
       }
 
       // FIXME: Avoid the conversion through memory if possible.
-      Address Src = Address::invalid();
+      Address Src;
       if (!I->isAggregate()) {
         Src = CreateMemTemp(I->Ty, "coerce");
         I->copyInto(*this, Src);
@@ -5011,8 +5011,8 @@
       auto layout = CGM.getDataLayout().getStructLayout(coercionType);
 
       llvm::Value *tempSize = nullptr;
-      Address addr = Address::invalid();
-      Address AllocaAddr = Address::invalid();
+      Address addr;
+      Address AllocaAddr;
       if (I->isAggregate()) {
         addr = I->hasLValue() ? I->getKnownLValue().getAddress(*this)
                               : I->getKnownRValue().getAggregateAddress();
Index: clang/lib/CodeGen/CGBuiltin.cpp
===================================================================
--- clang/lib/CodeGen/CGBuiltin.cpp
+++ clang/lib/CodeGen/CGBuiltin.cpp
@@ -1839,7 +1839,7 @@
         if (!isa<Constant>(ArgVal)) {
           CleanupKind Cleanup = getARCCleanupKind();
           QualType Ty = TheExpr->getType();
-          Address Alloca = Address::invalid();
+          Address Alloca;
           Address Addr = CreateMemTemp(Ty, "os.log.arg", &Alloca);
           ArgVal = EmitARCRetain(Ty, ArgVal);
           Builder.CreateStore(ArgVal, Addr);
@@ -7676,8 +7676,8 @@
     return Builder.getInt32(addr.getAlignment().getQuantity());
   };
 
-  Address PtrOp0 = Address::invalid();
-  Address PtrOp1 = Address::invalid();
+  Address PtrOp0;
+  Address PtrOp1;
   SmallVector<Value*, 4> Ops;
   bool HasExtraArg = HasExtraNeonArgument(BuiltinID);
   unsigned NumArgs = E->getNumArgs() - (HasExtraArg ? 1 : 0);
@@ -9748,7 +9748,7 @@
   assert(Error == ASTContext::GE_None && "Should not codegen an error");
 
   llvm::SmallVector<Value*, 4> Ops;
-  Address PtrOp0 = Address::invalid();
+  Address PtrOp0;
   for (unsigned i = 0, e = E->getNumArgs() - 1; i != e; i++) {
     if (i == 0) {
       switch (BuiltinID) {
Index: clang/lib/CodeGen/CGBlocks.cpp
===================================================================
--- clang/lib/CodeGen/CGBlocks.cpp
+++ clang/lib/CodeGen/CGBlocks.cpp
@@ -33,10 +33,9 @@
 using namespace CodeGen;
 
 CGBlockInfo::CGBlockInfo(const BlockDecl *block, StringRef name)
-  : Name(name), CXXThisIndex(0), CanBeGlobal(false), NeedsCopyDispose(false),
-    HasCXXObject(false), UsesStret(false), HasCapturedVariableLayout(false),
-    CapturesNonExternalType(false), LocalAddress(Address::invalid()),
-    StructureType(nullptr), Block(block) {
+    : Name(name), CXXThisIndex(0), CanBeGlobal(false), NeedsCopyDispose(false),
+      HasCXXObject(false), UsesStret(false), HasCapturedVariableLayout(false),
+      CapturesNonExternalType(false), StructureType(nullptr), Block(block) {
 
   // Skip asm prefix, if any.  'name' is usually taken directly from
   // the mangled name of the enclosing function.
@@ -922,7 +921,7 @@
 
     // Compute the address of the thing we're going to move into the
     // block literal.
-    Address src = Address::invalid();
+    Address src;
 
     if (blockDecl->isConversionFromLambda()) {
       // The lambda capture in a lambda's conversion-to-block-pointer is
Index: clang/lib/CodeGen/CGAtomic.cpp
===================================================================
--- clang/lib/CodeGen/CGAtomic.cpp
+++ clang/lib/CodeGen/CGAtomic.cpp
@@ -789,9 +789,9 @@
     MemTy = AT->getValueType();
   llvm::Value *IsWeak = nullptr, *OrderFail = nullptr;
 
-  Address Val1 = Address::invalid();
-  Address Val2 = Address::invalid();
-  Address Dest = Address::invalid();
+  Address Val1;
+  Address Val2;
+  Address Dest;
   Address Ptr = EmitPointerWithAlignment(E->getPtr());
 
   if (E->getOp() == AtomicExpr::AO__c11_atomic_init ||
@@ -1489,7 +1489,7 @@
 
   // Create a temporary.  This needs to be big enough to hold the
   // atomic integer.
-  Address Temp = Address::invalid();
+  Address Temp;
   bool TempIsVolatile = false;
   if (AsValue && getEvaluationKind() == TEK_Aggregate) {
     assert(!ResultSlot.isIgnored());
@@ -1570,7 +1570,7 @@
                                   bool IsVolatile) {
   // Check whether we should use a library call.
   if (shouldUseLibcall()) {
-    Address TempAddr = Address::invalid();
+    Address TempAddr;
     if (LVal.isSimple() && !ResultSlot.isIgnored()) {
       assert(getEvaluationKind() == TEK_Aggregate);
       TempAddr = ResultSlot.getAddress();
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D108459: [clang][CodeGe... Andy Wingo via Phabricator via cfe-commits

Reply via email to