[GlobalISel] Fix the artifact combiner to fold G_IMPLICIT_DEF properly
authorVolkan Keles <vkeles@apple.com>
Wed, 10 Oct 2018 18:01:48 +0000 (18:01 +0000)
committerVolkan Keles <vkeles@apple.com>
Wed, 10 Oct 2018 18:01:48 +0000 (18:01 +0000)
commitda5578c5d0fcbecf4ceb2c22be1e235df9a026a4
tree6ce047709bf518c68065d9a10f262ed4e0a87de7
parent057784a263d93cf2efe84f91c336ebfd30a28268
[GlobalISel] Fix the artifact combiner to fold G_IMPLICIT_DEF properly

Summary:
GlobalISel generates incorrect code because the legalizer artifact
combiner assumes `G_[SZ]EXT (G_IMPLICIT_DEF)` is equivalent to
`G_IMPLICIT_DEF `.

Replace `G_[SZ]EXT (G_IMPLICIT_DEF)` with 0 because the top bits
will be 0 for G_ZEXT and 0/1 for the G_SEXT.

Reviewers: aditya_nandakumar, dsanders, aemerson, javed.absar

Reviewed By: aditya_nandakumar

Subscribers: rovka, kristof.beyls, llvm-commits

Differential Revision: https://reviews.llvm.org/D52996

llvm-svn: 344163
llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h
llvm/test/CodeGen/AArch64/GlobalISel/legalize-ext.mir
llvm/test/CodeGen/X86/GlobalISel/legalize-ext.mir
llvm/test/CodeGen/X86/GlobalISel/legalize-undef.mir