Page MenuHomePhabricator

[GlobalISel] Port some basic undef combines from DAGCombiner.cpp
ClosedPublic

Authored by paquette on Mar 17 2020, 7:26 PM.

Details

Summary

This ports some combines from DAGCombiner.cpp which perform some trivial transformations on instructions with undef operands.

e.g.

(mul x, undef) -> 0
(or x, undef) -> -1
(xor x, undef) -> undef

and so on.

Not having these can make it extremely annoying to find out where we differ from SelectionDAG by looking at existing lit tests. Without them, we tend to produce pretty bad code generation when we run into instructions which use undef operands.

Also remove the nonpow2_store_narrowing testcase from arm64-fallback.ll, since we no longer fall back on the add.

Diff Detail

Event Timeline

paquette created this revision.Mar 17 2020, 7:26 PM
arsenm added inline comments.Mar 17 2020, 7:34 PM
llvm/include/llvm/Target/GlobalISel/Combine.td
174

Should add to all_combines

dsanders accepted this revision.Mar 18 2020, 10:26 AM

I was going to ask you to use the custom predicate feature but it doesn't appear to be there. I could have sworn I'd committed that before I had to temporarily prioritize other work. It doesn't seem to have been committed and reverted without me noticing either. Oh well, LGTM with the all_combine change and I'll migrate it to custom predicates once I've actually landed that.

llvm/test/CodeGen/AArch64/GlobalISel/prelegalizercombiner-undef.mir
4

It's a little odd to have an empty YAML doc at the start of the file. This line should probably be removed

This revision is now accepted and ready to land.Mar 18 2020, 10:26 AM
paquette updated this revision to Diff 251132.Mar 18 2020, 11:02 AM

Move combines to all_combines and remove extra cruft from testcase before committing.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2020, 11:25 AM