[PATCH] D65992: [MachinePipeliner] Avoid indeterminate order in FuncUnitSorter
Jinsong Ji via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 19:52:01 PDT 2019
jsji created this revision.
jsji added reviewers: bcahoon, hfinkel, jmolloy.
Herald added subscribers: llvm-commits, MaskRay, hiraditya, nemanjai.
Herald added a project: LLVM.
This is exposed by adding a new testcase in PowerPC in
https://reviews.llvm.org/rL367732
The testcase got different output on different platform, hence breaking
buildbots.
The problem is that we get differnt FuncUnitOrder when calculateResMII.
The root cause is:
1. Two MachineInstr might get SAME priority(MFUsx) from minFuncUnits.
2. Current comparison operator() will return `MFUs1 > MFUs2`.
3. We use iterators for MachineInstr, so the input to FuncUnitSorter might be different on differnt platform due to the iterator nature.
So for two MI with same MFU, their order is actually depends on the
iterator order, which is platform (implemtation) dependent.
This is risky, and may cause cross-compiling problems.
The fix is to check make sure we assign a determine order when they are
equal.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D65992
Files:
llvm/lib/CodeGen/MachinePipeliner.cpp
llvm/test/CodeGen/PowerPC/sms-cpy-1.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65992.214286.patch
Type: text/x-patch
Size: 4519 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190809/0d0f10f8/attachment.bin>
More information about the llvm-commits
mailing list