This is an archive of the discontinued LLVM Phabricator instance.

[AIX][XCOFF][Bug-Fixed] parse the parameter type of the traceback table.
ClosedPublic

Authored by DiggerLin on Jun 28 2021, 6:33 AM.

Details

Summary
  1. in the function PPCFunctionInfo::getParmsType(), there is if (Bits > 31 || (Bits > 30 && (Elt != FixedType || hasVectorParms())))

    when the Bit is 31 and the Elt is not FixedType(for example the Elt is FloatingType) , the 31th bit will be not encoded, it leave the bit as zero, when the function Expected<SmallString<32>> XCOFF::parseParmsType() the original implement

**// unsigned ParmsNum = FixedParmsNum + FloatingParmsNum;

while (Bits < 32 && ParsedNum < ParmsNum) {
...
}//**
it will look the 31 bits (zero) as FixedType. which should be FloatingType,  and get a error.

Diff Detail

Event Timeline

DiggerLin created this revision.Jun 28 2021, 6:33 AM
DiggerLin requested review of this revision.Jun 28 2021, 6:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 28 2021, 6:33 AM
jasonliu added inline comments.Jun 28 2021, 6:54 AM
llvm/lib/BinaryFormat/XCOFF.cpp
147

IIUC, this is not a NFC, and we are changing the behavior in a user visible way. So we need to add a test case for this change.

jasonliu added inline comments.Jun 28 2021, 8:24 AM
llvm/lib/BinaryFormat/XCOFF.cpp
155

Relay offline discussion:
The underlying issue with the current approach is that FixedParmsNum and FloatingParmsNum passed in are the real parameters number of those types that we get, but the number of them could be more than what Value could encode.
I don't think the current solution in this patch addressed that underlying issue.

DiggerLin updated this revision to Diff 355089.Jun 28 2021, 7:25 PM
hubert.reinterpretcast retitled this revision from [NFC][AIX][XCOFF][Bug-Fixed] parse the parameter type of the traceback table. to [AIX][XCOFF][Bug-Fixed] parse the parameter type of the traceback table..Jun 28 2021, 7:53 PM
DiggerLin updated this revision to Diff 355239.Jun 29 2021, 7:49 AM

added a corner test case.

DiggerLin updated this revision to Diff 356557.Jul 5 2021, 12:30 PM

nit, update the comment

ZarkoCA added inline comments.
llvm/lib/BinaryFormat/XCOFF.cpp
120–129
llvm/test/CodeGen/PowerPC/aix-emit-tracebacktable.ll
136
252
DiggerLin updated this revision to Diff 358990.Jul 15 2021, 8:38 AM

rebase the patch and address comment

ZarkoCA accepted this revision.Jul 15 2021, 8:50 AM

LGTM, thanks.

This revision is now accepted and ready to land.Jul 15 2021, 8:50 AM
This revision was landed with ongoing or failed builds.Jul 15 2021, 1:54 PM
This revision was automatically updated to reflect the committed changes.