[llvm] Clang-format coroutine files ahead of refactoring (PR #95583)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 14 11:49:44 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Tyler Nowicki (TylerNowicki)

<details>
<summary>Changes</summary>

To clean things up before refactoring apply clang-format changes to the coroutine sources. The files in lib/Transforms/Coroutines deviated from clang-format in a number of places.

---

Patch is 33.83 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/95583.diff


7 Files Affected:

- (modified) llvm/lib/Transforms/Coroutines/CoroCleanup.cpp (+3-4) 
- (modified) llvm/lib/Transforms/Coroutines/CoroEarly.cpp (+60-60) 
- (modified) llvm/lib/Transforms/Coroutines/CoroElide.cpp (+10-11) 
- (modified) llvm/lib/Transforms/Coroutines/CoroFrame.cpp (+46-45) 
- (modified) llvm/lib/Transforms/Coroutines/CoroInstr.h (+10-11) 
- (modified) llvm/lib/Transforms/Coroutines/CoroInternal.h (+9-12) 
- (modified) llvm/lib/Transforms/Coroutines/Coroutines.cpp (+30-28) 


``````````diff
diff --git a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
index 3e3825fcd50e2..ba933c0917e1c 100644
--- a/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroCleanup.cpp
@@ -8,10 +8,10 @@
 
 #include "llvm/Transforms/Coroutines/CoroCleanup.h"
 #include "CoroInternal.h"
+#include "llvm/IR/Function.h"
 #include "llvm/IR/IRBuilder.h"
 #include "llvm/IR/InstIterator.h"
 #include "llvm/IR/PassManager.h"
-#include "llvm/IR/Function.h"
 #include "llvm/Transforms/Scalar/SimplifyCFG.h"
 
 using namespace llvm;
@@ -25,7 +25,7 @@ struct Lowerer : coro::LowererBase {
   Lowerer(Module &M) : LowererBase(M), Builder(Context) {}
   bool lower(Function &F);
 };
-}
+} // namespace
 
 static void lowerSubFn(IRBuilder<> &Builder, CoroSubFnInst *SubFn) {
   Builder.SetInsertPoint(SubFn);
@@ -114,8 +114,7 @@ static bool declaresCoroCleanupIntrinsics(const Module &M) {
           "llvm.coro.async.size.replace", "llvm.coro.async.resume"});
 }
 
-PreservedAnalyses CoroCleanupPass::run(Module &M,
-                                       ModuleAnalysisManager &MAM) {
+PreservedAnalyses CoroCleanupPass::run(Module &M, ModuleAnalysisManager &MAM) {
   if (!declaresCoroCleanupIntrinsics(M))
     return PreservedAnalyses::all();
 
diff --git a/llvm/lib/Transforms/Coroutines/CoroEarly.cpp b/llvm/lib/Transforms/Coroutines/CoroEarly.cpp
index 489106422e199..a45fe61125690 100644
--- a/llvm/lib/Transforms/Coroutines/CoroEarly.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroEarly.cpp
@@ -38,7 +38,7 @@ class Lowerer : public coro::LowererBase {
                              ->getPointerTo()) {}
   void lowerEarlyIntrinsics(Function &F);
 };
-}
+} // namespace
 
 // Replace a direct call to coro.resume or coro.destroy with an indirect call to
 // an address returned by coro.subfn.addr intrinsic. This is done so that
