Skip to content

Commit a9fae58

Browse files
committed
[Transforms/Coroutines] llvm::Optional => std::optional
1 parent 21cd58b commit a9fae58

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,10 @@ class FrameTypeBuilder;
303303
using SpillInfo = SmallMapVector<Value *, SmallVector<Instruction *, 2>, 8>;
304304
struct AllocaInfo {
305305
AllocaInst *Alloca;
306-
DenseMap<Instruction *, llvm::Optional<APInt>> Aliases;
306+
DenseMap<Instruction *, std::optional<APInt>> Aliases;
307307
bool MayWriteBeforeCoroBegin;
308308
AllocaInfo(AllocaInst *Alloca,
309-
DenseMap<Instruction *, llvm::Optional<APInt>> Aliases,
309+
DenseMap<Instruction *, std::optional<APInt>> Aliases,
310310
bool MayWriteBeforeCoroBegin)
311311
: Alloca(Alloca), Aliases(std::move(Aliases)),
312312
MayWriteBeforeCoroBegin(MayWriteBeforeCoroBegin) {}
@@ -438,14 +438,14 @@ class FrameTypeBuilder {
438438
Align StructAlign;
439439
bool IsFinished = false;
440440

441-
Optional<Align> MaxFrameAlignment;
441+
std::optional<Align> MaxFrameAlignment;
442442

443443
SmallVector<Field, 8> Fields;
444444
DenseMap<Value*, unsigned> FieldIndexByKey;
445445

446446
public:
447447
FrameTypeBuilder(LLVMContext &Context, const DataLayout &DL,
448-
Optional<Align> MaxFrameAlignment)
448+
std::optional<Align> MaxFrameAlignment)
449449
: DL(DL), Context(Context), MaxFrameAlignment(MaxFrameAlignment) {}
450450

451451
/// Add a field to this structure for the storage of an `alloca`
@@ -1133,7 +1133,7 @@ static StructType *buildFrameType(Function &F, coro::Shape &Shape,
11331133
}();
11341134

11351135
// We will use this value to cap the alignment of spilled values.
1136-
Optional<Align> MaxFrameAlignment;
1136+
std::optional<Align> MaxFrameAlignment;
11371137
if (Shape.ABI == coro::ABI::Async)
11381138
MaxFrameAlignment = Shape.AsyncLowering.getContextAlignment();
11391139
FrameTypeBuilder B(C, DL, MaxFrameAlignment);
@@ -1180,7 +1180,7 @@ static StructType *buildFrameType(Function &F, coro::Shape &Shape,
11801180
// We assume that the promise alloca won't be modified before
11811181
// CoroBegin and no alias will be create before CoroBegin.
11821182
FrameData.Allocas.emplace_back(
1183-
PromiseAlloca, DenseMap<Instruction *, llvm::Optional<APInt>>{}, false);
1183+
PromiseAlloca, DenseMap<Instruction *, std::optional<APInt>>{}, false);
11841184
// Create an entry for every spilled value.
11851185
for (auto &S : FrameData.Spills) {
11861186
Type *FieldType = S.first->getType();
@@ -1405,7 +1405,7 @@ struct AllocaUseVisitor : PtrUseVisitor<AllocaUseVisitor> {
14051405

14061406
bool getMayWriteBeforeCoroBegin() const { return MayWriteBeforeCoroBegin; }
14071407

1408-
DenseMap<Instruction *, llvm::Optional<APInt>> getAliasesCopy() const {
1408+
DenseMap<Instruction *, std::optional<APInt>> getAliasesCopy() const {
14091409
assert(getShouldLiveOnFrame() && "This method should only be called if the "
14101410
"alloca needs to live on the frame.");
14111411
for (const auto &P : AliasOffetMap)
@@ -1422,7 +1422,7 @@ struct AllocaUseVisitor : PtrUseVisitor<AllocaUseVisitor> {
14221422
// All alias to the original AllocaInst, created before CoroBegin and used
14231423
// after CoroBegin. Each entry contains the instruction and the offset in the
14241424
// original Alloca. They need to be recreated after CoroBegin off the frame.
1425-
DenseMap<Instruction *, llvm::Optional<APInt>> AliasOffetMap{};
1425+
DenseMap<Instruction *, std::optional<APInt>> AliasOffetMap{};
14261426
SmallPtrSet<Instruction *, 4> Users{};
14271427
SmallPtrSet<IntrinsicInst *, 2> LifetimeStarts{};
14281428
bool MayWriteBeforeCoroBegin{false};

0 commit comments

Comments
 (0)