Open yurivict opened 2 years ago
In aws_checksums_crc32c_hw
, __asm__("loop_small_%=: CRC32B (%[in]), %[crc]" : "+c"(crc) : [ crc ] "c"(crc), [ in ] "r"(input));
causes TwoAddressInstructionPass.cpp:1493 to trigger an assertion failure.
DstIdx == 3 (killed %107:gr32(tied-def 3))
i == 5
MI->getOperand(3).getReg() == MI->getOperand(5).getReg()
INLINEASM &"loop_small_${:uid}: CRC32B ($2), $1" [attdialect], $0:[regdef], implicit-def $ecx, $1:[reguse], killed $ecx, $2:[reguse:GR64], killed %106:gr64, $3:[reguse tiedto:$0], killed %107:gr32(tied-def 3), $4:[clobber], implicit-def dead early-clobber $df, $5:[clobber], implicit-def early-clobber $fpsw, $6:[clobber], implicit-def dead early-clobber $eflags, !8
Still investigating.
The : "+c"(crc) : [crc]"+c"(crc)
pattern is suspicious. The following patch helps a bit, but Clang still crashes in one INLINEASM
instruction.
@@ -6669 +6670 @@
- : "+c"(crc)
+ : [crc]"+c"(crc)
@@ -6672 +6673 @@
- : [ crc ] "c"(crc), [ in ] "d"(input)
+ : [ in ] "d"(input)
@@ -6755 +6756 @@
- : "+c"(crc), "+d"(input)
+ : [crc]"+c"(crc), "+d"(input)
@@ -6759 +6760 @@
- : [ crc ] "c"(crc), [ in ] "d"(input)
+ : [ in ] "d"(input)
@@ -6835 +6836 @@
- : "+c"(crc), "+d"(input)
+ : [crc]"+c"(crc), "+d"(input)
@@ -6839 +6840 @@
- : [ crc ] "c"(crc), [ in ] "d"(input)
+ : [ in ] "d"(input)
@@ -6871,0 +6873 @@
+ uint32_t crc1 = 0;
@@ -6873 +6875 @@
- __asm__("loop_small_%=: CRC32B (%[in]), %[crc]" : "+c"(crc) : [ crc ] "c"(crc), [ in ] "r"(input));
+ __asm__("loop_small_%=: CRC32B (%[in]), %[crc]" : [crc] "+c"(crc) : [ in ] "r"(input));
@@ -6890 +6892 @@
- __asm__("loop_leading_%=: CRC32B (%[in]), %[crc]" : "+c"(crc) : [ crc ] "c"(crc), [ in ] "r"(input));
+ __asm__("loop_leading_%=: CRC32B (%[in]), %[crc]" : [ crc ] "+c"(crc) : [ in ] "r"(input));
@@ -6920 +6922 @@
- __asm__ __volatile__("loop_8_%=: CRC32Q (%[in]), %%rcx" : "+c"(crc) : [ crc ] "c"(crc), [ in ] "r"(input));
+ __asm__ __volatile__("loop_8_%=: CRC32Q (%[in]), %%rcx" : [crc]"+c"(crc) : [ in ] "r"(input));
@@ -6928,2 +6930 @@
- : "+c"(crc)
- : [ crc ] "c"(crc), [ in ] "r"(input));
+ : [crc]"+c"(crc) : [ in ] "r"(input));
There are a lot of duplicates of this bug, and it's always some Amazon AWS code, e.g.:
I think AWS is using some common CRC inline assembly that causes either assertions or backend errors with clang. Probably some impossible register constraint, which instead of generating a normal diagnostic causes an assertion failure or backend failure...
@llvm/issue-subscribers-backend-x86
Project: https://github.com/awslabs/aws-crt-python OS: FreeBSD 14-CURRENT
clang-crash.tgz