[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 12:00:31 PDT 2019
dsanders updated this revision to Diff 212874.
dsanders added a comment.
- add fixme
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65554/new/
https://reviews.llvm.org/D65554
Files:
llvm/include/llvm/CodeGen/TargetRegisterInfo.h
Index: llvm/include/llvm/CodeGen/TargetRegisterInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/TargetRegisterInfo.h
+++ llvm/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.212874.patch
Type: text/x-patch
Size: 1089 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190801/e05b71ea/attachment.bin>
More information about the llvm-commits
mailing list