We currently bail out of global localization if the global has non-instruction users. However, often these can be simple bitcasts or constant-GEPs, which we can easily turn into instructions before localizing. Be a bit more aggressive.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LGTM with some comments.
lib/Transforms/IPO/GlobalOpt.cpp | ||
---|---|---|
1845 | Nit: A common pattern is to put UUsers out of the loop and call clear at the end of each iteration. So that if you cross the limit of 4 multiple times you won't pay the dynamic allocation (and the copy) again. | |
1849 | Minor suggestion: I'd rather read assert(isa<Instruction>) before cast<Instruction> | |
test/Transforms/GlobalOpt/localize-constexpr.ll | ||
9 | The last check is spurious. The next CHECK-LABEL should be enough I think. |
Nit: A common pattern is to put UUsers out of the loop and call clear at the end of each iteration. So that if you cross the limit of 4 multiple times you won't pay the dynamic allocation (and the copy) again.