This is an archive of the discontinued LLVM Phabricator instance.

[RISCV] Generalize 'tryFoldSelectIntOp` to other operations.
ClosedPublic

Authored by mgudim on Jul 14 2023, 3:34 PM.

Details

Summary

Currently, only SUB, ADD, OR and XOR are covered. This patch
adds AND, SHL, SRA, SRL.

Diff Detail

Event Timeline

mgudim created this revision.Jul 14 2023, 3:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 3:34 PM
mgudim requested review of this revision.Jul 14 2023, 3:34 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 14 2023, 3:34 PM
mgudim added inline comments.Jul 14 2023, 3:36 PM
llvm/test/CodeGen/RISCV/fold-select-into-binop.ll
1 ↗(On Diff #540578)

The test should be commited separately first I guess. I'll do that soon.

craig.topper added inline comments.Jul 17 2023, 9:22 AM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
12441

The identity value for fadd is -0.0.

mgudim updated this revision to Diff 541114.Jul 17 2023, 10:12 AM

removed FADD and FSUB
removed the test, it will be commited in a separate patch

mgudim edited the summary of this revision. (Show Details)Jul 17 2023, 10:13 AM

Where did the tests go?

craig.topper added inline comments.Jul 18 2023, 4:12 PM
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
12440

Drop the isFloatingPoint check?

12440

You can use DAG.getNeutralElement

mgudim updated this revision to Diff 544083.Jul 25 2023, 1:12 PM

Addressed comments
Updated failing tests

Where did the tests go?

@craig.topper

https://reviews.llvm.org/D155481

Should I commit that test first? The effect of this patch is seen on the existing tests already.

mgudim marked 3 inline comments as done.Jul 25 2023, 1:14 PM
This revision is now accepted and ready to land.Jul 25 2023, 1:52 PM
mgudim updated this revision to Diff 545818.Jul 31 2023, 2:43 PM

updated condbinops.ll

mgudim updated this revision to Diff 546035.Aug 1 2023, 6:53 AM

clang-format