D104143 introduced canonical value numbering between regions, which allows for the easy identification of items across a region, eliminating the need in the outliner to create parallel lists of instructions for each region, and replace output values in a less convoluted way,
Details
Diff Detail
Event Timeline
| llvm/include/llvm/Transforms/IPO/IROutliner.h | ||
|---|---|---|
| 166 | I'd drop the Optional<> and use nullptr to represent "didn't find one". That removes ambiguity around Optional<Value*>(nullptr), and would improve the call sites. | |
| llvm/lib/Transforms/IPO/IROutliner.cpp | ||
| 1145–1152 | ||
| 1159 | ... to fix the dereference after dyn_cast without checking it for null. | |
| 1165 | ||
| llvm/include/llvm/Transforms/IPO/IROutliner.h | ||
|---|---|---|
| 166 | +1 | |
| llvm/lib/Transforms/IPO/IROutliner.cpp | ||
|---|---|---|
| 173 | I think you can return FoundValueOpt.getValueOr(nullptr). | |
This looks okay with nits.
I think the commit message can be more descriptive here though. It should explain why you're changing behaviour surrounding PHIs/stores etc.
| llvm/lib/Transforms/IPO/IROutliner.cpp | ||
|---|---|---|
| 1147 | https://llvm.org/docs/ProgrammersManual.html#the-isa-cast-and-dyn-cast-templates Seems like it's more appropriate to use cast here than dyn_cast, considering you assert right after. | |
| 1148 | ||
I'd drop the Optional<> and use nullptr to represent "didn't find one". That removes ambiguity around Optional<Value*>(nullptr), and would improve the call sites.