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

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

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

index a003e8ab9e8112d317f2ba4e6aae3da203925a4f..d910f2fb9696d1c3dd14d63de94e46e7cff12ba9 100644 (file)
@@ -1659,6 +1659,11 @@ SimplifyConstraint(const char *Constraint, const TargetInfo &Target,
       while (Constraint[1] && Constraint[1] != ',')
         Constraint++;
       break;
+    case '&':
+      Result += '&';
+      while (Constraint[1] && Constraint[1] == '&')
+        Constraint++;
+      break;
     case ',':
       Result += "|";
       break;
index 5dbc01b1211d4c3dd933d6438cd887b11a9ce559..c64f83f78775075d02064d03f0c4bade4e6fb44b 100644 (file)
@@ -248,3 +248,10 @@ void t29(void) {
   // CHECK: @t29
   // CHECK: call void asm sideeffect "movl %eax, $0", "*m,~{dirflag},~{fpsr},~{flags}"([1 x i32]* @t29_var)
 }
+
+void t30(int len) {
+  __asm__ volatile(""
+                   : "+&&rm"(len));
+  // CHECK: @t30
+  // CHECK: call void asm sideeffect "", "=*&rm,0,~{dirflag},~{fpsr},~{flags}"
+}