-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[SelectionDAG] Introducing a new ISD::POISON SDNode to represent the poison value in the IR. #125883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SelectionDAG] Introducing a new ISD::POISON SDNode to represent the poison value in the IR. #125883
Changes from all commits
31274e0
ba656cd
515a60d
6fa17c2
ea6dd3f
a9f0e58
f905090
2eaa979
5972512
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2845,6 +2845,7 @@ void DAGTypeLegalizer::PromoteFloatResult(SDNode *N, unsigned ResNo) { | |
|
||
case ISD::SINT_TO_FP: | ||
case ISD::UINT_TO_FP: R = PromoteFloatRes_XINT_TO_FP(N); break; | ||
case ISD::POISON: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should get tests that hit all of these legalization paths There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I delete all the |
||
case ISD::UNDEF: R = PromoteFloatRes_UNDEF(N); break; | ||
case ISD::ATOMIC_SWAP: R = BitcastToInt_ATOMIC_SWAP(N); break; | ||
case ISD::VECREDUCE_FADD: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should have a poison -> undef lowering, targets can just directly select (similarly I don't think we should have the expansion of undef to 0, every target should be able to select to IMPLICIT_DEF)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. but the code
DAG.getUNDEF(Node->getValueType(0))
do not expanse of undef to 0 here , and if I do not add the code here, there are about 26 test cases fail under the llvm/test/CodeGen , for example , the test case llvm/test/CodeGen/PowerPC/vec_shuffle.llit will use the definition in the llvm/lib/Target/PowerPC/PPCInstrAltivec.td
to do a instruction selection.
if I add following definition in the PPCInstrAltivec.td file for instruction selection.
there will a compile error since tablegen do not support poison.
(if you
grep "undef" llvm/lib/Target/*/*.td
you will find , there are a lot of place have the same situation. )
and we need to add tablegen to support
poison
in the patch, I think the patch will be too big.Can we just add some TODO information before the following code to express your concern?
For example:
How do you think ? @arsenm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's fine to leave it as it's copying what undef is already doing. But really this should have mandatory legality for legal types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure whether I understand your question correctly, I guess you ask why we legalize the POISON in the legal types since we legalize the POISON to UNDEF in the function 'SelectionDAGLegalize::LegalizeOp(SDNode *Node)`
for example ,in the function
void DAGTypeLegalizer::WidenVectorResult(SDNode *N, unsigned ResNo)
if we do not replace POISON with UNDEF in the legal type. we need to implement a new function ``DAGTypeLegalizer::WidenVecRes_POISON(SDNode *N)
like
DAGTypeLegalizer::WidenVecRes_UNDEF(SDNode *N)`and we have to have the code
since we can replace the POISON value with UNDEF at any time.
So I think the following code is more reasonable.