currently G_PHIs which are not used are still not cleaned up by DCE (as it's currently not considered safe to move). This patch changes that for G_PHI (not the PHI instruction).
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
LGTM with a nit. Also we should consider whether we ought to be calling isSafeToMove() when we're not moving things.
lib/CodeGen/GlobalISel/Utils.cpp | ||
---|---|---|
140 | As a side note, isSafeToMove() doesn't seem like the right check in any case since we're not planning to move it. We really want a mayHaveSideEffects() or isSafeToErase(). That said, the contents would be largely the same so it makes little difference aside from clearer labelling of the intent. | |
141 | We should use isPhi() instead. It's just as valid to delete dead PHI's we have in the late stages of the pipeline as it is to delete dead G_PHI's in the early stages |
As a side note, isSafeToMove() doesn't seem like the right check in any case since we're not planning to move it. We really want a mayHaveSideEffects() or isSafeToErase(). That said, the contents would be largely the same so it makes little difference aside from clearer labelling of the intent.