[llvm] [TableGen] Rework error reporting for duplicate Feature/Processor. (PR #102257)
Rahul Joshi via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 07:58:17 PDT 2024
jurahul wrote:
> > > Have you figured what was the issue with sorting? I couldn't find any pointer comparisons or anything else that would cause llvm::sort to behave differently from run to run.
> >
> >
> > Yes. The issue is that llv::sort() is not stable, so records with same name can end up in any order in the sorted list, so when reporting the error message, the error and note locations may get swapped. I have the fix in this PR, to use the Record->getName() as a secondary key for sorting. Please see the updated commit message as well.
>
> Given the same input, `llvm::sort` would produce the same output whether it is stable or not.
Is that true? In this case, in the test case, the record names are FeatureA/FeatureB, so the sort in `Record.cpp` will be deterministic. But then later on when we re-sort the array using Name field, which is same for both the records, the order becomes non-deterministic. So it's the` llvm::sort()` in the` SubtargetEmitter` (now in `sortAndReportDuplicates`) that's causing the non-determinism.
https://github.com/llvm/llvm-project/pull/102257
More information about the llvm-commits
mailing list