Some checks in isSafeToMoveBefore are independent of insert point, this patch isolate those checks and also adds some trivial checks from LICM. This is a work in progress until we move all the conservative insert point independent checks here from LICM.
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Event Timeline
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
308 | These conditions are inherited from LICM, is this a generalized safe assumption? Is there any very obvious exception to this? |
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
313 | why do we start allowing terminators as safe candidates for code motion? Has this constraint been moved to another place that doesn't show up in this patch? The same question applies to checking for isa<PHINode>(InsertPoint) above. |
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
308 | Not sure how this list is generated in LICM. Is it trying to exclude PHINode and terminators (e.g. BranchInst, SwitchInst, ...)? If so, then those was excluded in isSafeToMoveBefore originally. | |
323 | This is covered in line 380. |
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
313 | Type of instructions are limited using isSafeToMove. |
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
308 | No failing test case yet and it does reflect the old TermInst and PHINode checks so it seems okay to me to keep this. | |
323 | Thanks, that check is dependent on DT. I can remove this from here but I'll wait until we decide on keeping DT and PDT as optional argument as then we may end up missing this check. (I'll also look into other such checks if we decide to make DT and PDT optional). |
llvm/lib/Transforms/Utils/CodeMoverUtils.cpp | ||
---|---|---|
323 | I see that you are moving a subset of checks from LICM over here, how is this set of checks selected from LICM? |
Looks like a reasonable cleanup making safety checks reusable.
Please run check-all to check the statistics you're changing are not checked for in unit tests.
These conditions are inherited from LICM, is this a generalized safe assumption? Is there any very obvious exception to this?