[llvm] [GlobalISel][AArch64] Generate ptrtoint/inttoptr as opposed to bitcast in unmerge combine. (PR #115225)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 8 07:51:50 PST 2024
================
@@ -1218,8 +1218,14 @@ class LegalizationArtifactCombiner {
} else {
LLT MergeSrcTy = MRI.getType(MergeI->getOperand(1).getReg());
- if (!ConvertOp && DestTy != MergeSrcTy)
- ConvertOp = TargetOpcode::G_BITCAST;
+ if (!ConvertOp && DestTy != MergeSrcTy) {
+ if (DestTy.isPointer())
+ ConvertOp = TargetOpcode::G_INTTOPTR;
+ else if (MergeSrcTy.isPointer())
+ ConvertOp = TargetOpcode::G_PTRTOINT;
+ else
+ ConvertOp = TargetOpcode::G_BITCAST;
----------------
davemgreen wrote:
Yeah - there is some code in MachineIRBuilder::buildCast that does something quite similar
https://github.com/llvm/llvm-project/pull/115225
More information about the llvm-commits
mailing list