if x == 1,
x > 1 ? x : 1 return x, which is also 1. x > 0 ? x : 1 return 1.
Reduce the number of load 1 instructions.
Paths
| Differential D132211
[RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1 ClosedPublic Authored by liaolucy on Aug 19 2022, 1:10 AM.
Details
Summary if x == 1, x > 1 ? x : 1 return x, which is also 1. x > 0 ? x : 1 return 1. Reduce the number of load 1 instructions.
Diff Detail
Event TimelineHerald added subscribers: StephenFan, frasercrmck, luismarques and 21 others. · View Herald Transcript liaolucy retitled this revision from Optimize x > 1 ? x : 1 -> x > 0 ? x : 1 to [RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1.Aug 19 2022, 1:10 AM Herald added subscribers: sunshaoce, eopXD, VincentWu and 7 others. · View Herald TranscriptAug 19 2022, 1:10 AM This revision is now accepted and ready to land.Aug 19 2022, 10:05 AM craig.topper added a child revision: D132252: [RISCV] Optimize x <s -1 ? x : -1. Improve x >u 1 ? x : 1..Aug 19 2022, 10:41 AM This revision was landed with ongoing or failed builds.Aug 21 2022, 5:26 AM Closed by commit rG1fb87ace4d09: [RISCV] Optimize x > 1 ? x : 1 -> x > 0 ? x : 1 (authored by liaolucy). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 453919 llvm/lib/Target/RISCV/RISCVISelLowering.cpp
llvm/test/CodeGen/RISCV/forced-atomics.ll
|
Update this comment to x < 1 ? x : 1 -> 0 < x ? x : 1