This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Fix an ICE in combineMinNumMaxNum(...)
ClosedPublic

Authored by cameron.mcinally on Feb 22 2023, 9:35 AM.

Details

Summary

65420c8041f4 introduced an ICE in combineMinNumMaxNum(...) when combineMinNumMaxNumImpl(...) returns an SDValue(). Make sure to check that a value is returned before trying to perform an FNEG on it.

Note that this ICE occurs in the release/16.x branch as well, so it will need to be backported. @tstellar

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2023, 9:35 AM
cameron.mcinally requested review of this revision.Feb 22 2023, 9:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 22 2023, 9:35 AM
arsenm accepted this revision.Feb 22 2023, 9:53 AM

LGTM with test nits

llvm/test/CodeGen/X86/2023-02-22-combineMinNumMaxNum.ll
6

Don't need local_unnamed_addr

8

I suspect you can simplify this too

14

Use named values in test

22

Do we really need the attributes (IIRC, yes for this case which really should be fixed)

This revision is now accepted and ready to land.Feb 22 2023, 9:53 AM

Updated patch for Matt's reviews...

cameron.mcinally marked 4 inline comments as done.Feb 22 2023, 10:25 AM
cameron.mcinally added inline comments.
llvm/test/CodeGen/X86/2023-02-22-combineMinNumMaxNum.ll
22

We do. Those are the requirements from isLegalToCombineMinNumMaxNum(...).

arsenm accepted this revision.Feb 22 2023, 10:26 AM
arsenm added inline comments.
llvm/test/CodeGen/X86/2023-02-22-combineMinNumMaxNum.ll
19

I'm surprised dso_local is allowed on intrinsic declarations

cameron.mcinally marked 2 inline comments as done.Feb 22 2023, 10:35 AM
cameron.mcinally added inline comments.
llvm/test/CodeGen/X86/2023-02-22-combineMinNumMaxNum.ll
19

Ah, missed that. Will correct before submitting.

This revision was landed with ongoing or failed builds.Feb 22 2023, 11:01 AM
This revision was automatically updated to reflect the committed changes.
cameron.mcinally marked an inline comment as done.