================
@@ -0,0 +1,32 @@
+; RUN: llc < %s -mtriple=i386-pc-windows-msvc | FileCheck %s
+
+; Verify that the 'offset' reference to an inline asm label uses the same
+; PrivateLabelPrefix as the label definition. On Windows COFF the prefix is
"L".
+;
+; Previously, the label definition got the "L" prefix via AOK_Label rewrite,
+; but the offset reference skipped the rewrite and used the internal name
+; without the prefix, causing an undefined symbol error at link time.
+;
+; C source:
+; int main() {
+; unsigned dwpXIP;
+; __asm {
+; XIP_label:
+; mov dwpXIP, offset XIP_label
+; }
+; return 0;
+; }
+
+define dso_local i32 @label_offset() {
+entry:
+ %result = alloca i32, align 4
+ call void asm sideeffect inteldialect
"L__MSASMLABEL_.${:uid}__XIP_label:\0A\09mov dword ptr $0, offset
L__MSASMLABEL_.${:uid}__XIP_label", "=*m,~{dirflag},~{fpsr},~{flags}"(ptr
elementtype(i32) %result)
+ %0 = load i32, ptr %result, align 4
+ ret i32 %0
+}
+
+; The key check: both the label definition and offset reference must use
+; the same "L__MSASMLABEL_.0__XIP_label" name with the "L" prefix.
----------------
phoebewang wrote:
So should remove this test?
https://github.com/llvm/llvm-project/pull/199552
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits