r225602 - CodeGen: Simplify consecutive '%' modifiers

David Majnemer david.majnemer at gmail.com
Sun Jan 11 01:13:56 PST 2015


Author: majnemer
Date: Sun Jan 11 03:13:56 2015
New Revision: 225602

URL: http://llvm.org/viewvc/llvm-project?rev=225602&view=rev
Log:
CodeGen: Simplify consecutive '%' modifiers

LLVM the consecutive '%' modifiers are redundant, skip them.

Modified:
    cfe/trunk/lib/CodeGen/CGStmt.cpp
    cfe/trunk/test/CodeGen/asm.c

Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=225602&r1=225601&r2=225602&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Sun Jan 11 03:13:56 2015
@@ -1660,8 +1660,9 @@ SimplifyConstraint(const char *Constrain
         Constraint++;
       break;
     case '&':
-      Result += '&';
-      while (Constraint[1] && Constraint[1] == '&')
+    case '%':
+      Result += *Constraint;
+      while (Constraint[1] && Constraint[1] == *Constraint)
         Constraint++;
       break;
     case ',':

Modified: cfe/trunk/test/CodeGen/asm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/asm.c?rev=225602&r1=225601&r2=225602&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/asm.c (original)
+++ cfe/trunk/test/CodeGen/asm.c Sun Jan 11 03:13:56 2015
@@ -255,3 +255,10 @@ void t30(int len) {
   // CHECK: @t30
   // CHECK: call void asm sideeffect "", "=*&rm,0,~{dirflag},~{fpsr},~{flags}"
 }
+
+void t31(int len) {
+  __asm__ volatile(""
+                   : "+%%rm"(len), "+rm"(len));
+  // CHECK: @t31
+  // CHECK: call void asm sideeffect "", "=*%rm,=*rm,0,1,~{dirflag},~{fpsr},~{flags}"
+}





More information about the cfe-commits mailing list