This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombiner] Use FoldConstantArithmetic instead of dyn_cast in visitFP_ROUND.
ClosedPublic

Authored by Jimerlife on Aug 23 2022, 12:25 AM.

Details

Summary

Use FoldConstantArithmetic instead of dyn_cast in visitFP_ROUND.

Diff Detail

Event Timeline

Jimerlife created this revision.Aug 23 2022, 12:25 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 23 2022, 12:25 AM
Jimerlife requested review of this revision.Aug 23 2022, 12:25 AM
RKSimon added inline comments.Aug 23 2022, 3:26 AM
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15863–15864

Might this be better as just a constant fold attempt?

if (SDValue C = DAG.FoldConstantArithmetic(ISD::FP_ROUND, SDLoc(N), VT, {N0, N1}))
  return C;
Jimerlife updated this revision to Diff 455156.Aug 24 2022, 4:12 AM

address comment

Jimerlife marked an inline comment as done.Aug 24 2022, 4:12 AM
Jimerlife added inline comments.
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
15863–15864

Thank you. Good suggestion.

Thanks - please can you update the title and summary

Jimerlife retitled this revision from [DAGCombiner][NFC] Use isa instead of dyn_cast in visitFP_ROUND. to [DAGCombiner][NFC] Use FoldConstantArithmetic instead of dyn_cast in visitFP_ROUND..Aug 24 2022, 5:08 AM
Jimerlife edited the summary of this revision. (Show Details)
Jimerlife marked an inline comment as done.Aug 24 2022, 5:10 AM

Thanks - please can you update the title and summary

I updated the title and summary. Thanks for your careful review.

RKSimon accepted this revision.Aug 24 2022, 5:13 AM

LGTM - cheers

This revision is now accepted and ready to land.Aug 24 2022, 5:13 AM

(please drop the NFC as it probably has different behaviour now - vector support etc)

Jimerlife retitled this revision from [DAGCombiner][NFC] Use FoldConstantArithmetic instead of dyn_cast in visitFP_ROUND. to [DAGCombiner] Use FoldConstantArithmetic instead of dyn_cast in visitFP_ROUND..Aug 24 2022, 5:18 AM
This revision was landed with ongoing or failed builds.Aug 24 2022, 8:42 PM
This revision was automatically updated to reflect the committed changes.