[PATCH] D65554: Prevent vregs leaking into the MC layer via TargetRegisterClass::contains()

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 16:44:20 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL367636: Prevent vregs leaking into the MC layer via TargetRegisterClass::contains() (authored by dsanders, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D65554?vs=212874&id=212931#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65554/new/

https://reviews.llvm.org/D65554

Files:
  llvm/trunk/include/llvm/CodeGen/TargetRegisterInfo.h


Index: llvm/trunk/include/llvm/CodeGen/TargetRegisterInfo.h
===================================================================
--- llvm/trunk/include/llvm/CodeGen/TargetRegisterInfo.h
+++ llvm/trunk/include/llvm/CodeGen/TargetRegisterInfo.h
@@ -87,11 +87,20 @@
   /// Return true if the specified register is included in this register class.
   /// This does not include virtual registers.
   bool contains(unsigned Reg) const {
+    /// FIXME: Historically this function has returned false when given vregs
+    ///        but it should probably only receive physical registers
+    if (!Register::isPhysicalRegister(Reg))
+      return false;
     return MC->contains(Reg);
   }
 
   /// Return true if both registers are in this class.
   bool contains(unsigned Reg1, unsigned Reg2) const {
+    /// FIXME: Historically this function has returned false when given a vregs
+    ///        but it should probably only receive physical registers
+    if (!Register::isPhysicalRegister(Reg1) ||
+        !Register::isPhysicalRegister(Reg2))
+      return false;
     return MC->contains(Reg1, Reg2);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65554.212931.patch
Type: text/x-patch
Size: 1107 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190801/0a892cbb/attachment.bin>


More information about the llvm-commits mailing list