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).
Details
Details
- Reviewers
nemanjai - Group Reviewers
Restricted Project - Commits
- rGf6515b05205d: [PowerPC] Do not fold `cmp(d|w)` and `subf` instruction to `subf.` if `nsw` is…
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM with a minor nit.
llvm/lib/Target/PowerPC/PPCInstrInfo.cpp | ||
---|---|---|
2144 | Please add a note why this is OK when equalityOnly is set. |
Comment Actions
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.
Please add a note why this is OK when equalityOnly is set.