This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG][TargetLowering]Add support for nuw/nsw on KnownBits::shl
Needs RevisionPublic

Authored by liaolucy on Jun 27 2023, 8:06 PM.

Details

Summary
  1. Use KnownBits::shl() in SimplifyDemandedBits()
  2. Add flags for KnownBits::shl in computeKnownBits()

Similar to e1aa91b36325

Diff Detail

Event Timeline

liaolucy created this revision.Jun 27 2023, 8:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2023, 8:06 PM
liaolucy requested review of this revision.Jun 27 2023, 8:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2023, 8:06 PM
liaolucy updated this revision to Diff 535270.Jun 28 2023, 12:54 AM

Add testcase for riscv.
The testcase is copied from instcombine.
Without this patch:
https://godbolt.org/z/M1nxxf163

RKSimon added inline comments.Jun 29 2023, 2:48 AM
llvm/test/CodeGen/RISCV/rv64i-demanded-bits.ll
197 ↗(On Diff #535270)

please can you precommit this test with current trunk codegen and then rebase this patch to show the diff

liaolucy added inline comments.Jun 29 2023, 6:34 PM
llvm/test/CodeGen/RISCV/rv64i-demanded-bits.ll
197 ↗(On Diff #535270)

Thanks for the review. In fact, I found not only good testcase, but also bad ones.
Regarding the bad testcase, no solution has been found for the time being.
I'll come back to this patch later when I find a solution. Thanks again.

RKSimon requested changes to this revision.Aug 23 2023, 8:29 AM

Needs better test coverage

This revision now requires changes to proceed.Aug 23 2023, 8:29 AM