This is an archive of the discontinued LLVM Phabricator instance.

[LegalizeDAG] Fix legalization of SETCC
ClosedPublic

Authored by miyuki on Feb 14 2018, 3:22 AM.

Details

Summary

Currently when expanding a SETCC node into a SELECT_CC, LLVM uses
an incorrect type for determining BooleanContent of the result. This
patch fixes the issue.

Fixes PR36079.

Diff Detail

Event Timeline

miyuki created this revision.Feb 14 2018, 3:22 AM
efriedma added inline comments.Feb 14 2018, 2:15 PM
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
3769

Shouldn't this be TLI.getBooleanContents(VT)? None of the operands of a SETCC are boolean.

miyuki added inline comments.Feb 15 2018, 3:27 AM
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
3769

As far as I understand, the parameter of getBooleanContents is the type of values being compared rather than the result type. At least, other uses of getBooleanContents in https://reviews.llvm.org/rL212697 suggest so.

efriedma accepted this revision.Feb 15 2018, 5:40 PM

LGTM

lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
3769

Oh, you're right; wasn't really thinking about it.

This revision is now accepted and ready to land.Feb 15 2018, 5:40 PM
This revision was automatically updated to reflect the committed changes.