[PATCH] D95803: Ensure that InstructionCost actually implements a total ordering
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 2 15:21:22 PST 2021
nikic added a comment.
FWIW, this patch also made the compiler non-deterministic in a major way.
================
Comment at: llvm/include/llvm/Support/InstructionCost.h:155
+ bool operator<(const InstructionCost &RHS) const {
+ return State < RHS.State || Value < RHS.Value;
+ }
----------------
Shouldn't this be?
```
if (State != RHS.State)
return State < RHS.State;
return Value < RHS.Value;
```
If State is Invalid and RHS.State is Valid, then the Value comparison shouldn't be coming into it. (I assume the Value is not even initialized in that case, which is why this patch caused major compiler non-determinism.)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95803/new/
https://reviews.llvm.org/D95803
More information about the llvm-commits
mailing list