Skip to content

Commit

Permalink
[X86][InlineAsm][Ms Compatibility]Prefer variable name over a registe…
Browse files Browse the repository at this point in the history
…r 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

llvm-svn: 308867
  • Loading branch information
Coby Tayree committed Jul 24, 2017
1 parent c48388d commit 1f5df89
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions clang/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
}

0 comments on commit 1f5df89

Please sign in to comment.