Conditional branching, intrinsics experimental_guard and assume may state that their arguments are true/false.
This patch performs a refactoring (which is supposed to be a NFC) that changes interface and internals of SimpleValue
to accept Values instead of Instructions. Currently, all non-instruction values get rejected on in canHandle method to
preserve the existing behavior, but this will change in a follow-up patch.
Details
Diff Detail
Event Timeline
lib/Transforms/Scalar/EarlyCSE.cpp | ||
---|---|---|
68 | These three cover functions seem to obscure more than they help clarify. Or at least they did for me. I'd advice removing them and just directly working with the Val field. | |
82 | A tactical suggestion here: do the refactoring to change all the types w/o actually adding values to the canHandle predicate then separately check in the change which actually allows the Values to flow through. (i.e. basically return false here in the initial patch) The reasoning here is that if this does expose a problem (miscompile, crash, etc..), knowing whether you made a mistake in the refactoring part or if the value handling itself was the actual guilty party will be useful. Not a required change, but something I would encourage. | |
112 | This would be more idiomatic as: return hash_combine(Val.Val); |
Splitting the change into two. This becomes a non-functional change of SimpleValue interface and internals.
Hold this until https://reviews.llvm.org/D32641 is done properly. This patch does not make sense separately.
These three cover functions seem to obscure more than they help clarify. Or at least they did for me. I'd advice removing them and just directly working with the Val field.