llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.85k stars 11.47k forks source link

x86 GlobalIsel IR Translater issues with calls #62777

Open tschuett opened 1 year ago

tschuett commented 1 year ago
remark: unable to translate instruction: call: '  tail call void @_ZdlPv(ptr noundef nonnull %0) #17, !dbg !13'
remark: unable to translate instruction: call: '  %23 = tail call ptr @realloc(ptr noundef %22, i64 noundef %20) #17, !dbg !44'
remark: unable to translate instruction: call: '  %5 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %0) #12, !dbg !15'

I believe the issue is with opaque pointers, see ptr.

Reproducer:

> cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" -DLLVM_ENABLE_PROJECTS="clang" -DCLANG_BOOTSTRAP_PASSTHROUGH="LLVM_TARGETS_TO_BUILD" -DCLANG_ENABLE_BOOTSTRAP=On -DBOOTSTRAP_CMAKE_CXX_FLAGS="-march=native -Rpass-missed='gisel-irtranslator' -fglobal-isel -mllvm -global-isel-abort=2" ./llvm
> ninja stage2
llvmbot commented 1 year ago

@llvm/issue-subscribers-backend-x86

RKSimon commented 1 year ago

x86 globalisel is not safe for use - there might be a fix for the specific issue you're seeing but I'd be very surprised if it allows you to then productively use globalisel

tschuett commented 1 year ago

I do not plan to use it in production. I did some fixes in the legalizer, but the translator is beyond me.

e.g. https://reviews.llvm.org/D150755

It fails loud and fast. The calls are a high frequency issue.

tschuett commented 1 year ago
// Handle only Linux C, X86_64_SysV calling conventions for now.
  if (!STI.isTargetLinux() || !(Info.CallConv == CallingConv::C ||
                                Info.CallConv == CallingConv::X86_64_SysV))
    return false;

This might be an issue. I am on OSX :-(

tschuett commented 1 year ago

Another error:

remark: unable to lower arguments: ptr [-Rpass-missed=gisel-irtranslator]