This is an archive of the discontinued LLVM Phabricator instance.

[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides
ClosedPublic

Authored by coby on Jun 27 2017, 11:50 PM.

Details

Summary

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.

Test: D34740

Diff Detail

Repository
rL LLVM

Event Timeline

coby created this revision.Jun 27 2017, 11:50 PM
coby edited the summary of this revision. (Show Details)Jun 27 2017, 11:55 PM
coby added reviewers: rnk, echristo, myatsina.
myatsina accepted this revision.Jul 23 2017, 12:19 AM
This revision is now accepted and ready to land.Jul 23 2017, 12:19 AM
This revision was automatically updated to reflect the committed changes.
rnk edited edge metadata.Jul 24 2017, 1:54 PM
rnk added a subscriber: kcc.

I reverted this in rL308926 because it broke sanitizer-windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/14535

With this patch, clang would reject this code:

namespace cl { }
void f() {
  __asm {
    mov al, cl
  }
}
coby added a comment.Jul 24 2017, 1:58 PM
In D34739#819343, @rnk wrote:

I reverted this in rL308926 because it broke sanitizer-windows: http://lab.llvm.org:8011/builders/sanitizer-windows/builds/14535

With this patch, clang would reject this code:

namespace cl { }
void f() {
  __asm {
    mov al, cl
  }
}

blimey
my bad
will refine it and re-upload
thanks