[PATCH] D49984: Fix uninitialized read in ARM's PrintAsmOperand

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 30 09:46:10 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL338268: Fix uninitialized read in ARM's PrintAsmOperand (authored by thopre, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D49984

Files:
  llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
  llvm/trunk/test/CodeGen/ARM/inlineasm-64bit.ll


Index: llvm/trunk/test/CodeGen/ARM/inlineasm-64bit.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/inlineasm-64bit.ll
+++ llvm/trunk/test/CodeGen/ARM/inlineasm-64bit.ll
@@ -104,3 +104,11 @@
   %res = extractvalue {i64, i32, i64} %vars, 2
   ret i64 %res
 }
+
+; Check access to low and high part with a specific register pair constraint
+define i64 @low_high_specific_reg_pair(i64 %in) nounwind {
+; CHECK-LABEL: low_high_specific_reg_pair
+; CHECK: mov r3, r2
+  %res = call i64 asm "mov ${0:R}, ${1:Q}", "=&{r2},0"(i64 %in)
+  ret i64 %res
+}
Index: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -367,8 +367,9 @@
 
       unsigned NumVals = InlineAsm::getNumOperandRegisters(Flags);
       unsigned RC;
-      InlineAsm::hasRegClassConstraint(Flags, RC);
-      if (RC == ARM::GPRPairRegClassID) {
+      const TargetRegisterInfo *TRI = MF->getSubtarget().getRegisterInfo();
+      if (InlineAsm::hasRegClassConstraint(Flags, RC) &&
+          ARM::GPRPairRegClass.hasSubClassEq(TRI->getRegClass(RC))) {
         if (NumVals != 1)
           return true;
         const MachineOperand &MO = MI->getOperand(OpNum);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49984.157986.patch
Type: text/x-patch
Size: 1336 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180730/0a633930/attachment.bin>


More information about the llvm-commits mailing list