[PATCH] D87596: [Coroutines] Reuse storage for local variables with non-overlapping lifetimes

Xun Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 17:21:17 PDT 2020


lxfind added a comment.

Thanks for the improvements. I believe the implementation can still be cleaner:
Instead of passing all those parameters to the constructor of `FrameTypeBuilder`, we could:

- Move all the implementation details into `addFieldForAllocas` function. We don't even need the `NonOverlappedAllocaInfo` class, all variables and the body of `run()` could go in there.
- We can change the type of `ForSpill` member of `Field` from pointer to a `SmallVector` of `Spill`. That way, you can handle `ForSpill` universally without knowing whether this optimization was turned on or not.



================
Comment at: llvm/lib/Passes/PassBuilder.cpp:1710-1715
     int OptLevel = StringSwitch<int>(ParamName)
                        .Case("O0", 0)
                        .Case("O1", 1)
                        .Case("O2", 2)
                        .Case("O3", 3)
                        .Default(-1);
----------------
I think you can use the same code like this, which appears to be simpler.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87596/new/

https://reviews.llvm.org/D87596



More information about the llvm-commits mailing list