diff options
author | Craig Topper <craig.topper@sifive.com> | 2022-03-03 14:21:59 -0800 |
---|---|---|
committer | Craig Topper <craig.topper@sifive.com> | 2022-03-03 15:42:29 -0800 |
commit | 3d4e83f17dbefb991fc6896005b5e4aa6d412985 (patch) | |
tree | 5015b5827131a9662492c8d8132bb5f9ea61454e /llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | |
parent | b4c1cbff79d0631c35ca2efa97bd2a47929945b8 (diff) | |
download | llvm-3d4e83f17dbefb991fc6896005b5e4aa6d412985.zip llvm-3d4e83f17dbefb991fc6896005b5e4aa6d412985.tar.gz llvm-3d4e83f17dbefb991fc6896005b5e4aa6d412985.tar.bz2 |
[RISCV] With Zbb, fold (sext_inreg (abs X)) -> (max X, (negw X))
With Zbb, abs is expanded to (max X, neg) by default. If X has 33 or
more sign bits, we can expand it a little early using negw instead of
neg to save a sext_inreg. If X started as a 32 bit value, type
legalization would have inserted a sext before the abs so X having
33 sign bits should always be true.
Note: I've used ISD::FREEZE here since we increase the number of uses.
Our default expansion for ABS doesn't do that, but I think that's a bug.
We can't do this with custom type legalization because ISD::FREEZE
doesn't propagate sign bits so later DAG combine won't expand be
able to see optmize it.
Alives2 https://alive2.llvm.org/ce/z/Gx3RNe
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D120597
Diffstat (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp')
0 files changed, 0 insertions, 0 deletions