@@ -66,8 +66,8 @@ void Lowerer::lowerCoroPromise(CoroPromiseInst *Intrin) {
   auto *SampleStruct =
       StructType::get(Context, {AnyResumeFnPtrTy, AnyResumeFnPtrTy, Int8Ty});
   const DataLayout &DL = TheModule.getDataLayout();
-  int64_t Offset = alignTo(
-      DL.getStructLayout(SampleStruct)->getElementOffset(2), Alignment);
+  int64_t Offset =
+      alignTo(DL.getStructLayout(SampleStruct)->getElementOffset(2), Alignment);
   if (Intrin->isFromPromise())
     Offset = -Offset;
 
@@ -104,7 +104,7 @@ void Lowerer::lowerCoroDone(IntrinsicInst *II) {
 static void buildDebugInfoForNoopResumeDestroyFunc(Function *NoopFn) {
   Module &M = *NoopFn->getParent();
   if (M.debug_compile_units().empty())
-     return;
+    return;
 
   DICompileUnit *CU = *M.debug_compile_units_begin();
   DIBuilder DB(M, /*AllowUnresolved*/ false, CU);
@@ -113,7 +113,7 @@ static void buildDebugInfoForNoopResumeDestroyFunc(Function *NoopFn) {
       DB.createSubroutineType(DB.getOrCreateTypeArray(Params));
   StringRef Name = NoopFn->getName();
   auto *SP = DB.createFunction(
-      CU, /*Name=*/Name, /*LinkageName=*/Name, /*File=*/ CU->getFile(),
+      CU, /*Name=*/Name, /*LinkageName=*/Name, /*File=*/CU->getFile(),
       /*LineNo=*/0, SubroutineType, /*ScopeLine=*/0, DINode::FlagArtificial,
       DISubprogram::SPFlagDefinition);
   NoopFn->setSubprogram(SP);
@@ -143,11 +143,11 @@ void Lowerer::lowerCoroNoop(IntrinsicInst *II) {
     ReturnInst::Create(C, Entry);
 
     // Create a constant struct for the frame.
-    Constant* Values[] = {NoopFn, NoopFn};
-    Constant* NoopCoroConst = ConstantStruct::get(FrameTy, Values);
-    NoopCoro = new GlobalVariable(M, NoopCoroConst->getType(), /*isConstant=*/true,
-                                GlobalVariable::PrivateLinkage, NoopCoroConst,
-                                "NoopCoro.Frame.Const");
+    Constant *Values[] = {NoopFn, NoopFn};
+    Constant *NoopCoroConst = ConstantStruct::get(FrameTy, Values);
+    NoopCoro = new GlobalVariable(
+        M, NoopCoroConst->getType(), /*isConstant=*/true,
+        GlobalVariable::PrivateLinkage, NoopCoroConst, "NoopCoro.Frame.Const");
   }
 
   Builder.SetInsertPoint(II);
@@ -176,57 +176,57 @@ void Lowerer::lowerEarlyIntrinsics(Function &F) {
       continue;
 
     switch (CB->getIntrinsicID()) {
-      default:
-        continue;
-      case Intrinsic::coro_free:
-        CoroFrees.push_back(cast<CoroFreeInst>(&I));
-        break;
-      case Intrinsic::coro_suspend:
-        // Make sure that final suspend point is not duplicated as CoroSplit
-        // pass expects that there is at most one final suspend point.
-        if (cast<CoroSuspendInst>(&I)->isFinal())
-          CB->setCannotDuplicate();
-        HasCoroSuspend = true;
-        break;
-      case Intrinsic::coro_end_async:
-      case Intrinsic::coro_end:
-        // Make sure that fallthrough coro.end is not duplicated as CoroSplit
-        // pass expects that there is at most one fallthrough coro.end.
-        if (cast<AnyCoroEndInst>(&I)->isFallthrough())
-          CB->setCannotDuplicate();
-        break;
-      case Intrinsic::coro_noop:
-        lowerCoroNoop(cast<IntrinsicInst>(&I));
-        break;
-      case Intrinsic::coro_id:
-        if (auto *CII = cast<CoroIdInst>(&I)) {
-          if (CII->getInfo().isPreSplit()) {
-            assert(F.isPresplitCoroutine() &&
-                   "The frontend uses Swtich-Resumed ABI should emit "
-                   "\"presplitcoroutine\" attribute for the coroutine.");
-            setCannotDuplicate(CII);
-            CII->setCoroutineSelf();
-            CoroId = cast<CoroIdInst>(&I);
-          }
+    default:
+      continue;
+    case Intrinsic::coro_free:
+      CoroFrees.push_back(cast<CoroFreeInst>(&I));
+      break;
+    case Intrinsic::coro_suspend:
+      // Make sure that final suspend point is not duplicated as CoroSplit
+      // pass expects that there is at most one final suspend point.
+      if (cast<CoroSuspendInst>(&I)->isFinal())
+        CB->setCannotDuplicate();
+      HasCoroSuspend = true;
+      break;
+    case Intrinsic::coro_end_async:
+    case Intrinsic::coro_end:
+      // Make sure that fallthrough coro.end is not duplicated as CoroSplit
+      // pass expects that there is at most one fallthrough coro.end.
+      if (cast<AnyCoroEndInst>(&I)->isFallthrough())
+        CB->setCannotDuplicate();
+      break;
+    case Intrinsic::coro_noop:
+      lowerCoroNoop(cast<IntrinsicInst>(&I));
+      break;
+    case Intrinsic::coro_id:
+      if (auto *CII = cast<CoroIdInst>(&I)) {
+        if (CII->getInfo().isPreSplit()) {
+          assert(F.isPresplitCoroutine() &&
+                 "The frontend uses Swtich-Resumed ABI should emit "
+                 "\"presplitcoroutine\" attribute for the coroutine.");
+          setCannotDuplicate(CII);
+          CII->setCoroutineSelf();
+          CoroId = cast<CoroIdInst>(&I);
         }
-        break;
-      case Intrinsic::coro_id_retcon:
-      case Intrinsic::coro_id_retcon_once:
-      case Intrinsic::coro_id_async:
-        F.setPresplitCoroutine();
-        break;
-      case Intrinsic::coro_resume:
-        lowerResumeOrDestroy(*CB, CoroSubFnInst::ResumeIndex);
-        break;
-      case Intrinsic::coro_destroy:
-        lowerResumeOrDestroy(*CB, CoroSubFnInst::DestroyIndex);
-        break;
-      case Intrinsic::coro_promise:
-        lowerCoroPromise(cast<CoroPromiseInst>(&I));
-        break;
-      case Intrinsic::coro_done:
-        lowerCoroDone(cast<IntrinsicInst>(&I));
-        break;
+      }
+      break;
+    case Intrinsic::coro_id_retcon:
+    case Intrinsic::coro_id_retcon_once:
+    case Intrinsic::coro_id_async:
+      F.setPresplitCoroutine();
+      break;
+    case Intrinsic::coro_resume:
+      lowerResumeOrDestroy(*CB, CoroSubFnInst::ResumeIndex);
+      break;
+    case Intrinsic::coro_destroy:
+      lowerResumeOrDestroy(*CB, CoroSubFnInst::DestroyIndex);
+      break;
+    case Intrinsic::coro_promise:
+      lowerCoroPromise(cast<CoroPromiseInst>(&I));
+      break;
+    case Intrinsic::coro_done:
+      lowerCoroDone(cast<IntrinsicInst>(&I));
+      break;
     }
   }
 
diff --git a/llvm/lib/Transforms/Coroutines/CoroElide.cpp b/llvm/lib/Transforms/Coroutines/CoroElide.cpp
index 74b5ccb7b9b71..a6634510b86dc 100644
--- a/llvm/lib/Transforms/Coroutines/CoroElide.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroElide.cpp
@@ -430,19 +430,18 @@ bool CoroIdElider::attemptElide() {
     NumOfCoroElided++;
 
 #ifndef NDEBUG
-      if (!CoroElideInfoOutputFilename.empty())
-        *getOrCreateLogFile() << "Elide " << CalleeCoroutineName << " in "
-                              << FEI.ContainingFunction->getName() << "\n";
+    if (!CoroElideInfoOutputFilename.empty())
+      *getOrCreateLogFile() << "Elide " << CalleeCoroutineName << " in "
+                            << FEI.ContainingFunction->getName() << "\n";
 #endif
 
-      ORE.emit([&]() {
-        return OptimizationRemark(DEBUG_TYPE, "CoroElide", CoroId)
-               << "'" << ore::NV("callee", CalleeCoroutineName)
-               << "' elided in '" << ore::NV("caller", CallerFunctionName)
-               << "' (frame_size="
-               << ore::NV("frame_size", FrameSizeAndAlign->first) << ", align="
-               << ore::NV("align", FrameSizeAndAlign->second.value()) << ")";
-      });
+    ORE.emit([&]() {
+      return OptimizationRemark(DEBUG_TYPE, "CoroElide", CoroId)
+             << "'" << ore::NV("callee", CalleeCoroutineName) << "' elided in '"
+             << ore::NV("caller", CallerFunctionName) << "' (frame_size="
+             << ore::NV("frame_size", FrameSizeAndAlign->first) << ", align="
+             << ore::NV("align", FrameSizeAndAlign->second.value()) << ")";
+    });
   } else {
     ORE.emit([&]() {
       auto Remark = OptimizationRemarkMissed(DEBUG_TYPE, "CoroElide", CoroId)
diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 8e829a53aeca2..1918d88d62244 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -602,7 +602,7 @@ class FrameTypeBuilder {
   std::optional<Align> MaxFrameAlignment;
 
   SmallVector<Field, 8> Fields;
-  DenseMap<Value*, unsigned> FieldIndexByKey;
+  DenseMap<Value *, unsigned> FieldIndexByKey;
 
 public:
   FrameTypeBuilder(LLVMContext &Context, const DataLayout &DL,
@@ -869,8 +869,7 @@ void FrameTypeBuilder::addFieldForAllocas(const Function &F,
     SWI->setDefaultDest(DestBB);
   }
   // This Debug Info could tell us which allocas are merged into one slot.
-  LLVM_DEBUG(for (auto &AllocaSet
-                  : NonOverlapedAllocas) {
+  LLVM_DEBUG(for (auto &AllocaSet : NonOverlapedAllocas) {
     if (AllocaSet.size() > 1) {
       dbgs() << "In Function:" << F.getName() << "\n";
       dbgs() << "Find Union Set "
@@ -900,7 +899,7 @@ void FrameTypeBuilder::finish(StructType *Ty) {
   StructAlign = SizeAndAlign.second;
 
   auto getField = [](const OptimizedStructLayoutField &LayoutField) -> Field & {
-    return *static_cast<Field *>(const_cast<void*>(LayoutField.Id));
+    return *static_cast<Field *>(const_cast<void *>(LayoutField.Id));
   };
 
   // We need to produce a packed struct type if there's a field whose
@@ -915,7 +914,7 @@ void FrameTypeBuilder::finish(StructType *Ty) {
   }();
 
   // Build the struct body.
-  SmallVector<Type*, 16> FieldTypes;
+  SmallVector<Type *, 16> FieldTypes;
   FieldTypes.reserve(LayoutFields.size() * 3 / 2);
   uint64_t LastOffset = 0;
   for (auto &LayoutField : LayoutFields) {
@@ -929,8 +928,8 @@ void FrameTypeBuilder::finish(StructType *Ty) {
     assert(Offset >= LastOffset);
     if (Offset != LastOffset) {
       if (Packed || alignTo(LastOffset, F.TyAlignment) != Offset)
-        FieldTypes.push_back(ArrayType::get(Type::getInt8Ty(Context),
-                                            Offset - LastOffset));
+        FieldTypes.push_back(
+            ArrayType::get(Type::getInt8Ty(Context), Offset - LastOffset));
     }
 
     F.Offset = Offset;
@@ -1145,10 +1144,9 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
   unsigned LineNum = PromiseDIVariable->getLine();
 
   DICompositeType *FrameDITy = DBuilder.createStructType(
-      DIS->getUnit(), Twine(F.getName() + ".coro_frame_ty").str(),
-      DFile, LineNum, Shape.FrameSize * 8,
-      Shape.FrameAlign.value() * 8, llvm::DINode::FlagArtificial, nullptr,
-      llvm::DINodeArray());
+      DIS->getUnit(), Twine(F.getName() + ".coro_frame_ty").str(), DFile,
+      LineNum, Shape.FrameSize * 8, Shape.FrameAlign.value() * 8,
+      llvm::DINode::FlagArtificial, nullptr, llvm::DINodeArray());
   StructType *FrameTy = Shape.FrameTy;
   SmallVector<Metadata *, 16> Elements;
   DataLayout Layout = F.getParent()->getDataLayout();
@@ -1387,8 +1385,8 @@ static StructType *buildFrameType(Function &F, coro::Shape &Shape,
   case coro::ABI::Retcon:
   case coro::ABI::RetconOnce: {
     auto Id = Shape.getRetconCoroId();
-    Shape.RetconLowering.IsFrameInlineInStorage
-      = (B.getStructSize() <= Id->getStorageSize() &&
+    Shape.RetconLowering.IsFrameInlineInStorage =
+        (B.getStructSize() <= Id->getStorageSize() &&
          B.getStructAlign() <= Id->getStorageAlignment());
     break;
   }
@@ -1799,8 +1797,8 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
       // AllocaInst. So We cast GEP to the AllocaInst here to re-use
       // the Frame storage.
       //
-      // Note: If we change the strategy dealing with alignment, we need to refine
-      // this casting.
+      // Note: If we change the strategy dealing with alignment, we need to
+      // refine this casting.
       if (GEP->getType() != Orig->getType())
         return Builder.CreateAddrSpaceCast(GEP, Orig->getType(),
                                            Orig->getName() + Twine(".cast"));
@@ -2406,7 +2404,7 @@ static bool isSuspendBlock(BasicBlock *BB) {
   return isa<AnyCoroSuspendInst>(BB->front());
 }
 
-typedef SmallPtrSet<BasicBlock*, 8> VisitedBlocksSet;
+typedef SmallPtrSet<BasicBlock *, 8> VisitedBlocksSet;
 
 /// Does control flow starting at the given block ever reach a suspend
 /// instruction before reaching a block in VisitedOrFreeBBs?
@@ -2451,10 +2449,12 @@ static bool willLeaveFunctionImmediatelyAfter(BasicBlock *BB,
                                               unsigned depth = 3) {
   // If we've bottomed out our depth count, stop searching and assume
   // that the path might loop back.
-  if (depth == 0) return false;
+  if (depth == 0)
+    return false;
 
   // If this is a suspend block, we're about to exit the resumption function.
-  if (isSuspendBlock(BB)) return true;
+  if (isSuspendBlock(BB))
+    return true;
 
   // Recurse into the successors.
   for (auto *Succ : successors(BB)) {
@@ -2472,7 +2472,8 @@ static bool localAllocaNeedsStackSave(CoroAllocaAllocInst *AI) {
   // the coro resumption frame.
   for (auto *U : AI->users()) {
     auto FI = dyn_cast<CoroAllocaFreeInst>(U);
-    if (!FI) continue;
+    if (!FI)
+      continue;
 
     if (!willLeaveFunctionImmediatelyAfter(FI->getParent()))
       return true;
@@ -2484,8 +2485,8 @@ static bool localAllocaNeedsStackSave(CoroAllocaAllocInst *AI) {
 
 /// Turn each of the given local allocas into a normal (dynamic) alloca
 /// instruction.
-static void lowerLocalAllocas(ArrayRef<CoroAllocaAllocInst*> LocalAllocas,
-                              SmallVectorImpl<Instruction*> &DeadInsts) {
+static void lowerLocalAllocas(ArrayRef<CoroAllocaAllocInst *> LocalAllocas,
+                              SmallVectorImpl<Instruction *> &DeadInsts) {
   for (auto *AI : LocalAllocas) {
     IRBuilder<> Builder(AI);
 
@@ -2504,9 +2505,9 @@ static void lowerLocalAllocas(ArrayRef<CoroAllocaAllocInst*> LocalAllocas,
       if (isa<CoroAllocaGetInst>(U)) {
         U->replaceAllUsesWith(Alloca);
 
-      // Replace frees with stackrestores.  This is safe because
-      // alloca.alloc is required to obey a stack discipline, although we
-      // don't enforce that structurally.
+        // Replace frees with stackrestores.  This is safe because
+        // alloca.alloc is required to obey a stack discipline, although we
+        // don't enforce that structurally.
       } else {
         auto FI = cast<CoroAllocaFreeInst>(U);
         if (StackSave) {
@@ -2524,9 +2525,9 @@ static void lowerLocalAllocas(ArrayRef<CoroAllocaAllocInst*> LocalAllocas,
 /// Turn the given coro.alloca.alloc call into a dynamic allocation.
 /// This happens during the all-instructions iteration, so it must not
 /// delete the call.
-static Instruction *lowerNonLocalAlloca(CoroAllocaAllocInst *AI,
-                                        coro::Shape &Shape,
-                                   SmallVectorImpl<Instruction*> &DeadInsts) {
+static Instruction *
+lowerNonLocalAlloca(CoroAllocaAllocInst *AI, coro::Shape &Shape,
+                    SmallVectorImpl<Instruction *> &DeadInsts) {
   IRBuilder<> Builder(AI);
   auto Alloc = Shape.emitAlloc(Builder, AI->getSize(), nullptr);
 
@@ -2567,11 +2568,10 @@ static Value *emitGetSwiftErrorValue(IRBuilder<> &Builder, Type *ValueTy,
 static Value *emitSetSwiftErrorValue(IRBuilder<> &Builder, Value *V,
                                      coro::Shape &Shape) {
   // Make a fake function pointer as a sort of intrinsic.
-  auto FnTy = FunctionType::get(Builder.getPtrTy(),
-                                {V->getType()}, false);
+  auto FnTy = FunctionType::get(Builder.getPtrTy(), {V->getType()}, false);
   auto Fn = ConstantPointerNull::get(Builder.getPtrTy());
 
-  auto Call = Builder.CreateCall(FnTy, Fn, { V });
+  auto Call = Builder.CreateCall(FnTy, Fn, {V});
   Shape.SwiftErrorOps.push_back(Call);
 
   return Call;
@@ -2638,9 +2638,9 @@ static void eliminateSwiftErrorAlloca(Function &F, AllocaInst *Alloca,
 /// and then loading and storing in the prologue and epilog.
 ///
 /// The argument keeps the swifterror flag.
-static void eliminateSwiftErrorArgument(Function &F, Argument &Arg,
-                                        coro::Shape &Shape,
-                             SmallVectorImpl<AllocaInst*> &AllocasToPromote) {
+static void
+eliminateSwiftErrorArgument(Function &F, Argument &Arg, coro::Shape &Shape,
+                            SmallVectorImpl<AllocaInst *> &AllocasToPromote) {
   IRBuilder<> Builder(F.getEntryBlock().getFirstNonPHIOrDbg());
 
   auto ArgTy = cast<PointerType>(Arg.getType());
@@ -2658,14 +2658,14 @@ static void eliminateSwiftErrorArgument(Function &F, Argument &Arg,
 
   // Find all the suspends in the function and save and restore around them.
   for (auto *Suspend : Shape.CoroSuspends) {
-    (void) emitSetAndGetSwiftErrorValueAround(Suspend, Alloca, Shape);
+    (void)emitSetAndGetSwiftErrorValueAround(Suspend, Alloca, Shape);
   }
 
   // Find all the coro.ends in the function and restore the error value.
   for (auto *End : Shape.CoroEnds) {
     Builder.SetInsertPoint(End);
     auto FinalValue = Builder.CreateLoad(ValueTy, Alloca);
-    (void) emitSetSwiftErrorValue(Builder, FinalValue, Shape);
+    (void)emitSetSwiftErrorValue(Builder, FinalValue, Shape);
   }
 
   // Now we can use the alloca logic.
@@ -2676,11 +2676,12 @@ static void eliminateSwiftErrorArgument(Function &F, Argument &Arg,
 /// Eliminate all problematic uses of swifterror arguments and allocas
 /// from the function.  We'll fix them up later when splitting the function.
 static void eliminateSwiftError(Function &F, coro::Shape &Shape) {
-  SmallVector<AllocaInst*, 4> AllocasToPromote;
+  SmallVector<AllocaInst *, 4> AllocasToPromote;
 
   // Look for a swifterror argument.
   for (auto &Arg : F.args()) {
-    if (!Arg.hasSwiftErrorAttr()) continue;
+    if (!Arg.hasSwiftErrorAttr())
+      continue;
 
     eliminateSwiftErrorArgument(F, Arg, Shape, AllocasToPromote);
     break;
@@ -2689,7 +2690,8 @@ static void eliminateSwiftError(Function &F, coro::Shape &Shape) {
   // Look for swifterror allocas.
   for (auto &Inst : F.getEntryBlock()) {
     auto Alloca = dyn_cast<AllocaInst>(&Inst);
-    if (!Alloca || !Alloca->isSwiftError()) continue;
+    if (!Alloca || !Alloca->isSwiftError())
+      continue;
 
     // Clear the swifterror flag.
     Alloca->setSwiftError(false);
@@ -2772,7 +2774,7 @@ static void sinkLifetimeStartMarkers(Function &F, coro::Shape &Shape,
   }
 
   for (Instruction &I : instructions(F)) {
-    AllocaInst* AI = dyn_cast<AllocaInst>(&I);
+    AllocaInst *AI = dyn_...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/95583


More information about the llvm-commits mailing list