When a variable has a specified asm name, but isn't using the register storage class, the asm name doesn't specify a register. PR12244.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152873 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index b2da32b..e65c5f4 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -1295,6 +1295,8 @@
   const VarDecl *Variable = dyn_cast<VarDecl>(&Value);
   if (!Variable)
     return Constraint;
+  if (Variable->getStorageClass() != SC_Register)
+    return Constraint;
   AsmLabelAttr *Attr = Variable->getAttr<AsmLabelAttr>();
   if (!Attr)
     return Constraint;