llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[DAG] isKnownNeverZero - add ISD::SHL DemandedElts handling and tests

Open RKSimon opened this issue 9 months ago • 5 comments

Needs to be updated now that https://github.com/llvm/llvm-project/pull/182679 has landed

RKSimon avatar Feb 24 '26 12:02 RKSimon

Hi!

This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:

  1. Check that no other contributor is working on this issue. If someone is assigned to the issue or claimed to be working on it, ping the person. After one week without a response, the assignee may be changed.
  2. Leave a comment indicating that you are working on the issue, or just create a pull request after following the steps below. Mention this issue in the description of the pull request.
  3. Fix the issue locally.
  4. Run the test suite locally. Remember that the subdirectories under test/ create fine-grained testing targets, so you can e.g. use make check-clang-ast to only run Clang's AST tests.
  5. Create a Git commit.
  6. Run git clang-format HEAD~1 to format your changes.
  7. Open a pull request to the upstream repository on GitHub. Detailed instructions can be found in GitHub's documentation. Mention this issue in the description of the pull request.

If you have any further questions about this issue, don't hesitate to ask via a comment in the thread below.

llvmbot avatar Feb 24 '26 12:02 llvmbot

@llvm/issue-subscribers-good-first-issue

Author: Simon Pilgrim (RKSimon)

Needs to be updated now that https://github.com/llvm/llvm-project/pull/182679 has landed

llvmbot avatar Feb 24 '26 12:02 llvmbot

Hi @RKSimon i am new to llvm. I would like to start contributing to llvm. Could you pls confirm if the expected task is to use the new isKnownNeverZero with DemandedElts in the ISD::SHL case and write suitable test for it. If yes could you assign it to me

Joeljm1 avatar Feb 24 '26 17:02 Joeljm1

Yes, that's what it needs to do - unit tests will probably have to be added to AArch64SelectionDAGTest.cpp - please make sure you have a working llvm build and know how to run tests (ninja check-llvm-codegen) and unit tests (these can be run directly from unittests\Target\AArch64\AArch64Tests).

RKSimon avatar Feb 24 '26 18:02 RKSimon

Hi @RKSimon please do check the submitted PR. Also I had set SHL by 32 for type i32 to be expected to be 0 in the tests. Please do tell if i should remove those cases as they are UB in C and C++

Joeljm1 avatar Feb 27 '26 17:02 Joeljm1