llvm / llvm/llvm-project

[DAG] canCreateUndefOrPoison/isGuaranteedNotToBeUndefOrPoison - ISD::SCALAR_TO_VECTOR assumes undefs in upper elements instead of poison

Open
#217,028 0 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

The ISD::SCALAR_TO_VECTOR node description now assumes the upper elements are poison, not undef.
https://github.com/llvm/llvm-project/blob/39f21429b714d39d9605f041e629f2de61f93053/llvm/include/llvm/CodeGen/ISDOpcodes.h#L661-L667

But canCreateUndefOrPoison still assumes its undefs:
https://github.com/llvm/llvm-project/blob/77229133dabed0b927748f2a5ae1442b0e97f686/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L6099-L6101

As does isGuaranteedNotToBeUndefOrPoison:
https://github.com/llvm/llvm-project/blob/77229133dabed0b927748f2a5ae1442b0e97f686/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp#L5821-L5829

There might be other ISD::SCALAR_TO_VECTOR code doing something similar (there's a lot of comments that still refer to undef).

Contributor guide

Open the contributing guide

Research direction

Start with llvm/include/llvm/CodeGen/ISDOpcodes.h and the cited canCreateUndefOrPoison and isGuaranteedNotToBeUndefOrPoison sections in llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp. Search for other ISD::SCALAR_TO_VECTOR handling and comments that still describe upper elements as undef. Done means the affected assumptions consistently match the node description's poison semantics.

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
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.