[PATCH] D134796: [StackLifetime] More efficient loop for LivenessType::Must

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 28 13:35:33 PDT 2022


vitalybuka marked an inline comment as done.
vitalybuka added inline comments.


================
Comment at: llvm/lib/Analysis/StackLifetime.cpp:199-200
+      // Everything is "may be dead" for entry without predecessors.
+      if (Type == LivenessType::Must && BitsIn.empty())
+        BitsIn.resize(NumAllocas, true);
+
----------------
fmayer wrote:
> if you wanted to micro-optimize, you could put the `BlockInfo.LiveIn |= BitsIn` in this condition, and make the one below an `else if`. 
I'll keep as-is for simplicity. This apply only to the entry.


================
Comment at: llvm/lib/Analysis/StackLifetime.cpp:216-217
+      case LivenessType::May:
+        // "may be alive" is set by lifetime start.
+        BitsIn.reset(BlockInfo.End);
+        BitsIn |= BlockInfo.Begin;
----------------
fmayer wrote:
> these comments are a bit confusing. it says "set by lifetime start" then uses BlockInfo.End.
I'll move to the next line in the next snapshot.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134796



More information about the llvm-commits mailing list