This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Fix legalizer artifact combiner from crashing with invalid dead instructions
ClosedPublic

Authored by aemerson on Mar 27 2019, 10:18 AM.

Details

Summary

The artifact combiners push instructions which have been marked for deletion onto an list for the legalizer to deal with on return. However, for trunc(ext) combines the combiner routine recursively calls itself. When it does this the dead instructions list may not be empty, and the other combiners don't expect to be dealing with essentially invalid MIR (multiple vreg defs etc).

This change fixes it by ensuring that the dead instructions are processed on entry into tryCombineInstruction.

As a result, this fix exposed a few places in tests where G_TRUNC instructions were not being deleted even though they were dead.

Diff Detail

Repository
rL LLVM

Event Timeline

aemerson created this revision.Mar 27 2019, 10:18 AM
qcolombet accepted this revision.Mar 27 2019, 10:25 AM
This revision is now accepted and ready to land.Mar 27 2019, 10:25 AM
This revision was automatically updated to reflect the committed changes.