Fold the following pattern: %0:_(p0) = G_CONSTANT i64 0 %1:_(s64) = G_PTRTOINT %0:_(p0) %2 = COPY %1(s64) Into: %0:_(s64) = G_CONSTANT i64 0 %1 = COPY %0(s64)
I think this is special cased for ConstantPointerNull
Should be able to just use replaceInstWithConstant
We already have a matchConstantOp, but that checks for a specific constant. Should have another generic one that checks for any constant
The patch was updated to the main branch.
Some background: we are upstreaming this pattern through the AArch64 because the target backend that we are developing in our company was not upstreamed yet. About usability, we observed that this pattern is being matched and can impact the final code.