This allows other areas of the compiler (LoopVectorize, soon!) to use BDCE's bit-tracking.
NFCI.
Paths
| Differential D11596
Separate out BDCE's analysis into a separate DemandedBits analysis. ClosedPublic Authored by jmolloy on Jul 29 2015, 8:29 AM.
Details
Summary This allows other areas of the compiler (LoopVectorize, soon!) to use BDCE's bit-tracking. NFCI.
Diff Detail
Event Timeline
Comment Actions Hi Hal, I've updated the diff with most of your comments updated, however:
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. James Comment Actions
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!
jmolloy edited edge metadata. Comment ActionsHi Hal, I worked out where I was getting confused. In DemandedBits, the "Visited" set only contains non-integer instructions. In "isInstructionDead" I was only visiting membership of the Visited set - I needed to check membership of AliveBits too because that's where all the integer types live. With that change, I've been able to do away with a no-longer needed API function and the code looks a lot neater. Cheers, James hfinkel edited edge metadata. Comment ActionsOne comment below, otherwise LGTM.
This revision is now accepted and ready to land.Aug 13 2015, 5:31 PM Comment Actions Hi Hal, Thanks, I removed the isAlwaysLive() check (and function) and simplified the logic in r245038. Cheers, James
Revision Contents
Diff 32039 include/llvm/Analysis/DemandedBits.h
include/llvm/InitializePasses.h
lib/Analysis/Analysis.cpp
lib/Analysis/CMakeLists.txt
lib/Analysis/DemandedBits.cpp
lib/Transforms/Scalar/BDCE.cpp
|
I think that I prefer the present tense for analysis results, let's name this: