From 1bd59c97fb6f0dea34daf63f231aca3edc6c3206 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 11 Jan 2015 09:09:01 +0000 Subject: [PATCH] CodeGen: Simplify consecutive '&' modifiers 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 | 5 +++++ test/CodeGen/asm.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index a003e8ab9e..d910f2fb96 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -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; diff --git a/test/CodeGen/asm.c b/test/CodeGen/asm.c index 5dbc01b121..c64f83f787 100644 --- a/test/CodeGen/asm.c +++ b/test/CodeGen/asm.c @@ -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}" +} -- 2.50.1