]> granicus.if.org Git - clang/commitdiff
CodeGen: Simplify consecutive '%' modifiers
authorDavid Majnemer <david.majnemer@gmail.com>
Sun, 11 Jan 2015 09:13:56 +0000 (09:13 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Sun, 11 Jan 2015 09:13:56 +0000 (09:13 +0000)
LLVM the consecutive '%' modifiers are redundant, skip them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225602 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGStmt.cpp
test/CodeGen/asm.c

index d910f2fb9696d1c3dd14d63de94e46e7cff12ba9..bd48227b15ca679ce9577918453c0e7511a1d92f 100644 (file)
@@ -1660,8 +1660,9 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target,
         Constraint++;
       break;
     case '&':
-      Result += '&';
-      while (Constraint[1] && Constraint[1] == '&')
+    case '%':
+      Result += *Constraint;
+      while (Constraint[1] && Constraint[1] == *Constraint)
         Constraint++;
       break;
     case ',':
index c64f83f78775075d02064d03f0c4bade4e6fb44b..038d346e9993a317ea9eed2a4ac07aee1d4e260a 100644 (file)
@@ -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}"
+}