Skip to content

Commit 72601c6

Browse files
committed
Always return i128 from GetINTEGERTypeAtOffset and early return in callers
1 parent cdfa08b commit 72601c6

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

clang/lib/CodeGen/Targets/X86.cpp

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2534,14 +2534,10 @@ GetINTEGERTypeAtOffset(llvm::Type *IRType, unsigned IROffset,
25342534
}
25352535

25362536
// if we have a 128-bit integer, we can pass it safely using an i128
2537-
// so we return that if the IROffset is 0 and no type otherwise
2537+
// so we return that
25382538
if (IRType->isIntegerTy(128)) {
2539-
if (IROffset == 0) {
2540-
return IRType;
2541-
} else {
2542-
assert(IROffset == 8);
2543-
return nullptr;
2544-
}
2539+
assert(IROffset <= 8);
2540+
return IRType;
25452541
}
25462542

25472543
// Okay, we don't have any better idea of what to pass, so we pass this in an
@@ -2648,6 +2644,12 @@ ABIArgInfo X86_64ABIInfo::classifyReturnType(QualType RetTy) const {
26482644
isPromotableIntegerTypeForABI(RetTy))
26492645
return ABIArgInfo::getExtend(RetTy);
26502646
}
2647+
2648+
if (ResType->isIntegerTy(128)) {
2649+
// i128 are passed directly
2650+
assert(Hi == Integer);
2651+
return ABIArgInfo::getDirect(ResType);
2652+
}
26512653
break;
26522654

26532655
// AMD64-ABI 3.2.3p4: Rule 4. If the class is SSE, the next
@@ -2793,6 +2795,11 @@ X86_64ABIInfo::classifyArgumentType(QualType Ty, unsigned freeIntRegs,
27932795
return ABIArgInfo::getExtend(Ty, CGT.ConvertType(Ty));
27942796
}
27952797

2798+
if (ResType->isIntegerTy(128)) {
2799+
assert(Hi == Integer);
2800+
++neededInt;
2801+
return ABIArgInfo::getDirect(ResType);
2802+
}
27962803
break;
27972804

27982805
// AMD64-ABI 3.2.3p3: Rule 3. If the class is SSE, the next

0 commit comments

Comments
 (0)