[PATCH] D64162: Summary: [Attributor] Liveness analysis abstract attribute used to indicate which BasicBlocks are dead and can therefore be ignored.
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 17 16:47:54 PDT 2019
jdoerfert added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:999
+
+struct AAIsDeadFunction : AAIsDead, BooleanState {
+
----------------
I guess that calling this a function attribute (here and elsewhere) is not really the right thing to do but we do not have any concept that would fit better right now.
================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1028
+ const std::string getAsStr() const override {
+ return getAssumed() ? "dead" : "maybe-dead";
+ }
----------------
maybe print something like:
`"LiveBBs(" << AssumedLiveBlocks.size() << "/" << getAnchoredScope().size() << ")"`
================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:1103
+
+ I = I->getNextNode();
+ }
----------------
Let's assume you get in here for an assumed noreturn call `NC` which is not assume noreturn anymore, you iterate over the block until you find one that is noreturn. In that case you return `false` above which would *not* remove the former assumed noreturn call `NC` from the `NoReturnCalls` set, causing us to introduce an unreachable at the end! You have to return `true` whenever the original instruction `I` is not assumed noreturn anymore, e.g., one you call `I->getNextNode` we cannot return `false` anymore
test case sketch
```
bb:
call %assumed_noreturn_but_actually_return
call %noreturn
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64162/new/
https://reviews.llvm.org/D64162
More information about the llvm-commits
mailing list