[clang] Revert "[X86][clang] Lift _BitInt() supported max width." (PR #81175)

Harald van Dijk via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 07:12:25 PST 2024


hvdijk wrote:

> I find your PR description very vague. Please be more specific about which ICEs and miscompilations you are concerned about (godbolt please). Is this _just_ about the open alignment question, or also something else?

I linked to where one major example had already been provided, but let me put it in here as well.

https://godbolt.org/z/4jTrW4fcP

```
clang++: /root/llvm-project/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:759: void {anonymous}::CGRecordLowering::clipTailPadding(): Assertion `Prior->FD->hasAttr<NoUniqueAddressAttr>() && "should not have reused this field's tail padding"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang++ -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics <source>
1.	<eof> parser at end of file
2.	<source>:9:3: LLVM IR generation of declaration 'g'
3.	<source>:9:3: Generating code for declaration 'g'
 #0 0x000000000389ed98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x389ed98)
 #1 0x000000000389ca7c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+++0x389ca7c)
 #2 0x00000000037e4f58 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007f7cec242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007f7cec2969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007f7cec242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007f7cec2287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007f7cec22871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007f7cec239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000003baa784 (anonymous namespace)::CGRecordLowering::clipTailPadding() CGRecordLayoutBuilder.cpp:0:0
#10 0x0000000003bb0253 (anonymous namespace)::CGRecordLowering::lower(bool) CGRecordLayoutBuilder.cpp:0:0
```

Here's another:

https://godbolt.org/z/eKahY86Yd

```
_BitInt(129) *f(_BitInt(129) *p) {
  return p + 1;
}

char *f(char *p) {
  return p + sizeof(_BitInt(129));
}
```

These should obviously produce identical code, but it results in

```
f(_BitInt(129)*):                            # @f(_BitInt(129)*)
        lea     rax, [rdi + 32]
        ret
f(char*):                                 # @f(char*)
        lea     rax, [rdi + 24]
        ret
```

The codegen is just completely broken, and the fact that it passes Clang's testing is simply due to the fact that we have close to zero tests that it works in any capacity.

Note that this revert doesn't remove the support entirely, it only moves it back behind the same `-fexperimental-max-bitint-width=` option that was already there before.

https://github.com/llvm/llvm-project/pull/81175


More information about the cfe-commits mailing list