This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Allow vector constant folding of any value type before type legalization
ClosedPublic

Authored by RKSimon on Feb 5 2017, 12:59 PM.

Details

Summary

The patch comes in 2 parts:

1 - it makes use of the SelectionDAG::NewNodesMustHaveLegalTypes flag to tell it when it can safely constant fold illegal types

2 - it correctly resets SelectionDAG::NewNodesMustHaveLegalTypes at the start of each call to SelectionDAGISel::CodeGenAndEmitDAG so all the pre-legalization stages can make use of it - not just the first basic block that gets handled.

Fix for PR30760

Diff Detail

Repository
rL LLVM

Event Timeline

RKSimon created this revision.Feb 5 2017, 12:59 PM
craig.topper edited edge metadata.Feb 7 2017, 6:58 PM

Do we need to add better tests for the other usages of NewNodesMustHaveLegalTypes that should have caught the initialization problem?

craig.topper accepted this revision.Feb 9 2017, 9:02 PM

LGTM other than my earlier question about the other use of NewNodesMustHaveLegalTypes.

This revision is now accepted and ready to land.Feb 9 2017, 9:02 PM

LGTM other than my earlier question about the other use of NewNodesMustHaveLegalTypes.

Thanks Craig - sorry I didn't see your comment earlier this week.

NewNodesMustHaveLegalTypes is currently only used during constant creation, where it attempts to expand illegal value types. As NewNodesMustHaveLegalTypes was left stuck in the "true" value for later tests/blocks we were effectively in a 'fail safe' mode that just resulted in (premature?) legalization of constants that seemed to be still handled correctly.

This revision was automatically updated to reflect the committed changes.