[llvm] TargetInstrInfo: make getOperandLatency return optional (NFC) (PR #73769)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 1 05:20:52 PST 2023
artagnon wrote:
I'm somewhat confused by the build log. The only places the error could possibly be coming from are:
```
if (UseCycle > *DefCycle + 1)
return std::nullopt;
```
Here, `*DefCycle` is `unsigned`, and `unsigned + 1 = unsigned`, so this shouldn't qualify.
The other place is:
```
UseCycle = *DefCycle - *UseCycle + 1;
if (UseCycle > 0 &&
hasPipelineForwarding(DefClass, DefIdx, UseClass, UseIdx))
```
`UseCycle` is unsigned, and although MSVC could have inferred that its assignment would produce a negative value, it would technically be an unsigned-wrap. Besides, the error is coming from `>`, and I don't see how `UseCycle > 0` could possibly qualify.
Could you try fixing up the first instance with an unsigned-cast, try it on MSVC, and tell me if the error still persists? If it doesn't, I'll push a fix.
https://github.com/llvm/llvm-project/pull/73769
More information about the llvm-commits
mailing list