[StackLifetime] More efficient loop for LivenessType::Must
authorVitaly Buka <vitalybuka@google.com>
Wed, 28 Sep 2022 06:41:32 +0000 (23:41 -0700)
committerVitaly Buka <vitalybuka@google.com>
Wed, 28 Sep 2022 23:28:45 +0000 (16:28 -0700)
commit01f3e2d6197829486622a440acca83786d52fc85
tree7883d699a37ec23ee77a572f64195c4c3598a8d0
parent95dabac7a5adf62af5c43863e7bf6db5d4437b72
[StackLifetime] More efficient loop for LivenessType::Must

CFG with cycles may requires additional passes of "while (Changed)"
iteration if to propagate data back from latter blocks to earlier blocks,
ordered according to depth_fist.

OR logic, used for ::May, converge to stable state faster then AND logic
use for ::Must.

Though the better solution is to switch to some some form of queue, but
having that this one is good enough, I will consider to do that later.

We can switch ::Must to OR logic if we calculate "may be dead" instead
of direct "must be alive" and then convert values to match existing
interface.

Additionally it fixes correctness in "@cycle" test.

Reviewed By: kstoimenov, fmayer

Differential Revision: https://reviews.llvm.org/D134796
llvm/lib/Analysis/StackLifetime.cpp
llvm/test/Analysis/StackSafetyAnalysis/lifetime.ll