llvm / llvm/llvm-project

[ValueTracking] computeKnownBitsFromOperator - should we move target intrinsic handling into target hooks?

Open
#177,568 1 comment 0 reactions 0 assignees View on GitHub
llvm:analysis llvm:instcombine
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

computeKnownBitsFromOperator currently handles a number of x86/riscv intrinsics and I'm intending to add handling for more x86 intrinsics in the coming months.

Before this work begins, should we instead move to a TTI hook, similar to what we do with X86TTIImpl::simplifyDemandedUseBitsIntrinsic etc?

At the moment x86 intrinsic constant folding is spread out across computeKnownBitsFromOperator / simplifyDemandedUseBitsIntrinsic / instCombineIntrinsic :(

CC @nikic @dtcxzyw

Contributor guide

Open the contributing guide

Research direction

Start by reading computeKnownBitsFromOperator and compare its intrinsic handling with X86TTIImpl::simplifyDemandedUseBitsIntrinsic and instCombineIntrinsic. Trace how the existing x86 and RISC-V cases are distributed, then determine whether a TTI hook is an appropriate home; done requires an agreed design before implementation begins.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.