[PATCH] D100735: [CodeGen] Enable Windows exception handling for basic block sections
TaoPan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 24 03:35:46 PDT 2021
TaoPan added a comment.
In D100735#2834985 <https://reviews.llvm.org/D100735#2834985>, @modimo wrote:
> In D100735#2832513 <https://reviews.llvm.org/D100735#2832513>, @TaoPan wrote:
>
>> No big difference. There are 12 more sections in Sections table, I checked asm file, there are 12 BB sections, so all added sections are BB sections. And as the test file CHECK, one relocation of .xdata section changed from ".text" to "?TestCPPEX@@YAXH at Z.__part.3". Is this difference need to add without `-basic-block-sections=all -unique-basic-block-section-names` case for highlight the difference?
>
> Yeah, check that the .xdata relocation changed and the size of the Sections table (CHECK-COUNT or looking at the last entry for each configuration). Also does the above test case run correctly when built with Clang if you define it as "main" and add something interesting to the __except clause (with and without BBS)?
I added baseline (without BBS) case and check the size of the Sections table.
I tried to build with clang, define it as "main" and add printf to the __except clause
without BBS, the exception can be captured, printf log in __except clause was printed.
with BBS, build fail with "error: Cannot represent this expression", I'm investigating this error.
>> FYI, about `avoidZeroOffsetLandingPad` under MSVC, isFuncletEHPersonality(Pers) check and return of SelectionDAGISel::PrepareEHLandingPad() prevent later addLandingPad(MBB) and adding TargetOpcode::EH_LABEL MachineInstr in the case of MSVC. `while (!MI->isEHLabel()) ++MI;` of `avoidZeroOffsetLandingPad` is dead loop as no EHLabel MI in the case of MSVC.
>
> I'm not sure what you mean by dead loop for `while (!MI->isEHLabel())` Can you elaborate?
The dead loop occurs if "MBB->setIsEHPad() but all MIs of the MBB are not isEHLabel()", as condition !MI->isEHLabel() of while loop is always true.
Adding "&& MI ~= MBB.end()" to while (!MI->isEHLabel()) will resolve this dead loop.
The iterator is rolling loop, begin() is next to end(), the '++' operation change the iterator in loop turn, e.g. if size() is 2, the turn of '++' operation is:
begin() (1st node) -> 2nd node -> end() -> begin() (1st node) -> 2nd node -> ....
I don't know the reason MBB->setIsEHPad() without any MI of the MBB setIsEHLabel() in the case of Windows COFF.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100735/new/
https://reviews.llvm.org/D100735
More information about the llvm-commits
mailing list