This is an archive of the discontinued LLVM Phabricator instance.

[LoongArch] Refactor insertDivByZeroTrap
ClosedPublic

Authored by wangleiat on Jul 21 2022, 4:23 AM.

Details

Summary

Ensure non-terminators don't follow terminators.
This patch fixes the sdiv-udiv-srem-urem.ll test failure with
expensive check.

Diff Detail

Event Timeline

wangleiat created this revision.Jul 21 2022, 4:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 4:23 AM
wangleiat requested review of this revision.Jul 21 2022, 4:23 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 4:23 AM
MaskRay accepted this revision.Jul 23 2022, 1:31 PM

Some nits

llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
740–741

Keep the reference for the non-null semantics.

779

Move EndMBB operations after BreakMBB? So that the MBB modify order resembles more on the MBB placement order.

This revision is now accepted and ready to land.Jul 23 2022, 1:31 PM

Ensure non-terminators don't follow terminators.

Ensure the non-terminator BREAK doesn't follow the terminator BNEZ.

Ensure non-terminators don't follow terminators.

Ensure the non-terminator BREAK doesn't follow the terminator BNEZ.

Thanks.

llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
740–741

Keep the reference for the non-null semantics.

740–741

Keep the reference for the non-null semantics.

Thanks, I think it's better to keep the status quo.
Firstly, it is possible to keep the same declaration as the caller, and secondly, if a reference is passed, it will increase the parameters of BuildMI.
(Seems to be irrelevant reasons ^_^)

779

Move EndMBB operations after BreakMBB? So that the MBB modify order resembles more on the MBB placement order.

Thanks, I'll re-order the basic block settings.
But transferring the remaining MBB and its successor edges to EndMBB(Maybe changing the name would be better?) is something that must be done first.

wangleiat updated this revision to Diff 447291.Jul 25 2022, 5:45 AM

Address @MaskRay's comments.

This revision was landed with ongoing or failed builds.Jul 29 2022, 2:07 AM
This revision was automatically updated to reflect the committed changes.