In PPCInstrInfo::optimizeCompareInstr we seek opportunities to fold cmp(d|w) and subf as an subf.. However, if subf. gets overflow, cr0 can't reflect the correct order, violating the semantics of cmp(d|w).
- Group Reviewers
- rGf6515b05205d: [PowerPC] Do not fold `cmp(d|w)` and `subf` instruction to `subf.` if `nsw` is…
Update comment and I've pre-commit a mir test https://github.com/llvm/llvm-project/commit/e3e25cfb44bc2a35e3b53d62d37c27b7d13157b6 to demonstrate the situation when equalityOnly is true. The codegen of the test case doesn't change with this patch.