[PATCH] D71974: [Attributor][WIP] Connect AAIsDead with AAUndefinedBehavior
Stefanos Baziotis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 20 17:14:18 PST 2020
baziotis updated this revision to Diff 245764.
baziotis added a comment.
- Rebased with AAUB not manifesting
In this diff, note that I have commented the manifesting in AAUB, so that, for now, we can test UB blocks are deleted because of AAIsDead.
Btw, may I throw the idea that this be done in the end ? That is, blocks be deleted only because of AAIsDead.
Anyway, here are some examples:
define i32 @cond_br_on_undef_interproc(i1 %cond) {
br i1 %cond, label %t, label %e
t:
%a = load i32, i32* null
ret i32 1
e:
ret i32 2
}
In here, happens what we expect. The entry block is marked live initially and then in `AAIsDeadFunction::updateImpl()` the block with the UB is removed from alive blocks.
When the manifest phase in `Attributor::run()` comes, `AAIsDeadFunction` has 2/3 live blocks, so it is considered live (the AA) and its manifest ultimately deletes the block.
define i32 @example(i1* %alloc) {
%cond = load i1, i1* %alloc
br i1 %cond, label %t, label %e
t:
ret i32 1
e:
ret i32 2
}
Here, `isAssumedToCauseUB()` is overoptimistic and that means that the branch is assumed UB and its block is removed in `AAIsDeadFunction::updateImpl()`.
The catch is that although assumed information is used, AAUB never corrects that since it looks at live instructions for UB.
That's a problem in and of itself but that was happening before. The weird thing is that in the manifest stage of `run`, `AAIsDeadFunction` is considered
dead because the entry point of the function is considered dead. Shouldn't that mean that the function has to be deleted?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71974/new/
https://reviews.llvm.org/D71974
Files:
llvm/include/llvm/Transforms/IPO/Attributor.h
llvm/lib/Transforms/IPO/Attributor.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71974.245764.patch
Type: text/x-patch
Size: 4781 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200221/3d0b7747/attachment.bin>
More information about the llvm-commits
mailing list