Details
Diff Detail
Event Timeline
include/llvm/Analysis/InstructionPrecedenceTracking.h | ||
---|---|---|
54 | I really really think there should be a destructor here which checks to make sure the information is still valid. If the info is no longer used, a client can call clear explicitly. | |
lib/Analysis/InstructionPrecedenceTracking.cpp | ||
36 | As noted, calling this here makes this operation unexpected O(Inst in F) in the worst case. Please check only the containing block. | |
79 | This comment caused me to misread. Something more along the lines of: |
include/llvm/Analysis/InstructionPrecedenceTracking.h | ||
---|---|---|
54 | I don't understand why we want it to be valid on destructor. We definitely are not going to use this after the destructor is executed, it's OK if it contains garbage. We only want the contents to be OK on *queries*. |
lib/Analysis/InstructionPrecedenceTracking.cpp | ||
---|---|---|
36 | This is intentional. If we have modified a block and haven't dropped cached info, we want to detect it as early as possible, specifically when we make *any* query to this tracking. Imagine we've screwed up invalidating a block A, then did 100 correct modifications and queries to other blocks and then requested something for A. The assertion will fail, and it will be very hard to figure out what and when has happened. On the other hand, in current strategy we will be able to detect that we've screwed up whenever any query is made, which was the entire point of making this patch. I don't think that win on compile time in debug mode is worth making investigation of functional bugs more complex. |
After offline discussion with Philip, we agreed on the following version: by default, we have one-block verification to keep compile time in reasonable bounds. For troubleshooting purposes, there is an option (false by default and with no intention to turn it on) to diagnose it. Assertion on destructor does not happen because we don't have a commitment to keep the information valid after the last point where the last query was made.
LGTM w/ changes made before submit.
include/llvm/Analysis/InstructionPrecedenceTracking.h | ||
---|---|---|
42 | You're better off defining the behaviour as being erroneous. (i.e. illegal). Suggest alternate wording: | |
lib/Analysis/InstructionPrecedenceTracking.cpp | ||
77 | Optional, can be follow up: You'd be better to reduce the scope of the conditional compilation by using a conditional early return in this function. | |
101 | You can write this as: since you've already validated each bloc, if there are no other special instructions, no further validation is needed. |
lib/Analysis/InstructionPrecedenceTracking.cpp | ||
---|---|---|
101 | It is not true. We can have some block in KnownBlocks and nothing in FirstSpecialInsts, and it will mean that there is no special instructions in this block. Maybe it makes sense to put nullptr for such blocks instead and completely eliminate KnownBlocks, I'll do it as a follow-up NFC. |
lib/Analysis/InstructionPrecedenceTracking.cpp | ||
---|---|---|
101 | https://reviews.llvm.org/rL341531 This looks much more clearly now. |
You're better off defining the behaviour as being erroneous. (i.e. illegal). Suggest alternate wording:
This helps to catch the usage error of accessing a block without properly invalidating after a previous transform.