This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] CombinerHelper: Fix a bug in matchCombineCopy
ClosedPublic

Authored by volkan on Nov 22 2019, 1:25 PM.

Details

Summary

When combining COPY instructions, we were replacing the destination registers
with the source register without checking register constraints. This patch adds
a simple logic to check if the constraints match before replacing registers.

Diff Detail

Event Timeline

volkan created this revision.Nov 22 2019, 1:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 22 2019, 1:25 PM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
87

Do we want this method to also handle the case of Regclass to Regclass copies (without any LLTs)? If yes, looks like this early exits.

volkan updated this revision to Diff 230722.Nov 22 2019, 2:16 PM
  • Handle the cases where the registers don't have LLT.
volkan marked 2 inline comments as done.Nov 22 2019, 2:17 PM
volkan added inline comments.
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
87

I added support for it as it's currently possible to create a register without an LLT attached, but I'm not sure if it's something we want to support in GlobalISel. What do you all think?

aditya_nandakumar added inline comments.
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
87

Thanks. This looks good to me.

This revision is now accepted and ready to land.Nov 22 2019, 2:36 PM
This revision was automatically updated to reflect the committed changes.
volkan marked an inline comment as done.