-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assertion failed: (i == DstIdx || !MI->getOperand(i).isReg() || MI->getOperand(i).getReg() != RegA), function processTiedPairs, #40330
Comments
This reduced case isn't valid code according to gcc. It says ecx should be bound to b for input and output. And the ecx should also be bound to a for input. Clang doesn't diagnose that properly and hits the same error from the larger bug. Is it possible this wasn't reduced correctly? |
Possibly. I've used creduce, and it tries to simplify inline asm quite a lot. The original code is full of +c constraints, like: asm("loop_small_%=: CRC32B (%[in]), %[crc]" : "+c"(crc) : [crc] "c"(crc), [in] "r"(input)); So probably a better minimized case is: unsigned f(const unsigned char *input) though gcc 8 requires at least -O1, otherwise it says the constraints are impossible. With -O1 or higher, it produces: $ gcc8 -O2 -S crc32c_sse42_asm-min-2.c -o - 4 "crc32c_sse42_asm-min-2.c" 1
0 "" 2#NO_APP |
Still occurs as of 2020-11-08, with llvmorg-12-init-10988-g43df29e2062: $ ~/ins/llvmorg-12-init-10988-g43df29e2062/bin/clang -cc1 -triple x86_64-- -S crc32c_sse42_asm-min.c
#0 0x000000000204a3c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dim/ins/llvmorg-12-init-10988-g43df29e2062/bin/clang+0x204a3c8) |
A possible duplicate. $ clang-trunk -v $ cat mutant.c $ clang-trunk mutant.c
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: |
Note that the whole assertion block: #ifndef NDEBUG was added a very long time ago by Alkis Evlogimenos in r10682: 08c5311: Date: Mon Jan 5 02:25:45 2004 +0000
So my question to Alkis (and Chris, since he moved some stuff in this pass around in 2004 too): is this "currently we cannot handle" comment still applicable at all? Since if you compile LLVM with assertions turned off, this whole block is now simply skipped, and the resulting assembly appears to work Just Fine? :) |
Another note is about the minimized test case: unsigned f(const unsigned char *input) compiled with gcc (10.3.0) -O1 -S results in: f: 4 "crc32c_sse42_asm-min-2.c" 1
0 "" 2#NO_APP and compiled with clang (12.0.0, disabled assertions) -O1 -S results in: f: # @f %bb.0:
So for some weird reason, clang duplicates the |
Still an issue, see #54957 |
Extended Description
As reported in https://bugs.freebsd.org/234232, building the devel/aws-checksums port (see also https://github.com/awslabs/aws-checksums) results in a clang assertion:
Assertion failed: (i == DstIdx || !MI->getOperand(i).isReg() || MI->getOperand(i).getReg() != RegA), function processTiedPairs, file lib/CodeGen/TwoAddressInstructionPass.cpp, line 1547.
Minimized test case:
/* clang -cc1 -triple x86_64-- -S crc32c_sse42_asm-min.c */
int a, b;
void c() { asm("" : "+c"(b) : "c"(a)); }
The text was updated successfully, but these errors were encountered: