This patch modifies X86TargetLowering::LowerVASTART so that struct va_list is initialized with 32 bit pointers in x32. It also enables all tests that call @llvm.va_start() for x32.
Details
Diff Detail
Event Timeline
| lib/Target/X86/X86ISelLowering.cpp | ||
|---|---|---|
| 15385–15386 | 80 col wrap. maybe just clang-format the patch? | |
| test/CodeGen/X86/stdarg.ll | ||
| 12 | 80 col | |
You missed:
static SDValue LowerVACOPY(SDValue Op, const X86Subtarget *Subtarget,
SelectionDAG &DAG) {
// X86-64 va_list is a struct { i32, i32, i8*, i8* }, except on Windows,
// where a va_list is still an i8*.
assert(Subtarget->is64Bit() && "This code only handles 64-bit va_copy!");
if (Subtarget->isCallingConvWin64(
DAG.getMachineFunction().getFunction()->getCallingConv()))
// Probably a Win64 va_copy.
return DAG.expandVACopy(Op.getNode());
SDValue Chain = Op.getOperand(0);
SDValue DstPtr = Op.getOperand(1);
SDValue SrcPtr = Op.getOperand(2);
const Value *DstSV = cast<SrcValueSDNode>(Op.getOperand(3))->getValue();
const Value *SrcSV = cast<SrcValueSDNode>(Op.getOperand(4))->getValue();
SDLoc DL(Op);
return DAG.getMemcpy(Chain, DL, DstPtr, SrcPtr,
DAG.getIntPtrConstant(24, DL), 8, /*isVolatile*/false,
^^^ It should be 16 for x32.
false, false,
MachinePointerInfo(DstSV), MachinePointerInfo(SrcSV));I am trying to get x32 to work one piece at a time, with small, self-contained patches. I don't mind fixing LowerVACOPY here, but I would rather do it in a separate CL, changing the appropriate tests. My ultimate goal is to have all/most x86 tests enable for x32. Let me know.
I just wanted to point it out the related x32 issue. I opened those x32 bugs
which should be easy to fix:
https://llvm.org/bugs/show_bug.cgi?id=24706
https://llvm.org/bugs/show_bug.cgi?id=22762
https://llvm.org/bugs/show_bug.cgi?id=22676
https://llvm.org/bugs/show_bug.cgi?id=20441
Just noticed one other thing
| test/CodeGen/X86/nosse-varargs.ll | ||
|---|---|---|
| 6 ↗ | (On Diff #34228) | x32 has a different datalayout than x86-64, and there seems to be some 64-bit pointer assumptions baked into this bitcode. Maybe we should regenerate/modify this in a separate test for x32. (the same maybe applies to stdarg.ll although it looks like the gep operands are the only thing theres, so maybe that's OK) |
Feel free to CC me on those bugs. I really want llvm's x32 to work, and I might take some of them.
otherwise LGTM
| test/CodeGen/X86/x32-va_start.ll | ||
|---|---|---|
| 1 | more common style is to remove the CHECK- from the SSE check prefixes, i.e.: -check-prefix=CHECK -check-prefix=NOSSE | |
80 col wrap. maybe just clang-format the patch?