[PATCH] D13984: [mips] Check the register class before replacing materializations of zero with $zero in microMIPS.

Vasileios Kalintiris via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 03:19:37 PDT 2015


This revision was automatically updated to reflect the committed changes.
Closed by commit rL251622: [mips] Check the register class before replacing materializations of zero… (authored by vkalintiris).

Changed prior to commit:
  http://reviews.llvm.org/D13984?vs=38124&id=38719#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D13984

Files:
  llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp
  llvm/trunk/test/CodeGen/Mips/micromips-zero-mat-uses.ll

Index: llvm/trunk/test/CodeGen/Mips/micromips-zero-mat-uses.ll
===================================================================
--- llvm/trunk/test/CodeGen/Mips/micromips-zero-mat-uses.ll
+++ llvm/trunk/test/CodeGen/Mips/micromips-zero-mat-uses.ll
@@ -0,0 +1,8 @@
+; RUN: llc -march=mips -mcpu=mips32r2 -mattr=+micromips,+nooddspreg -O0 < %s | FileCheck %s
+
+; CHECK: addiu    $[[R0:[0-9]+]], $zero, 0
+; CHECK: subu16   $2, $[[R0]], ${{[0-9]+}}
+define i32 @foo() {
+  %1 = sub i32 0, undef
+  ret i32 %1
+}
Index: llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp
===================================================================
--- llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp
+++ llvm/trunk/lib/Target/Mips/MipsSEISelDAGToDAG.cpp
@@ -115,6 +115,11 @@
     if (MI->isPHI() || MI->isRegTiedToDefOperand(OpNo) || MI->isPseudo())
       continue;
 
+    // Also, we have to check that the register class of the operand
+    // contains the zero register.
+    if (!MRI->getRegClass(MO.getReg())->contains(ZeroReg))
+      continue;
+
     MO.setReg(ZeroReg);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13984.38719.patch
Type: text/x-patch
Size: 1078 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151029/621c606a/attachment.bin>


More information about the llvm-commits mailing list