Skip to content

Commit 62da62d

Browse files
committed
[GlobalISel][AArch64] Generate ptrtoint/inttoptr as opposed to bitcast in unmerge combine.
When combining unmerge we could end up with ptr to i64 bitcasts. Make sure they are created as ptrtoint/inttoptr instead. Some of the test are still disabled as they hit other issues.
1 parent 3d4d033 commit 62da62d

File tree

2 files changed

+462
-2
lines changed

2 files changed

+462
-2
lines changed

llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,8 +1218,14 @@ class LegalizationArtifactCombiner {
12181218
} else {
12191219
LLT MergeSrcTy = MRI.getType(MergeI->getOperand(1).getReg());
12201220

1221-
if (!ConvertOp && DestTy != MergeSrcTy)
1222-
ConvertOp = TargetOpcode::G_BITCAST;
1221+
if (!ConvertOp && DestTy != MergeSrcTy) {
1222+
if (DestTy.isPointer())
1223+
ConvertOp = TargetOpcode::G_INTTOPTR;
1224+
else if (MergeSrcTy.isPointer())
1225+
ConvertOp = TargetOpcode::G_PTRTOINT;
1226+
else
1227+
ConvertOp = TargetOpcode::G_BITCAST;
1228+
}
12231229

12241230
if (ConvertOp) {
12251231
Builder.setInstr(MI);

0 commit comments

Comments
 (0)