From: David Majnemer Date: Sun, 11 Jan 2015 09:13:56 +0000 (+0000) Subject: CodeGen: Simplify consecutive '%' modifiers X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0dcea0929b62ed8ecbf426f22599d84bb0fa26ad;p=clang CodeGen: Simplify consecutive '%' modifiers 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 --- diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index d910f2fb96..bd48227b15 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -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 ',': diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c index c64f83f787..038d346e99 100644 --- a/test/CodeGen/asm.c +++ b/test/CodeGen/asm.c @@ -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}" +}