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)
Details
- Reviewers
qcolombet aditya_nandakumar paquette
Diff Detail
Event Timeline
Well, we have this folding implemented in our development branch (custom target) and we think it is interesting for AArch64 too.
I think this is special cased for ConstantPointerNull
llvm/include/llvm/Target/GlobalISel/Combine.td | ||
---|---|---|
514 | Should be able to just use replaceInstWithConstant | |
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
2095–2098 | 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.
Should be able to just use replaceInstWithConstant