[PATCH] D156119: [GlobalISel] Fix GIM_CheckIsSameOperandIgnoreCopies

Pierre van Houtryve via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 06:18:24 PDT 2023


Pierre-vh created this revision.
Pierre-vh added reviewers: arsenm, aemerson.
Herald added a project: All.
Pierre-vh requested review of this revision.
Herald added subscribers: llvm-commits, wdng.
Herald added a project: LLVM.

If the MI had more than one def it incorrectly returrned true.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156119

Files:
  llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h


Index: llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
===================================================================
--- llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
+++ llvm/include/llvm/CodeGen/GlobalISel/GIMatchTableExecutorImpl.h
@@ -847,9 +847,8 @@
 
       if (MatcherOpcode == GIM_CheckIsSameOperandIgnoreCopies) {
         if (Op.isReg() && OtherOp.isReg()) {
-          MachineInstr *MI = getDefIgnoringCopies(Op.getReg(), MRI);
-          MachineInstr *OtherMI = getDefIgnoringCopies(OtherOp.getReg(), MRI);
-          if (MI && MI == OtherMI)
+          if (getSrcRegIgnoringCopies(Op.getReg(), MRI) ==
+              getSrcRegIgnoringCopies(OtherOp.getReg(), MRI))
             break;
         }
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156119.543506.patch
Type: text/x-patch
Size: 758 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230724/33359bba/attachment.bin>


More information about the llvm-commits mailing list