This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Constrain the dest reg of IMPLICT_DEF
ClosedPublic

Authored by aemerson on Jan 30 2018, 10:31 AM.

Details

Summary

This fixes a crash where the user is a COPY, which deliberately does not constrain its source operands, resulting in a vreg without a reg class escaping selection.

Diff Detail

Repository
rL LLVM

Event Timeline

aemerson created this revision.Jan 30 2018, 10:31 AM

Meant to say, I'm *not* familiar with this part of the codebase.

lib/CodeGen/GlobalISel/InstructionSelect.cpp
186 ↗(On Diff #132001)

After ISel, is it at all possible that vregs will have no regclass assigned? The above code assumes that specifically.

aemerson added inline comments.Jan 30 2018, 11:13 AM
lib/CodeGen/GlobalISel/InstructionSelect.cpp
186 ↗(On Diff #132001)

I'm not sure, it did seem odd. Perhaps the underlying issue is manifesting before this.

aemerson updated this revision to Diff 132035.Jan 30 2018, 1:16 PM
aemerson retitled this revision from [GlobalISel] Fix crash due to assuming a COPY src reg has a reg class to [GlobalISel] Constrain the dest reg of IMPLICT_DEF.
aemerson edited the summary of this revision. (Show Details)

New fix, I think the issue was that IMPLICIT_DEFs weren't constraining their dest register, while COPY selection didn't constrain the source.

qcolombet accepted this revision.Feb 1 2018, 11:05 AM

LGTM.

While I was here, I notice that selectCopy was not using getRegClassForTypeOnBank. Could you double check this is intended?

This revision is now accepted and ready to land.Feb 1 2018, 11:05 AM

Thanks, I'll commit this first and follow up on that. At first glance they're using different slightly different register classes so I'm not sure how correct it is to use that.

This revision was automatically updated to reflect the committed changes.