llvm / llvm/llvm-project

Passing `SelfMultiply` information in `CodeGen/SelectionDAG/TargetLowering.cpp`

Open
#212,546 3 comments 0 reactions 0 assignees View on GitHub
llvm:SelectionDAG
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

We pass the `SelfMultiply` information into `KnownBits::mul` here
https://github.com/llvm/llvm-project/blob/2db6978f724bfb0f9ae6f37b8ea585c707e65ce8/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L3672-L3691

We also test if we are self multiplying here (`Op.getOperand(0) == Op.getOperand(1)`):
https://github.com/llvm/llvm-project/blob/3a30af978df0b6f39505fd702f4bfd55b3adb96c/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp#L2925-L2946
But this information is not passed later on into `KnownBits::mul` here, so some additional known bits related to squaring may be missed:
https://github.com/llvm/llvm-project/blob/3a30af978df0b6f39505fd702f4bfd55b3adb96c/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp#L3059-L3066

Contributor guide

Open the contributing guide

Research direction

Read the SelfMultiply handling in llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp around the referenced ranges, and compare it with the KnownBits::mul call in llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp. Trace how the self-multiplication information is carried between these entry points; done means the later KnownBits::mul call receives the information and the related known bits are covered by validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.