[PATCH] D11596: Separate out BDCE's analysis into a separate DemandedBits analysis.
hfinkel@anl.gov via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 12 10:33:01 PDT 2015
hfinkel added a comment.
In http://reviews.llvm.org/D11596#222847, @jmolloy wrote:
> Hi Hal,
>
> I've updated the diff with most of your comments updated, however:
>
> > Is looks like, as you have it setup, getDemandedBits will return all ones for an instruction not in the map (for any instruction for which DB.demandedBitsKnown(&I) would return false). As a result, we don't need the DB.demandedBitsKnown(&I) check and can just use the DB.getDemandedBits check (avoiding repeating the map lookup).
>
>
> Unfortunately this isn't the case. BDCE expects to handle the case where an instruction was analyzed, but has bits demanded differently to an instruction that wasn't even analyzed. In the second case it expects to dive off down the else path, in the first case it doesn't. Changing that behavior at all leads to lots of use-before-free asserts.
I'm not sure what exactly you did, but the underlying logic should be this:
if (instruction is dead) {
mark for deletion
} else if (all bits are dead and has an integer type) {
replace all uses with zero
mark for deletion
}
if (marked for deletion && not an always-live instruction) {
drop references and add to the to-delete worklist
}
I believe to implement my suggestion, you'll need to slightly rearrange the logic there. Thanks again!
> James
Repository:
rL LLVM
http://reviews.llvm.org/D11596
More information about the llvm-commits
mailing list