This is an archive of the discontinued LLVM Phabricator instance.

[SelectionDAG] Teach getNode to constant fold SIGN/ZERO/ANY_EXTEND_VECTOR_INREG
AbandonedPublic

Authored by craig.topper on Nov 8 2018, 3:22 PM.

Details

Summary

getNode can constant fold vector ZERO/SIGN/ANY_EXTEND but not the VECTOR_INREG variants. This patch fixes that.

Some X86 specific constant folding on these nodes during DAG combine prevents seeing any changes in tests from this. I'm trying to work through some other issues to make the X86 specific constant folding unneeded.

Diff Detail

Event Timeline

craig.topper created this revision.Nov 8 2018, 3:22 PM

Can any of the X86 constant folding code be removed ensure that this code is being used with existing tests?

Any movement on this?

This is probably going to be a lot harder to test after r346728.

Removing any of the constant folding code in X86 requires committing D54276 first so that we can still see constant MULH inputs as build_vectors and DAG combine them that way. With MULH lowering happening during DAG legalization we don't get a chance to constant fold until they have been turned into constant pool entries and that requires target specific constant folding.

Removing any of the constant folding code in X86 requires committing D54276 first so that we can still see constant MULH inputs as build_vectors and DAG combine them that way. With MULH lowering happening during DAG legalization we don't get a chance to constant fold until they have been turned into constant pool entries and that requires target specific constant folding.

D54276 landed - can the X86 folding now be removed as part of this?

I removed the custom combine in r348237. This patch doesn't provide any test changes. Probably due to a combination of the DAG combine for constant folding being enabled to run later, the MULH lowering being legalized earlier, and constant vectors being explicitly handled in the MUL/MULH lowering.

I'm happy to abandon this.

I'm happy to abandon this.

SGTM if neither DAG or X86-specific folds are necessary

craig.topper abandoned this revision.Dec 17 2018, 11:32 PM