From 4c6428f58e52e60bdb05e1c4f63c6cc26ffd2f19 Mon Sep 17 00:00:00 2001 From: Coby Tayree Date: Mon, 24 Jul 2017 07:06:37 +0000 Subject: [PATCH] [X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides On MS-style, the following snippet: int eax; __asm mov eax, ebx should yield loading of ebx, into the location pointed by the variable eax This patch sees to it. Currently, a reg-to-reg move would have been invoked. llvm: D34739 Differential Revision: https://reviews.llvm.org/D34740 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@308867 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/ms-inline-asm-var-name.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/CodeGen/ms-inline-asm-var-name.c diff --git a/test/CodeGen/ms-inline-asm-var-name.c b/test/CodeGen/ms-inline-asm-var-name.c new file mode 100644 index 0000000000..084e90500a --- /dev/null +++ b/test/CodeGen/ms-inline-asm-var-name.c @@ -0,0 +1,12 @@ +// REQUIRES: x86-registered-target +// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s + +void t() { + int eax; + int Ecx; + __asm mov eax, ebx + // CHECK: mov $0, ebx + __asm add ecx, Ecx + // CHECK: add ecx, $1 +} + -- 2.40.0