This would break for speculatable and convergent intrinsic calls.
Diff Detail
Diff Detail
Event Timeline
Comment Actions
I don't think we need the AMDGPU test case specialization here. A generic test with a convergent and one with a non-duplicatable call would make more sense to me.
Comment Actions
It concludes an arbitrary call is too expensive, so the problem doesn't manifest. I didn't see any control to override the cost
Comment Actions
Last request from my side, a positive test that looks exactly the same but without the convergent/noduplicate to make sure it is actually transformed.
Otherwise, this looks good to me.