This is an archive of the discontinued LLVM Phabricator instance.

[SDAG] Add SimplifyDemandedBits support for ISD::SPLAT_VECTOR
ClosedPublic

Authored by luke on Aug 25 2023, 5:12 AM.

Details

Summary

This improves some cases where a splat_vector uses a build_pair that can be
simplified, e.g:

(rotl x:i64, splat_vector (build_pair x1:i32, x2:i32))

rotl only demands the bottom 6 bits, so this patch allows it to simplify it to:

(rotl x:i64, splat_vector (build_pair x1:i32, undef:i32))

Which in turn improves some cases where a splat_vector_parts is lowered on
RV32.

Diff Detail

Event Timeline

luke created this revision.Aug 25 2023, 5:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 5:12 AM
luke requested review of this revision.Aug 25 2023, 5:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 25 2023, 5:12 AM
luke edited the summary of this revision. (Show Details)Aug 25 2023, 5:14 AM
RKSimon added inline comments.Aug 25 2023, 7:08 AM
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
1162

Do you need this or can you just set it to KnownScl (with suitable truncation)?

luke updated this revision to Diff 553478.Aug 25 2023, 8:01 AM

Update WebAssembly test

luke added inline comments.Aug 25 2023, 8:13 AM
llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
1162

I think computeKnownBits does exactly that, will replace it

luke updated this revision to Diff 553489.Aug 25 2023, 8:21 AM

Just use KnownScl instead of computing it again

RKSimon accepted this revision.Aug 26 2023, 2:18 PM

LGTM

This revision is now accepted and ready to land.Aug 26 2023, 2:18 PM
Jim added inline comments.Aug 27 2023, 8:00 PM
llvm/test/CodeGen/RISCV/rvv/vrol-sdnode.ll
1158

Could we remove these unused prefixes?

luke added inline comments.Aug 28 2023, 2:36 AM
llvm/test/CodeGen/RISCV/rvv/vrol-sdnode.ll
1158

Thanks, fixed