Skip to content

After 0e46b49de433, Assertion failed: ((PDiffI->getUnitInc() >= 0) == (PNew >= POld) && "PSet overflow/underflow"), function getUpwardPressureDelta, file llvm/lib/CodeGen/RegisterPressure.cpp, line 1180. #76416

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

Open
DimitryAndric opened this issue Dec 26, 2023 · 16 comments
Assignees
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:codegen llvm:regalloc

Comments

@DimitryAndric
Copy link
Collaborator

After 0e46b49 ("Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG") I am seeing an assertion failure when building https://github.com/freebsd/freebsd-src/blob/main/sys/dev/fb/vga.c:

Assertion failed: ((PDiffI->getUnitInc() >= 0) == (PNew >= POld) && "PSet overflow/underflow"), function getUpwardPressureDelta, file /share/dim/src/llvm/llvm-project/llvm/lib/CodeGen/RegisterPressure.cpp, line 1180.
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: /home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang -cc1 -triple x86_64-unknown-freebsd15.0 -S -disable-free -clear-ast-before-backend -mrelocation-model static -mframe-pointer=all -relaxed-aliasing -ffp-contract=on -fno-rounding-math -mconstructor-aliases -ffreestanding -mcmodel=kernel -target-cpu x86-64 -target-feature -mmx -target-feature -sse -target-feature -aes -target-feature -avx -disable-red-zone -no-implicit-float -tune-cpu generic -O2 -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wmissing-include-dirs -Werror -std=gnu99 -fwrapv -stack-protector 1 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -faddrsig vga-0959df.i
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'vga-0959df.c'.
4.      Running pass 'Machine Instruction Scheduler' on function '@vga_save_state'
 #0 0x0000000004248fd8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x4248fd8)
 #1 0x0000000004246d19 llvm::sys::RunSignalHandlers() (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x4246d19)
 #2 0x0000000004249796 SignalHandler(int) Signals.cpp:0:0
 #3 0x0000000829aa050f handle_signal /usr/src/lib/libthr/thread/thr_sig.c:0:3
 #4 0x0000000829a9facb thr_sighandler /usr/src/lib/libthr/thread/thr_sig.c:245:1
 #5 0x0000000828adb2d3 ([vdso]+0x2d3)
 #6 0x000000082f52a05a _thr_kill /usr/obj/usr/src/amd64.amd64/lib/libc/thr_kill.S:4:0
 #7 0x000000082f4a3b34 __raise /usr/src/lib/libc/gen/raise.c:0:10
 #8 0x000000082f5558f9 abort /usr/src/lib/libc/stdlib/abort.c:67:17
 #9 0x000000082f486e01 (/lib/libc.so.7+0x98e01)
#10 0x00000000039cbcdb (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x39cbcdb)
#11 0x000000000386f4e2 llvm::GenericScheduler::initCandidate(llvm::GenericSchedulerBase::SchedCandidate&, llvm::SUnit*, bool, llvm::RegPressureTracker const&, llvm::RegPressureTracker&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x386f4e2)
#12 0x000000000386fc61 llvm::GenericScheduler::pickNodeFromQueue(llvm::SchedBoundary&, llvm::GenericSchedulerBase::CandPolicy const&, llvm::RegPressureTracker const&, llvm::GenericSchedulerBase::SchedCandidate&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x386fc61)
#13 0x000000000387070d llvm::GenericScheduler::pickNode(bool&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x387070d)
#14 0x0000000003866b11 llvm::ScheduleDAGMILive::schedule() (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x3866b11)
#15 0x0000000003873157 (anonymous namespace)::MachineSchedulerBase::scheduleRegions(llvm::ScheduleDAGInstrs&, bool) MachineScheduler.cpp:0:0
#16 0x00000000038729cf (anonymous namespace)::MachineScheduler::runOnMachineFunction(llvm::MachineFunction&) MachineScheduler.cpp:0:0
#17 0x00000000037c9018 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x37c9018)
#18 0x0000000003d70405 llvm::FPPassManager::runOnFunction(llvm::Function&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x3d70405)
#19 0x0000000003d789e4 llvm::FPPassManager::runOnModule(llvm::Module&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x3d789e4)
#20 0x0000000003d70ff2 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x3d70ff2)
#21 0x00000000049af1c1 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::__1::unique_ptr<llvm::raw_pwrite_stream, std::__1::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x49af1c1)
#22 0x00000000049cf912 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x49cf912)
#23 0x000000000664bdb6 clang::ParseAST(clang::Sema&, bool, bool) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x664bdb6)
#24 0x0000000004d95803 clang::FrontendAction::Execute() (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x4d95803)
#25 0x0000000004d0b3ad clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x4d0b3ad)
#26 0x0000000004e6e35c clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x4e6e35c)
#27 0x00000000026d7e1a cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x26d7e1a)
#28 0x00000000026d5073 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#29 0x00000000026d406a clang_main(int, char**, llvm::ToolContext const&) (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x26d406a)
#30 0x00000000026e2d64 main (/home/dim/obj/llvmorg-18-init-15692-g007ed0dccd6a-freebsd15-amd64-ninja-clang-rel-1/bin/clang+0x26e2d64)
#31 0x000000082f4785ca __libc_start1 /usr/src/lib/libc/csu/libc_start1.c:157:2
Abort trap

Reduced test case (C):

// clang -cc1 -triple x86_64-- -S -tune-cpu generic -O2 -std=gnu99 vga-min.c
int outb_port, biosadapters, probe_adapters___trans_tmp_1;
typedef int vi_probe_t(int, int **, void *, int);
typedef int vi_init_t(int, int *, int);
typedef int vi_show_font_t(int *, int);
typedef int vi_save_palette_t(int *, unsigned char *);
typedef int vi_load_palette_t(int *, unsigned char *);
typedef int vi_set_border_t(int *, int);
typedef int vi_save_state_t(int *, void *, unsigned long);
typedef int vi_set_win_org_t(int *, long);
typedef int vi_read_hw_cursor_t(int *, int *, int *);
typedef int vi_set_hw_cursor_t(int *, int, int);
typedef int vi_set_hw_cursor_shape_t(int *, int, int, int, int);
typedef int vi_blank_display_t(int *, int);
typedef int vi_mmap_t(int *, unsigned long, unsigned long *, int, char *);
typedef int vi_fill_rect_t(int *, int, int, int, int, int);
typedef int vi_bitblt_t(int *, ...);
typedef struct {
  vi_init_t *init;
  vi_show_font_t *show_font;
  vi_save_palette_t *save_palette;
  vi_load_palette_t *load_palette;
  vi_set_border_t *set_border;
  vi_save_state_t *save_state;
  vi_set_win_org_t *set_win_org;
  vi_read_hw_cursor_t *read_hw_cursor;
  vi_set_hw_cursor_t *set_hw_cursor;
  vi_set_hw_cursor_shape_t *set_hw_cursor_shape;
  vi_blank_display_t *blank_display;
  vi_mmap_t *mmap;
  vi_fill_rect_t *fill_rect;
  vi_bitblt_t *bitblt;
  int (*reserved2)(void);
} video_switch_t;
struct video_driver {
  int (*configure)(int);
};
struct {
  char regs[4];
} *vga_load_state_p;
char vga_load_state_data;
static int vga_configure(int flags) { return biosadapters; }
static int vga_error(void) { return 9; }
vi_probe_t vga_probe;
static int vga_init(int unit, int *adp, int flags) { return 0; }
static int vga_show_font(int *adp, int page) { return 0; }
static int vga_save_palette(int *adp, unsigned char *palette) { return 0; }
static int vga_load_palette(int *adp, unsigned char *palette) { return 0; }
static int vga_set_border(int *adp, int color) { return 0; }
static int vga_save_state(int *adp, void *p, unsigned long size) { return 0; }
static int vga_load_state(void) {
  int i;
  for (i = 0; i < 4; ++i) {
    char data = 0;
    __asm("" : : "a"(data));
  }
  for (i = 0; i < 20; ++i) {
    __asm("" : : "Nd"(outb_port));
    vga_load_state_data = vga_load_state_p->regs[i];
    __asm("");
  }
  return 0;
}
static int vga_set_origin(int *adp, long offset) { return 9; }
static int vga_read_hw_cursor(int *adp, int *col, int *row) { return 0; }
static int vga_set_hw_cursor(int *adp, int col, int row) { return 0; }
static int vga_set_hw_cursor_shape(int *adp, int base, int height, int celsize,
                                   int blink) {
  return 0;
}
static int vga_blank_display(int *adp, int mode) { return 0; }
static int vga_mmap_buf(int *adp, unsigned long offset, unsigned long *paddr,
                        int prot, char *memattr) {
  return 0;
}
static int vga_fill_rect(int *adp, int val, int x, int y, int cx, int cy) {
  return 9;
}
static int vga_bitblt(int *adp, ...) { return 9; }
video_switch_t vgavidsw = {vga_init,          vga_show_font,
                           vga_save_palette,  vga_load_palette,
                           vga_set_border,    vga_save_state,
                           vga_set_origin,    vga_read_hw_cursor,
                           vga_set_hw_cursor, vga_set_hw_cursor_shape,
                           vga_blank_display, vga_mmap_buf,
                           vga_fill_rect,     vga_bitblt,
                           vga_error};
struct video_driver vga_driver = {vga_configure};
static void clear_mode_map(void) {}
static int map_bios_mode_num(void) { return 1; }
static int probe_adapters(void) {
  map_bios_mode_num();
  switch (probe_adapters___trans_tmp_1)
    clear_mode_map;
  return biosadapters;
}
static void fill(void) {}
static void filll_io(void) {}
int vga_probe(int unit, int **adpp, void *arg, int flags) {
  probe_adapters();
  vga_load_state();
  return 0;
  fill;
  filll_io;
}

Further reduced with bugpoint:

; ModuleID = 'bugpoint-reduced-simplified.bc'
source_filename = "vga-min.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-freebsd15.0"

%struct.video_switch_t.3.26.76.97.147.117 = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.video_driver.4.27.77.98.148.118 = type { ptr }
%struct.anon.5.28.78.99.149.119 = type { [4 x i8] }

@vgavidsw = external dso_local global %struct.video_switch_t.3.26.76.97.147.117, align 8
@vga_driver = external dso_local global %struct.video_driver.4.27.77.98.148.118, align 8
@outb_port = external dso_local global i32, align 4
@biosadapters = external dso_local global i32, align 4
@probe_adapters___trans_tmp_1 = external dso_local global i32, align 4
@vga_load_state_p = external dso_local global ptr, align 8
@vga_load_state_data = external dso_local global i8, align 1

declare dso_local void @vga_init() #0

declare dso_local void @vga_show_font() #0

declare dso_local void @vga_save_palette() #0

declare dso_local void @vga_load_palette() #0

declare dso_local void @vga_set_border() #0

declare dso_local void @vga_save_state() #0

declare dso_local void @vga_set_origin() #0

declare dso_local void @vga_read_hw_cursor() #0

declare dso_local void @vga_set_hw_cursor() #0

declare dso_local void @vga_set_hw_cursor_shape() #0

declare dso_local void @vga_blank_display() #0

declare dso_local void @vga_mmap_buf() #0

declare dso_local void @vga_fill_rect() #0

declare dso_local void @vga_bitblt(ptr, ...) #0

declare dso_local void @vga_error() #0

declare dso_local void @vga_configure() #0

declare dso_local void @vga_probe() #0

declare dso_local void @probe_adapters() #0

define dso_local void @vga_load_state() #0 {
entry:
  %i = alloca i32, align 4
  store i32 0, ptr %i, align 4
  br label %for.cond

for.cond:                                         ; preds = %for.body, %entry
  %0 = load i32, ptr %i, align 4
  %cmp = icmp slt i32 %0, 4
  br i1 %cmp, label %for.body, label %for.end

for.body:                                         ; preds = %for.cond
  call void asm sideeffect "", "{ax},~{dirflag},~{fpsr},~{flags}"(i8 0) #2
  %1 = load i32, ptr %i, align 4
  %inc = add nsw i32 %1, 1
  store i32 %inc, ptr %i, align 4
  br label %for.cond

for.end:                                          ; preds = %for.cond
  store i32 0, ptr %i, align 4
  br label %for.cond1

for.cond1:                                        ; preds = %for.cond1, %for.end
  call void asm sideeffect "", "N{dx},~{dirflag},~{fpsr},~{flags}"(i32 poison) #2
  %2 = load ptr, ptr @vga_load_state_p, align 8
  %regs = getelementptr inbounds %struct.anon.5.28.78.99.149.119, ptr %2, i32 0, i32 0
  %3 = load i32, ptr %i, align 4
  %idxprom = sext i32 %3 to i64
  %arrayidx = getelementptr inbounds [4 x i8], ptr %regs, i64 0, i64 %idxprom
  %4 = load i8, ptr %arrayidx, align 1
  store i8 %4, ptr @vga_load_state_data, align 1
  %5 = load i32, ptr %i, align 4
  %inc5 = add nsw i32 %5, 1
  store i32 %inc5, ptr %i, align 4
  br label %for.cond1, !llvm.loop !1
}

declare dso_local void @map_bios_mode_num() #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

attributes #0 = { "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind }

!llvm.ident = !{!0}

!0 = !{!"clang version 18.0.0git (https://github.com/llvm/llvm-project.git 007ed0dccd6a3d19f331eb7cd91438d792754439)"}
!1 = distinct !{!1, !2}
!2 = !{!"llvm.loop.mustprogress"}
@EugeneZelenko EugeneZelenko added llvm:optimizations crash Prefer [crash-on-valid] or [crash-on-invalid] and removed new issue labels Dec 27, 2023
@arsenm
Copy link
Contributor

arsenm commented Dec 27, 2023

Reduced MIR test:

 # RUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-scheduler -verify-misched -o - %s

---
name:            vga_load_state
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $rdi

    %0:gr64 = COPY $rdi
    undef %1.sub_32bit:gr64_nosp = MOV32r0 implicit-def dead $eflags
    dead $eax = MOV32r0 implicit-def dead $eflags, implicit-def $rax
    INLINEASM &"", 1 /* sideeffect attdialect */
    dead $eax = MOV32r0 implicit-def dead $eflags
    INLINEASM &"", 1 /* sideeffect attdialect */
    dead $eax = MOV32r0 implicit-def dead $eflags
    dead $eax = MOV32r0 implicit-def dead $eflags, implicit-def $rax

...

@DimitryAndric
Copy link
Collaborator Author

So maybe for the time being, we should revert "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG" yet again? Or is that now too much hassle? It seems to have gone in and out several times now... :)

@DimitryAndric
Copy link
Collaborator Author

(Still asserts with llvmorg-18-init-15938-g c1764a7)

DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 2, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
@thevinster
Copy link
Contributor

thevinster commented Jan 3, 2024

I'm also seeing a similar issue of this and it fails similarly when cross-compiling for windows assert for release/15.x and release/16.x. Reverting 0e46b49 seems to solve the issue for me as well. Thanks for the revert!

@DimitryAndric
Copy link
Collaborator Author

I haven't yet reverted it on main, just on my FreeBSD branch. If Matt currently doesn't have time to fix the underlying problem, I will revert it later today.

DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 3, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
@thevinster
Copy link
Contributor

@arsenm Are there any updates on this? If this is taking a while to fix, could we please revert the patch so that downstream builds could continue to build?

@arsenm
Copy link
Contributor

arsenm commented Jan 4, 2024

@arsenm Are there any updates on this? If this is taking a while to fix, could we please revert the patch so that downstream builds could continue to build?

I've been debugging it for a few days; it's a pre-existing RegisterPressure/Scheduler bug but I'm not really getting anywhere with it. The symptoms disappear with -precompute-phys-liveness. The pathway that doesn't use accurate liveness information seems to not work correctly with multiple defs of overlapping registers

@arsenm
Copy link
Contributor

arsenm commented Jan 4, 2024

This was reverted in c414612. Another reproducer was posted at 0e46b49

@arsenm
Copy link
Contributor

arsenm commented Jan 4, 2024

More reduced test case:

# RUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-scheduler -misched-bottomup -verify-misched -o - %s
# xUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-scheduler -misched-topdown -verify-misched -o - %s
# xUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-scheduler -misched-topdown -o - %s

---
name:            vga_load_state
tracksRegLiveness: true
body:             |
  bb.0:
    liveins: $rdi

    INLINEASM &"", 1 /* sideeffect attdialect */
    INLINEASM &"", 1 /* sideeffect attdialect */
    INLINEASM &"", 1 /* sideeffect attdialect */
    INLINEASM &"", 1 /* sideeffect attdialect */
    $ebx = MOV32r0 implicit-def $eflags
    dead $ecx = MOV32r0 implicit-def $eflags
    $eax = MOV32r0 implicit-def $eflags
    $eax = MOV32r0 implicit-def $eflags

...

DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 11, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 11, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 22, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 24, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 24, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 25, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Jan 27, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
emaste added a commit to emaste/freebsd that referenced this issue Jan 29, 2024
commit 1600828
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:21:16 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-18361-g22683463740e (and 18.1.0).

commit 52b4829
Merge: a43ec4d 2d835ae
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:04:14 2024 +0100

    Merge llvm-project release/18.x llvmorg-18-init-18361-g22683463740e

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project release/18.x llvmorg-18-init-18361-g22683463740e.

    PR:		276104
    MFC after:	1 month

commit a43ec4d
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:03:20 2024 +0100

    Tentatively apply libcxxrt/libcxxrt#27.

commit 8c92776
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:02:51 2024 +0100

    libc++: use build defines and flags similar to upstream.

commit ee6242e
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 09:27:12 2024 +0100

    Add one more header to libc++.

commit 10b01f5
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 00:39:43 2024 +0100

    Update libclang, libllvm, llc and lli Makefiles.

commit 3fedac5
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:35:46 2024 +0100

    Update libc++ generated files, and add __assertion_handler.

commit a0e5951
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:31:39 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-18359-g93248729cfae.

commit 4785b74
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:23:36 2024 +0100

    Update contrib/llvm-project/FREEBSD-Xlist.

commit 7b2e79f
Merge: cacb883 4df029c
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:17:23 2024 +0100

    Merge llvm-project main llvmorg-18-init-18359-g93248729cfae

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the
    last commit before the upstream release/18.x branch was created.

    PR:		276104
    MFC after:	1 month

commit cacb883
Author: Dimitry Andric <[email protected]>
Date:   Mon Jan 15 00:18:22 2024 +0100

    Tabify libc++ Makefile.

commit 570d711
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 14 14:20:42 2024 +0100

    Redo libc++ customizations:
    * Remove osreldate include because _LIBCPP_HAS_NO_GETS has disappeared
    * Instead, add direct major __FreeBSD__ check for using ::gets declaration
    * Mark EINTEGRITY values as FreeBSD customization
    * Reformat _LIBCPP_TYPE_VISIBILITY_DEFAULT customization

commit 7a2564e
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 12 14:47:52 2024 +0100

    Update libc++ module.modulemap.

commit fe1ed81
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 12 10:57:07 2024 +0100

    Fixup libllvm Makefile for DWARFLinker stuff being moved around.

commit 0da36bd
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:30:38 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16864-g3b3ee1f53424.

commit 11c252f
Merge: 4a86f7a 950076c
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:29:01 2024 +0100

    Merge llvm-project main llvmorg-18-init-16864-g3b3ee1f53424

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

    PR:		276104
    MFC after:	1 month

commit 4a86f7a
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 14:49:11 2024 +0100

    Update libllvm and llvm-tblgen Makefiles.

commit 63f3024
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 14:48:50 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16595-g7c00a5be5cde.

commit 4fd92c9
Merge: 68ef48a aca2e42
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 9 21:00:28 2024 +0100

    Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

    PR:		276104
    MFC after:	1 month

commit 68ef48a
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 17:03:13 2024 +0100

    Tentatively merge llvm/llvm-project#77242:

      [libcxx] Re-include <osreldate.h> in __config for FreeBSD

      In 0a97720d0197 some changes were made to `__config` for assuming that
      `__BYTE_ORDER__` is always present.

      However, this deleted a `<osreldate.h>` include for FreeBSD, which is
      required to get the value of `__FreeBSD_version`, and that is used later
      in the file to determine whether `_LIBCPP_C_HAS_NO_GETS` needs to be
      enabled.

      Include `<osreldate.h>` just after the other includes used for feature
      detection, to fix this.

      Note that when FreeBSD 13 is EOLed, this can be removed, as then all
      supported FreeBSD versions will no longer have `gets()`.

commit 76789e3
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 12:32:29 2024 +0100

    Add two FreeBSD customizations to libc++, to better support ports usage
    of older clang versions:
    * Add _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS block around compiler
      version checks, to avoid any warnings about support. This makes some
      ports that use -Werror fall over.
    * When using clang < 15.0, avoid using a type visibility attribute on
      the std namespace, as older versions of clang do not support this.

commit cc76185
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 12:28:35 2024 +0100

    Fix up ObsoleteFiles entries for libc++.

commit a390488
Author: Dimitry Andric <[email protected]>
Date:   Sat Jan 6 20:55:41 2024 +0100

    Add more clang 17 ObsoleteFiles entries.

commit 83360c9
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 20:35:30 2024 +0100

    Add files needed for lldb FreeBSD-Kernel DynamicLoader.

commit 35b7a12
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 19:22:03 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16003-gfc5f51cf5af4.

commit 4129e90
Merge: 2b2daef 77dbea0
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 19:04:11 2024 +0100

    Merge llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

    PR:		276104
    MFC after:	1 month

commit 2b2daef
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 2 17:09:41 2024 +0100

    compiler-rt builtins: move 80-bit long double functions into their own
    block, only enabling it for x86, and add more 128-bit quad functions.

commit 1897d7b
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 2 17:07:31 2024 +0100

    Revert upstream commit 0e46b49de433:

      Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

      This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

      PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

    Since it causes an assertion failure building /sys/dev/fb/vga.c:
    llvm/llvm-project#76416

commit e8bea5b
Author: Dimitry Andric <[email protected]>
Date:   Mon Jan 1 18:58:15 2024 +0100

    Apply llvmorg-18-init-15846-g953ae94149f0.

commit fc1be50
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 19:20:33 2023 +0100

    Add new files and remove deleted files from various Makefiles.

commit 52fbde5
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 18:50:08 2023 +0100

    Bump llvm-project version numbers to llvmorg-18-init-15692-g007ed0dccd6a.

commit de06c97
Merge: 861a687 99aabd7
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 18:35:41 2023 +0100

    Merge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

    PR:		276104
    MFC after:	1 month

commit 861a687
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 23:30:02 2023 +0100

    Tentatively apply llvm/llvm-project#76175, to
    fix libsa including compiler-rt builtins.

commit d160c09
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 16:56:34 2023 +0100

    Add several new builtins to compiler-rt, and enable quad support for amd64.

commit 4a4805c
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 14:47:43 2023 +0100

    Use -Wno-vla-cxx-extension for libomp, since clang 18 complains.

commit 1ea8afa
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 23:05:48 2023 +0100

    Update libomp generated headers.

commit e4dc98f
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 23:00:26 2023 +0100

    Update libclang_rt makefiles.

commit 57fdac5
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 21:41:18 2023 +0100

    Update build glue for libc++.

commit 3100f67
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 19:47:22 2023 +0100

    Fix up clang version in lib/libclang_rt/compiler-rt-vars.mk.

commit 4afe081
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 23:43:32 2023 +0100

    Update build glue to build lldb.

commit 0b8fcd7
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 21:54:32 2023 +0100

    Regenerate lib/clang/liblldb/LLDBWrapLua.cpp.

commit 449c332
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 21:48:16 2023 +0100

    Update build glue to build llvm extra tools.

commit 08e2b98
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 20:10:38 2023 +0100

    Update build glue to build full clang (with static analyzer).

commit 1eb0dd0
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 19:30:46 2023 +0100

    Update build glue to build default llvm tools for world.

commit fed5e94
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 17:40:08 2023 +0100

    Add new files to libclang, and re-sort.

commit 888e44f
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 17:40:00 2023 +0100

    Add new files to libllvm, and re-sort.

commit 1782bad
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 15:37:31 2023 +0100

    Add newly introduced .inc files to libclang.

commit 51daeac
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 15:37:11 2023 +0100

    Cleanup removed files from libclang.

commit 9eb2055
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 12:34:00 2023 +0100

    After llvm/llvm-project@ac182deee8287 RISCV's
    global isel td file got split off to RISCVGISel.td, so handle that in
    libllvm's Makefile.

commit dcef8b3
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 12:27:35 2023 +0100

    Cleanup removed files from libllvm.

commit 8a9dc72
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:52:45 2023 +0100

    Update Makefile for llvm-tblgen.

commit 6290052
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:40:01 2023 +0100

    Update FREEBSD-Xlist for llvm 18.

commit 1226f66
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:38:45 2023 +0100

    Bump llvm-project numbers from 17.0.6 to 18.0.0.

commit 9f03c73
Merge: 72dd306 312c0ed
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 21:30:12 2023 +0100

    Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

    PR:		276104
    MFC after:	1 month

commit 2d835ae
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 19:03:34 2024 +0100

    Vendor import of llvm-project branch release/18.x llvmorg-18-init-18361-g22683463740e.

commit 4df029c
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:11:41 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-18359-g93248729cfae,
    the last commit before the upstream release/18.x branch was created.

commit 950076c
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:24:21 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

commit aca2e42
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 9 20:58:18 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

commit 77dbea0
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 17:57:07 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

commit 99aabd7
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 14:49:57 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

commit 312c0ed
Author: Dimitry Andric <[email protected]>
Date:   Sun Dec 17 21:41:09 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

commit b1c7353
Author: Dimitry Andric <[email protected]>
Date:   Sat Dec 9 14:28:42 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-14265-ga17671084db1.
emaste added a commit to emaste/freebsd that referenced this issue Jan 31, 2024
commit 1600828
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:21:16 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-18361-g22683463740e (and 18.1.0).

commit 52b4829
Merge: a43ec4d 2d835ae
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:04:14 2024 +0100

    Merge llvm-project release/18.x llvmorg-18-init-18361-g22683463740e

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project release/18.x llvmorg-18-init-18361-g22683463740e.

    PR:		276104
    MFC after:	1 month

commit a43ec4d
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:03:20 2024 +0100

    Tentatively apply libcxxrt/libcxxrt#27.

commit 8c92776
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:02:51 2024 +0100

    libc++: use build defines and flags similar to upstream.

commit ee6242e
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 09:27:12 2024 +0100

    Add one more header to libc++.

commit 10b01f5
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 00:39:43 2024 +0100

    Update libclang, libllvm, llc and lli Makefiles.

commit 3fedac5
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:35:46 2024 +0100

    Update libc++ generated files, and add __assertion_handler.

commit a0e5951
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:31:39 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-18359-g93248729cfae.

commit 4785b74
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:23:36 2024 +0100

    Update contrib/llvm-project/FREEBSD-Xlist.

commit 7b2e79f
Merge: cacb883 4df029c
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:17:23 2024 +0100

    Merge llvm-project main llvmorg-18-init-18359-g93248729cfae

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the
    last commit before the upstream release/18.x branch was created.

    PR:		276104
    MFC after:	1 month

commit cacb883
Author: Dimitry Andric <[email protected]>
Date:   Mon Jan 15 00:18:22 2024 +0100

    Tabify libc++ Makefile.

commit 570d711
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 14 14:20:42 2024 +0100

    Redo libc++ customizations:
    * Remove osreldate include because _LIBCPP_HAS_NO_GETS has disappeared
    * Instead, add direct major __FreeBSD__ check for using ::gets declaration
    * Mark EINTEGRITY values as FreeBSD customization
    * Reformat _LIBCPP_TYPE_VISIBILITY_DEFAULT customization

commit 7a2564e
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 12 14:47:52 2024 +0100

    Update libc++ module.modulemap.

commit fe1ed81
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 12 10:57:07 2024 +0100

    Fixup libllvm Makefile for DWARFLinker stuff being moved around.

commit 0da36bd
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:30:38 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16864-g3b3ee1f53424.

commit 11c252f
Merge: 4a86f7a 950076c
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:29:01 2024 +0100

    Merge llvm-project main llvmorg-18-init-16864-g3b3ee1f53424

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

    PR:		276104
    MFC after:	1 month

commit 4a86f7a
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 14:49:11 2024 +0100

    Update libllvm and llvm-tblgen Makefiles.

commit 63f3024
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 14:48:50 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16595-g7c00a5be5cde.

commit 4fd92c9
Merge: 68ef48a aca2e42
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 9 21:00:28 2024 +0100

    Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

    PR:		276104
    MFC after:	1 month

commit 68ef48a
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 17:03:13 2024 +0100

    Tentatively merge llvm/llvm-project#77242:

      [libcxx] Re-include <osreldate.h> in __config for FreeBSD

      In 0a97720d0197 some changes were made to `__config` for assuming that
      `__BYTE_ORDER__` is always present.

      However, this deleted a `<osreldate.h>` include for FreeBSD, which is
      required to get the value of `__FreeBSD_version`, and that is used later
      in the file to determine whether `_LIBCPP_C_HAS_NO_GETS` needs to be
      enabled.

      Include `<osreldate.h>` just after the other includes used for feature
      detection, to fix this.

      Note that when FreeBSD 13 is EOLed, this can be removed, as then all
      supported FreeBSD versions will no longer have `gets()`.

commit 76789e3
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 12:32:29 2024 +0100

    Add two FreeBSD customizations to libc++, to better support ports usage
    of older clang versions:
    * Add _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS block around compiler
      version checks, to avoid any warnings about support. This makes some
      ports that use -Werror fall over.
    * When using clang < 15.0, avoid using a type visibility attribute on
      the std namespace, as older versions of clang do not support this.

commit cc76185
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 12:28:35 2024 +0100

    Fix up ObsoleteFiles entries for libc++.

commit a390488
Author: Dimitry Andric <[email protected]>
Date:   Sat Jan 6 20:55:41 2024 +0100

    Add more clang 17 ObsoleteFiles entries.

commit 83360c9
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 20:35:30 2024 +0100

    Add files needed for lldb FreeBSD-Kernel DynamicLoader.

commit 35b7a12
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 19:22:03 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16003-gfc5f51cf5af4.

commit 4129e90
Merge: 2b2daef 77dbea0
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 19:04:11 2024 +0100

    Merge llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

    PR:		276104
    MFC after:	1 month

commit 2b2daef
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 2 17:09:41 2024 +0100

    compiler-rt builtins: move 80-bit long double functions into their own
    block, only enabling it for x86, and add more 128-bit quad functions.

commit 1897d7b
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 2 17:07:31 2024 +0100

    Revert upstream commit 0e46b49de433:

      Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

      This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

      PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

    Since it causes an assertion failure building /sys/dev/fb/vga.c:
    llvm/llvm-project#76416

commit e8bea5b
Author: Dimitry Andric <[email protected]>
Date:   Mon Jan 1 18:58:15 2024 +0100

    Apply llvmorg-18-init-15846-g953ae94149f0.

commit fc1be50
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 19:20:33 2023 +0100

    Add new files and remove deleted files from various Makefiles.

commit 52fbde5
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 18:50:08 2023 +0100

    Bump llvm-project version numbers to llvmorg-18-init-15692-g007ed0dccd6a.

commit de06c97
Merge: 861a687 99aabd7
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 18:35:41 2023 +0100

    Merge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

    PR:		276104
    MFC after:	1 month

commit 861a687
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 23:30:02 2023 +0100

    Tentatively apply llvm/llvm-project#76175, to
    fix libsa including compiler-rt builtins.

commit d160c09
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 16:56:34 2023 +0100

    Add several new builtins to compiler-rt, and enable quad support for amd64.

commit 4a4805c
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 14:47:43 2023 +0100

    Use -Wno-vla-cxx-extension for libomp, since clang 18 complains.

commit 1ea8afa
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 23:05:48 2023 +0100

    Update libomp generated headers.

commit e4dc98f
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 23:00:26 2023 +0100

    Update libclang_rt makefiles.

commit 57fdac5
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 21:41:18 2023 +0100

    Update build glue for libc++.

commit 3100f67
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 19:47:22 2023 +0100

    Fix up clang version in lib/libclang_rt/compiler-rt-vars.mk.

commit 4afe081
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 23:43:32 2023 +0100

    Update build glue to build lldb.

commit 0b8fcd7
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 21:54:32 2023 +0100

    Regenerate lib/clang/liblldb/LLDBWrapLua.cpp.

commit 449c332
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 21:48:16 2023 +0100

    Update build glue to build llvm extra tools.

commit 08e2b98
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 20:10:38 2023 +0100

    Update build glue to build full clang (with static analyzer).

commit 1eb0dd0
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 19:30:46 2023 +0100

    Update build glue to build default llvm tools for world.

commit fed5e94
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 17:40:08 2023 +0100

    Add new files to libclang, and re-sort.

commit 888e44f
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 17:40:00 2023 +0100

    Add new files to libllvm, and re-sort.

commit 1782bad
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 15:37:31 2023 +0100

    Add newly introduced .inc files to libclang.

commit 51daeac
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 15:37:11 2023 +0100

    Cleanup removed files from libclang.

commit 9eb2055
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 12:34:00 2023 +0100

    After llvm/llvm-project@ac182deee8287 RISCV's
    global isel td file got split off to RISCVGISel.td, so handle that in
    libllvm's Makefile.

commit dcef8b3
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 12:27:35 2023 +0100

    Cleanup removed files from libllvm.

commit 8a9dc72
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:52:45 2023 +0100

    Update Makefile for llvm-tblgen.

commit 6290052
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:40:01 2023 +0100

    Update FREEBSD-Xlist for llvm 18.

commit 1226f66
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:38:45 2023 +0100

    Bump llvm-project numbers from 17.0.6 to 18.0.0.

commit 9f03c73
Merge: 72dd306 312c0ed
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 21:30:12 2023 +0100

    Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

    PR:		276104
    MFC after:	1 month

commit 2d835ae
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 19:03:34 2024 +0100

    Vendor import of llvm-project branch release/18.x llvmorg-18-init-18361-g22683463740e.

commit 4df029c
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:11:41 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-18359-g93248729cfae,
    the last commit before the upstream release/18.x branch was created.

commit 950076c
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:24:21 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

commit aca2e42
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 9 20:58:18 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

commit 77dbea0
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 17:57:07 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

commit 99aabd7
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 14:49:57 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

commit 312c0ed
Author: Dimitry Andric <[email protected]>
Date:   Sun Dec 17 21:41:09 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

commit b1c7353
Author: Dimitry Andric <[email protected]>
Date:   Sat Dec 9 14:28:42 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-14265-ga17671084db1.
emaste added a commit to emaste/freebsd that referenced this issue Feb 6, 2024
commit 1600828
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:21:16 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-18361-g22683463740e (and 18.1.0).

commit 52b4829
Merge: a43ec4d 2d835ae
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:04:14 2024 +0100

    Merge llvm-project release/18.x llvmorg-18-init-18361-g22683463740e

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project release/18.x llvmorg-18-init-18361-g22683463740e.

    PR:		276104
    MFC after:	1 month

commit a43ec4d
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:03:20 2024 +0100

    Tentatively apply libcxxrt/libcxxrt#27.

commit 8c92776
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:02:51 2024 +0100

    libc++: use build defines and flags similar to upstream.

commit ee6242e
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 09:27:12 2024 +0100

    Add one more header to libc++.

commit 10b01f5
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 00:39:43 2024 +0100

    Update libclang, libllvm, llc and lli Makefiles.

commit 3fedac5
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:35:46 2024 +0100

    Update libc++ generated files, and add __assertion_handler.

commit a0e5951
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:31:39 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-18359-g93248729cfae.

commit 4785b74
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:23:36 2024 +0100

    Update contrib/llvm-project/FREEBSD-Xlist.

commit 7b2e79f
Merge: cacb883 4df029c
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:17:23 2024 +0100

    Merge llvm-project main llvmorg-18-init-18359-g93248729cfae

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the
    last commit before the upstream release/18.x branch was created.

    PR:		276104
    MFC after:	1 month

commit cacb883
Author: Dimitry Andric <[email protected]>
Date:   Mon Jan 15 00:18:22 2024 +0100

    Tabify libc++ Makefile.

commit 570d711
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 14 14:20:42 2024 +0100

    Redo libc++ customizations:
    * Remove osreldate include because _LIBCPP_HAS_NO_GETS has disappeared
    * Instead, add direct major __FreeBSD__ check for using ::gets declaration
    * Mark EINTEGRITY values as FreeBSD customization
    * Reformat _LIBCPP_TYPE_VISIBILITY_DEFAULT customization

commit 7a2564e
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 12 14:47:52 2024 +0100

    Update libc++ module.modulemap.

commit fe1ed81
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 12 10:57:07 2024 +0100

    Fixup libllvm Makefile for DWARFLinker stuff being moved around.

commit 0da36bd
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:30:38 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16864-g3b3ee1f53424.

commit 11c252f
Merge: 4a86f7a 950076c
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:29:01 2024 +0100

    Merge llvm-project main llvmorg-18-init-16864-g3b3ee1f53424

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

    PR:		276104
    MFC after:	1 month

commit 4a86f7a
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 14:49:11 2024 +0100

    Update libllvm and llvm-tblgen Makefiles.

commit 63f3024
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 14:48:50 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16595-g7c00a5be5cde.

commit 4fd92c9
Merge: 68ef48a aca2e42
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 9 21:00:28 2024 +0100

    Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

    PR:		276104
    MFC after:	1 month

commit 68ef48a
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 17:03:13 2024 +0100

    Tentatively merge llvm/llvm-project#77242:

      [libcxx] Re-include <osreldate.h> in __config for FreeBSD

      In 0a97720d0197 some changes were made to `__config` for assuming that
      `__BYTE_ORDER__` is always present.

      However, this deleted a `<osreldate.h>` include for FreeBSD, which is
      required to get the value of `__FreeBSD_version`, and that is used later
      in the file to determine whether `_LIBCPP_C_HAS_NO_GETS` needs to be
      enabled.

      Include `<osreldate.h>` just after the other includes used for feature
      detection, to fix this.

      Note that when FreeBSD 13 is EOLed, this can be removed, as then all
      supported FreeBSD versions will no longer have `gets()`.

commit 76789e3
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 12:32:29 2024 +0100

    Add two FreeBSD customizations to libc++, to better support ports usage
    of older clang versions:
    * Add _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS block around compiler
      version checks, to avoid any warnings about support. This makes some
      ports that use -Werror fall over.
    * When using clang < 15.0, avoid using a type visibility attribute on
      the std namespace, as older versions of clang do not support this.

commit cc76185
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 12:28:35 2024 +0100

    Fix up ObsoleteFiles entries for libc++.

commit a390488
Author: Dimitry Andric <[email protected]>
Date:   Sat Jan 6 20:55:41 2024 +0100

    Add more clang 17 ObsoleteFiles entries.

commit 83360c9
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 20:35:30 2024 +0100

    Add files needed for lldb FreeBSD-Kernel DynamicLoader.

commit 35b7a12
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 19:22:03 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16003-gfc5f51cf5af4.

commit 4129e90
Merge: 2b2daef 77dbea0
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 19:04:11 2024 +0100

    Merge llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

    PR:		276104
    MFC after:	1 month

commit 2b2daef
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 2 17:09:41 2024 +0100

    compiler-rt builtins: move 80-bit long double functions into their own
    block, only enabling it for x86, and add more 128-bit quad functions.

commit 1897d7b
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 2 17:07:31 2024 +0100

    Revert upstream commit 0e46b49de433:

      Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

      This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

      PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

    Since it causes an assertion failure building /sys/dev/fb/vga.c:
    llvm/llvm-project#76416

commit e8bea5b
Author: Dimitry Andric <[email protected]>
Date:   Mon Jan 1 18:58:15 2024 +0100

    Apply llvmorg-18-init-15846-g953ae94149f0.

commit fc1be50
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 19:20:33 2023 +0100

    Add new files and remove deleted files from various Makefiles.

commit 52fbde5
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 18:50:08 2023 +0100

    Bump llvm-project version numbers to llvmorg-18-init-15692-g007ed0dccd6a.

commit de06c97
Merge: 861a687 99aabd7
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 18:35:41 2023 +0100

    Merge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

    PR:		276104
    MFC after:	1 month

commit 861a687
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 23:30:02 2023 +0100

    Tentatively apply llvm/llvm-project#76175, to
    fix libsa including compiler-rt builtins.

commit d160c09
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 16:56:34 2023 +0100

    Add several new builtins to compiler-rt, and enable quad support for amd64.

commit 4a4805c
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 14:47:43 2023 +0100

    Use -Wno-vla-cxx-extension for libomp, since clang 18 complains.

commit 1ea8afa
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 23:05:48 2023 +0100

    Update libomp generated headers.

commit e4dc98f
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 23:00:26 2023 +0100

    Update libclang_rt makefiles.

commit 57fdac5
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 21:41:18 2023 +0100

    Update build glue for libc++.

commit 3100f67
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 19:47:22 2023 +0100

    Fix up clang version in lib/libclang_rt/compiler-rt-vars.mk.

commit 4afe081
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 23:43:32 2023 +0100

    Update build glue to build lldb.

commit 0b8fcd7
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 21:54:32 2023 +0100

    Regenerate lib/clang/liblldb/LLDBWrapLua.cpp.

commit 449c332
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 21:48:16 2023 +0100

    Update build glue to build llvm extra tools.

commit 08e2b98
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 20:10:38 2023 +0100

    Update build glue to build full clang (with static analyzer).

commit 1eb0dd0
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 19:30:46 2023 +0100

    Update build glue to build default llvm tools for world.

commit fed5e94
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 17:40:08 2023 +0100

    Add new files to libclang, and re-sort.

commit 888e44f
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 17:40:00 2023 +0100

    Add new files to libllvm, and re-sort.

commit 1782bad
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 15:37:31 2023 +0100

    Add newly introduced .inc files to libclang.

commit 51daeac
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 15:37:11 2023 +0100

    Cleanup removed files from libclang.

commit 9eb2055
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 12:34:00 2023 +0100

    After llvm/llvm-project@ac182deee8287 RISCV's
    global isel td file got split off to RISCVGISel.td, so handle that in
    libllvm's Makefile.

commit dcef8b3
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 12:27:35 2023 +0100

    Cleanup removed files from libllvm.

commit 8a9dc72
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:52:45 2023 +0100

    Update Makefile for llvm-tblgen.

commit 6290052
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:40:01 2023 +0100

    Update FREEBSD-Xlist for llvm 18.

commit 1226f66
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:38:45 2023 +0100

    Bump llvm-project numbers from 17.0.6 to 18.0.0.

commit 9f03c73
Merge: 72dd306 312c0ed
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 21:30:12 2023 +0100

    Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

    PR:		276104
    MFC after:	1 month

commit 2d835ae
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 19:03:34 2024 +0100

    Vendor import of llvm-project branch release/18.x llvmorg-18-init-18361-g22683463740e.

commit 4df029c
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:11:41 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-18359-g93248729cfae,
    the last commit before the upstream release/18.x branch was created.

commit 950076c
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:24:21 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

commit aca2e42
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 9 20:58:18 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

commit 77dbea0
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 17:57:07 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

commit 99aabd7
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 14:49:57 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

commit 312c0ed
Author: Dimitry Andric <[email protected]>
Date:   Sun Dec 17 21:41:09 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

commit b1c7353
Author: Dimitry Andric <[email protected]>
Date:   Sat Dec 9 14:28:42 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-14265-ga17671084db1.
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Feb 6, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Feb 7, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
emaste added a commit to emaste/freebsd that referenced this issue Mar 22, 2024
commit a7fb520
Author: Dimitry Andric <[email protected]>
Date:   Wed Feb 7 22:50:52 2024 +0100

    Update libllvm for new RISCVGenMacroFusion.inc tblgen header.

commit 92e38d7
Author: Dimitry Andric <[email protected]>
Date:   Wed Feb 7 19:01:09 2024 +0100

    Update libllvm for removed file.

commit 1f05b14
Author: Dimitry Andric <[email protected]>
Date:   Wed Feb 7 16:59:11 2024 +0100

    Bump llvm-project version numbers to llvmorg-18.1.0-rc2-0-gc6c86965d967.

commit dd2f072
Merge: 024a010 4fdf604
Author: Dimitry Andric <[email protected]>
Date:   Wed Feb 7 15:58:02 2024 +0100

    Merge llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967.

    PR:		276104
    MFC after:	1 month

commit 024a010
Author: Dimitry Andric <[email protected]>
Date:   Mon Feb 5 12:41:51 2024 +0100

    [libc++] Rename __bit_reference template parameter to avoid conflict

    As of 4d20cfcf4eb08217ed37c4d4c38dc395d7a66d26, `__bit_reference`
    contains a template `__fill_n` with a bool `_FillValue` parameter.

    Unfortunately there is a relatively widely used piece of scientific
    software called NetCDF, which exposes a (C) macro `_FillValue` in its
    public headers.

    When building the NetCDF C++ bindings, this quickly leads to compilation
    errors when the macro interferes with the template in `__bit_reference`.

    Rename the parameter to `_FillVal` to avoid the conflict.

commit 4721947
Author: Dimitry Andric <[email protected]>
Date:   Mon Feb 5 10:16:17 2024 +0100

    Merge commit 5f4ee5a2dfa9 from llvm-project (by Shanzhi):

      [Clang][AST] Fix a crash on attaching doc comments (#78716)

      This crash is basically caused by calling
      `ASTContext::getRawCommentForDeclNoCacheImp` with its input arguments
      `RepresentativeLocForDecl` and `CommentsInTheFile` refering to different
      files. A reduced reproducer is provided in this patch.

      After the source locations for instantiations of funtion template are
      corrected in the commit 256a0b298c68b89688b80350b034daf2f7785b67, the
      variable `CommitsInThisFile` in the function
      `ASTContext::attachCommentsToJustParsedDecls` would refer to the source
      file rather than the header file for implicit function template
      instantiation. Therefore, in the first loop in
      `ASTContext::attachCommentsToJustParsedDecls`, `D` should also be
      adjusted for relevant scenarios like the second loop.

      Fixes #67979
      Fixes #68524
      Fixes #70550

    This should fix a segfault when compiling graphics/gdal.

commit d4389cf
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 28 21:34:42 2024 +0100

    Merge commit 6e4930c67508 from llvm-project (by Alexander Kornienko):

      Revert "[SemaCXX] Implement CWG2137 (list-initialization from objects of the same type) (#77768)"

      This reverts commit 924701311aa79180e86ad8ce43d253f27d25ec7d. Causes compilation
      errors on valid code, see
      llvm/llvm-project#77768 (comment).

commit 638a121
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:21:16 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-18361-g22683463740e (and 18.1.0).

commit fb7b27d
Merge: 2ed68de 2d835ae
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:04:14 2024 +0100

    Merge llvm-project release/18.x llvmorg-18-init-18361-g22683463740e

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project release/18.x llvmorg-18-init-18361-g22683463740e.

    PR:		276104
    MFC after:	1 month

commit 2ed68de
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:03:20 2024 +0100

    Tentatively apply libcxxrt/libcxxrt#27.

commit a0cf20a
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 26 16:02:51 2024 +0100

    libc++: use build defines and flags similar to upstream.

commit 66f3903
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 09:27:12 2024 +0100

    Add one more header to libc++.

commit ddf7238
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 00:39:43 2024 +0100

    Update libclang, libllvm, llc and lli Makefiles.

commit e025714
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:35:46 2024 +0100

    Update libc++ generated files, and add __assertion_handler.

commit e7cb0e2
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:31:39 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-18359-g93248729cfae.

commit efd9603
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:23:36 2024 +0100

    Update contrib/llvm-project/FREEBSD-Xlist.

commit 550d813
Merge: 74464e8 4df029c
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:17:23 2024 +0100

    Merge llvm-project main llvmorg-18-init-18359-g93248729cfae

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-18359-g93248729cfae, the
    last commit before the upstream release/18.x branch was created.

    PR:		276104
    MFC after:	1 month

commit 74464e8
Author: Dimitry Andric <[email protected]>
Date:   Mon Jan 15 00:18:22 2024 +0100

    Tabify libc++ Makefile.

commit 1fbb16e
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 14 14:20:42 2024 +0100

    Redo libc++ customizations:
    * Remove osreldate include because _LIBCPP_HAS_NO_GETS has disappeared
    * Instead, add direct major __FreeBSD__ check for using ::gets declaration
    * Mark EINTEGRITY values as FreeBSD customization
    * Reformat _LIBCPP_TYPE_VISIBILITY_DEFAULT customization

commit f6cfebe
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 12 14:47:52 2024 +0100

    Update libc++ module.modulemap.

commit 2c45cec
Author: Dimitry Andric <[email protected]>
Date:   Fri Jan 12 10:57:07 2024 +0100

    Fixup libllvm Makefile for DWARFLinker stuff being moved around.

commit 1f35f87
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:30:38 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16864-g3b3ee1f53424.

commit 7b02ddb
Merge: 6ec4eed 950076c
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:29:01 2024 +0100

    Merge llvm-project main llvmorg-18-init-16864-g3b3ee1f53424

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

    PR:		276104
    MFC after:	1 month

commit 6ec4eed
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 14:49:11 2024 +0100

    Update libllvm and llvm-tblgen Makefiles.

commit b861bf2
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 14:48:50 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16595-g7c00a5be5cde.

commit 42aaf55
Merge: c8faa43 aca2e42
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 9 21:00:28 2024 +0100

    Merge llvm-project main llvmorg-18-init-16595-g7c00a5be5cde

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

    PR:		276104
    MFC after:	1 month

commit c8faa43
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 17:03:13 2024 +0100

    Tentatively merge llvm/llvm-project#77242:

      [libcxx] Re-include <osreldate.h> in __config for FreeBSD

      In 0a97720d0197 some changes were made to `__config` for assuming that
      `__BYTE_ORDER__` is always present.

      However, this deleted a `<osreldate.h>` include for FreeBSD, which is
      required to get the value of `__FreeBSD_version`, and that is used later
      in the file to determine whether `_LIBCPP_C_HAS_NO_GETS` needs to be
      enabled.

      Include `<osreldate.h>` just after the other includes used for feature
      detection, to fix this.

      Note that when FreeBSD 13 is EOLed, this can be removed, as then all
      supported FreeBSD versions will no longer have `gets()`.

commit 9db148e
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 12:32:29 2024 +0100

    Add two FreeBSD customizations to libc++, to better support ports usage
    of older clang versions:
    * Add _LIBCPP_ENABLE_COMPILER_VERSION_CHECKS block around compiler
      version checks, to avoid any warnings about support. This makes some
      ports that use -Werror fall over.
    * When using clang < 15.0, avoid using a type visibility attribute on
      the std namespace, as older versions of clang do not support this.

commit ab1dc4a
Author: Dimitry Andric <[email protected]>
Date:   Sun Jan 7 12:28:35 2024 +0100

    Fix up ObsoleteFiles entries for libc++.

commit 626eed6
Author: Dimitry Andric <[email protected]>
Date:   Sat Jan 6 20:55:41 2024 +0100

    Add more clang 17 ObsoleteFiles entries.

commit d23764d
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 20:35:30 2024 +0100

    Add files needed for lldb FreeBSD-Kernel DynamicLoader.

commit 7656fbd
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 19:22:03 2024 +0100

    Bump llvm-project version numbers to llvmorg-18-init-16003-gfc5f51cf5af4.

commit 9739ebd
Merge: b8840b4 77dbea0
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 19:04:11 2024 +0100

    Merge llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

    PR:		276104
    MFC after:	1 month

commit b8840b4
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 2 17:09:41 2024 +0100

    compiler-rt builtins: move 80-bit long double functions into their own
    block, only enabling it for x86, and add more 128-bit quad functions.

commit b3086e6
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 2 17:07:31 2024 +0100

    Revert upstream commit 0e46b49de433:

      Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

      This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

      PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

    Since it causes an assertion failure building /sys/dev/fb/vga.c:
    llvm/llvm-project#76416

commit c71a0fe
Author: Dimitry Andric <[email protected]>
Date:   Mon Jan 1 18:58:15 2024 +0100

    Apply llvmorg-18-init-15846-g953ae94149f0.

commit fab14fd
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 19:20:33 2023 +0100

    Add new files and remove deleted files from various Makefiles.

commit 5d05e48
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 18:50:08 2023 +0100

    Bump llvm-project version numbers to llvmorg-18-init-15692-g007ed0dccd6a.

commit 678f56a
Merge: 5f710e3 99aabd7
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 18:35:41 2023 +0100

    Merge llvm-project main llvmorg-18-init-15692-g007ed0dccd6a

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

    PR:		276104
    MFC after:	1 month

commit 5f710e3
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 23:30:02 2023 +0100

    Tentatively apply llvm/llvm-project#76175, to
    fix libsa including compiler-rt builtins.

commit bfd4f0d
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 16:56:34 2023 +0100

    Add several new builtins to compiler-rt, and enable quad support for amd64.

commit 60b6608
Author: Dimitry Andric <[email protected]>
Date:   Thu Dec 21 14:47:43 2023 +0100

    Use -Wno-vla-cxx-extension for libomp, since clang 18 complains.

commit b051bbb
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 23:05:48 2023 +0100

    Update libomp generated headers.

commit 98d0e7c
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 23:00:26 2023 +0100

    Update libclang_rt makefiles.

commit a08a308
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 21:41:18 2023 +0100

    Update build glue for libc++.

commit 326d983
Author: Dimitry Andric <[email protected]>
Date:   Wed Dec 20 19:47:22 2023 +0100

    Fix up clang version in lib/libclang_rt/compiler-rt-vars.mk.

commit 325ba5b
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 23:43:32 2023 +0100

    Update build glue to build lldb.

commit 612cd33
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 21:54:32 2023 +0100

    Regenerate lib/clang/liblldb/LLDBWrapLua.cpp.

commit 12d2341
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 21:48:16 2023 +0100

    Update build glue to build llvm extra tools.

commit bd80bb1
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 20:10:38 2023 +0100

    Update build glue to build full clang (with static analyzer).

commit 0e60a9e
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 19:30:46 2023 +0100

    Update build glue to build default llvm tools for world.

commit 1e1229d
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 17:40:08 2023 +0100

    Add new files to libclang, and re-sort.

commit 80bc357
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 17:40:00 2023 +0100

    Add new files to libllvm, and re-sort.

commit 220597d
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 15:37:31 2023 +0100

    Add newly introduced .inc files to libclang.

commit daeeb74
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 15:37:11 2023 +0100

    Cleanup removed files from libclang.

commit 69a6c58
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 12:34:00 2023 +0100

    After llvm/llvm-project@ac182deee8287 RISCV's
    global isel td file got split off to RISCVGISel.td, so handle that in
    libllvm's Makefile.

commit e27e76b
Author: Dimitry Andric <[email protected]>
Date:   Tue Dec 19 12:27:35 2023 +0100

    Cleanup removed files from libllvm.

commit fa84ac3
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:52:45 2023 +0100

    Update Makefile for llvm-tblgen.

commit d43e62d
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:40:01 2023 +0100

    Update FREEBSD-Xlist for llvm 18.

commit a3780ea
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 22:38:45 2023 +0100

    Bump llvm-project numbers from 17.0.6 to 18.0.0.

commit 5d469ef
Merge: 8758bf0 312c0ed
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 18 21:30:12 2023 +0100

    Merge llvm-project main llvmorg-18-init-15088-gd14ee76181fb

    This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
    openmp to llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

    PR:		276104
    MFC after:	1 month

commit 4fdf604
Author: Dimitry Andric <[email protected]>
Date:   Wed Feb 7 15:37:28 2024 +0100

    Vendor import of llvm-project branch release/18.x llvmorg-18.1.0-rc2-0-gc6c86965d967.

commit 2d835ae
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 25 19:03:34 2024 +0100

    Vendor import of llvm-project branch release/18.x llvmorg-18-init-18361-g22683463740e.

commit 4df029c
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 24 20:11:41 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-18359-g93248729cfae,
    the last commit before the upstream release/18.x branch was created.

commit 950076c
Author: Dimitry Andric <[email protected]>
Date:   Thu Jan 11 19:24:21 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16864-g3b3ee1f53424.

commit aca2e42
Author: Dimitry Andric <[email protected]>
Date:   Tue Jan 9 20:58:18 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16595-g7c00a5be5cde.

commit 77dbea0
Author: Dimitry Andric <[email protected]>
Date:   Wed Jan 3 17:57:07 2024 +0100

    Vendor import of llvm-project main llvmorg-18-init-16003-gfc5f51cf5af4.

commit 99aabd7
Author: Dimitry Andric <[email protected]>
Date:   Mon Dec 25 14:49:57 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-15692-g007ed0dccd6a.

commit 312c0ed
Author: Dimitry Andric <[email protected]>
Date:   Sun Dec 17 21:41:09 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-15088-gd14ee76181fb.

commit b1c7353
Author: Dimitry Andric <[email protected]>
Date:   Sat Dec 9 14:28:42 2023 +0100

    Vendor import of llvm-project main llvmorg-18-init-14265-ga17671084db1.
@arsenm
Copy link
Contributor

arsenm commented Mar 29, 2024

Adding a real use of $eax makes this no longer sensitive to having cached liveness info

---
name:            dead_register_def_pressure_tracking_underflow_assert
tracksRegLiveness: true
body:             |
  bb.0:
    INLINEASM &"", 1 /* sideeffect attdialect */
    INLINEASM &"", 1 /* sideeffect attdialect */
    INLINEASM &"", 1 /* sideeffect attdialect */
    INLINEASM &"", 1 /* sideeffect attdialect */
    $ebx = MOV32r0 implicit-def $eflags
    dead $ecx = MOV32r0 implicit-def $eflags
    $eax = MOV32r1 implicit-def $eflags
    $eax = MOV32r0 implicit-def $eflags

  bb.1:
    liveins: $eax
    INLINEASM &"", 1, implicit $eax
...

@arsenm
Copy link
Contributor

arsenm commented Apr 2, 2024

Even simpler:

---
name:            dead_register_def_pressure_tracking_underflow_assert_onereg
tracksRegLiveness: true
body:             |
 bb.0:
   INLINEASM &"", 1 /* sideeffect attdialect */
   INLINEASM &"", 1 /* sideeffect attdialect */
   INLINEASM &"", 1 /* sideeffect attdialect */
   INLINEASM &"", 1 /* sideeffect attdialect */
   INLINEASM &"", 1 /* sideeffect attdialect */
   INLINEASM &"", 1 /* sideeffect attdialect */
   $eax = MOV32r1 implicit-def $eflags
   $eax = MOV32r0 implicit-def $eflags

 bb.1:
   liveins: $eax
   INLINEASM &"", 1, implicit $eax
...

This passes when the dead flag is applied to the first $eax def. (actually it passes with a dead on the second one too, where we have a missing verifier error). The pressure diff is negative without the dead flag for the SU for the first mov. There's no pressure diff with the dead flag.

I've stared at this for an extremely long time, and I'm stuck. It seems to me the logic of upward tracking is essentially faulty. It's implicitly relying on accurate dead flags. It assumes if it sees a live def, it will be used before a redef. There is detectDeadDefs, but it isn't always used. It also tries to use cached regunit results, so you cannot rely on that either. I'm also not sure why this is using LiveIntervals. If it's stepping backwards over every instruction, it should have exact liveness information.

@arsenm
Copy link
Contributor

arsenm commented Apr 2, 2024

I wanted to look into whether more reliable dead flag preservation would help the original testcase, but I can't reproduce with the patch reapplied anymore

DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Apr 5, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
DimitryAndric added a commit to DimitryAndric/freebsd-src that referenced this issue Apr 5, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this issue Apr 6, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416

PR:		276104
MFC after:	1 month
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this issue Apr 20, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416

PR:		276104
MFC after:	1 month

(cherry picked from commit edc2dc1)
freebsd-git pushed a commit to freebsd/freebsd-src that referenced this issue Apr 20, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416

PR:		276104
MFC after:	1 month

(cherry picked from commit edc2dc1)
arsenm added a commit that referenced this issue May 21, 2024
Also add another testcase reported at the same regression commit. Make
sure this assert is fixed when the patch is eventually reapplied.
bsdjhb pushed a commit to bsdjhb/cheribsd that referenced this issue Aug 7, 2024
  Reapply "RegisterCoalescer: Add implicit-def of super register when coalescing SUBREG_TO_REG"

  This reverts commit c398fa009a47eb24f88383d5e911e59e70f8db86.

  PPC backend was fixed in 2f82662ce901c6666fceb9c6c5e0de216a1c9667

Since it causes an assertion failure building /sys/dev/fb/vga.c:
llvm/llvm-project#76416

PR:		276104
MFC after:	1 month
@jrbyrnes
Copy link
Contributor

Can we actually rely on accurate PDiffs for PhysRegs?

/// FIXME: Currently assuming single-use physregs.

@jrbyrnes
Copy link
Contributor

Can hack things to repro the PDiff crash for AMDGPU by using standard scheduler

ScheduleDAGInstrs *MachineScheduler::createMachineScheduler() {
  /*
  // Select the scheduler, or set the default.
  MachineSchedRegistry::ScheduleDAGCtor Ctor = MachineSchedOpt;
  if (Ctor != useDefaultMachineSched)
    return Ctor(this);

  // Get the default scheduler set by the target for this function.
  ScheduleDAGInstrs *Scheduler = PassConfig->createMachineScheduler(this);
  if (Scheduler)
    return Scheduler;

  // Default to GenericScheduler.
  */
  return createGenericSchedLive(this);
}
# RUN: llc -mtriple=amdgcn -run-pass=machine-scheduler -misched-bottomup -verify-misched -o - %s

---
name:            pdiff
tracksRegLiveness: true
body:             |
  bb.0:
    INLINEASM &"", 1 /* sideeffect attdialect */
    INLINEASM &"", 1 /* sideeffect attdialect */
    $vgpr1 = V_MOV_B32_e32 0, implicit-def $vgpr2, implicit $exec
    $vgpr1 = V_MOV_B32_e32 0, implicit-def $vgpr2, implicit $exec

...

arsenm referenced this issue Jan 6, 2025
…r when coalescing SUBREG_TO_REG""

This reverts commit 0e46b49.

Causes crashes, see repro on 0e46b49.
@sdesmalen-arm
Copy link
Collaborator

From reading this conversation, my understanding is that 0e46b49 triggered a bug in the scheduler/regpressure-tracking, which requires accurate dead flags on register operands and/or an accurate Liveinterval cache for all used physregs.

I tried to reproduce the issue and found that:

  • The scheduler issue still exists, because passing in the reduced MIR from above directly to the scheduler still fails the assert (PDiffI->getUnitInc() >= 0) == (PNew >= POld) && "PSet overflow/underflow".
  • The original patch (0e46b49) no longer triggers this issue, because re-applying the patch to main and compiling the reproducers mentioned here and here no longer fail.
  • The reason they no longer fail is because of this patch: RegisterCoalescer: Fix assert on remat to copy-to-physreg with subregs #121734.

If I understand things correctly then:

  • 0e46b49 adds the implicit-def of the super-register. When the register is a physreg, then the Coalescer should make sure LiveIntervals tracks the (previously unconsidered) regunit.
  • RegisterCoalescer: Fix assert on remat to copy-to-physreg with subregs #121734 does this by fluke as a side-effect of calling LIS->getRegUnit(Unit) when trying to determine if an instruction is rematerializable.
  • Alternatively, compiling with -precompute-phys-liveness populates live-ranges for all regunits from phys-regs, but I'd still expect the coalescer must do something to ensure their liveranges are updated. Also, there is probably a reason this option is not enabled by default?

I think we should be able to reland a modified version of 0e46b49 even if there is a latent bug in the scheduler, as long as the MIR has the correct dead flags and regunits are correctly updated in the cache. Is that a fair assessment?

Just a bit of context of why I'm looking into this. I am trying to enable subreg-liveness tracking (SRLT) for AArch64 and found that a missing implicit-def <superreg> after coalescing a SUBREG_TO_REG results in broken MIR. The implicit-def of the super-reg is needed to represent the zeroing of the top lanes done by the MOV (as described the SUBREG_TO_REG). But if this information is lost by coalescing, then the machine constant-propagation pass thinks it can remove the MOV, which means the top bits of the register are no longer zeroed. It seems this patch tried to fix that issue, although the patch does not yet work when SRLT is enabled (there is a FIXME+assert to say that the lanemasks need updating).

@arsenm, what is the best way forward here? I'd be happy to help out with re-landing this if you can use the help.

@arsenm
Copy link
Contributor

arsenm commented Jan 9, 2025

Alternatively, compiling with -precompute-phys-liveness populates live-ranges for all regunits from phys-regs, but I'd still expect the coalescer must do something to ensure their liveranges are updated.

Yes, I remember this property. It's part of why it was a pain to debug

Also, there is probably a reason this option is not enabled by default?

Compile time. Most of the time you shouldn't need to know the liveness for physical registers until later in the process

I think we should be able to reland a modified version of 0e46b49 even if there is a latent bug in the scheduler, as long as the MIR has the correct dead flags and regunits are correctly updated in the cache. Is that a fair assessment?

More or less, I don't have any particular interest in the scheduler bug beyond surviving reverts. I've failed enough times at debugging it to leave it for someone who know the scheduler better (we should probably commit an xfailed version of the MIR test for tracking purposes). It happens to compute the needed liveness for this one register, but it's still possible to lose that liveness information later. In any case, this is still another form of getting lucky to avoid breaking the test.

@arsenm, what is the best way forward here? I'd be happy to help out with re-landing this if you can use the help.

If we get can get this relanded, that would be great. I had other work on top of this that I've forgotten about.

I also still think we should get rid of SUBREG_TO_REG. It's structurally broken and requires this hackery, but it's a big project.

sdesmalen-arm added a commit to sdesmalen-arm/llvm-project that referenced this issue Jan 20, 2025
Changes made compared to 0e46b49:

* The code in `updateRegDefsUses` now updates subranges when
  subreg-liveness-tracking is enabled.

* When adding an implicit-def operand for the super-register,
  the code in `reMaterializeTrivialDef` which tries to remove
  undefined subranges should now take into account that the lanes
  from the super-reg are no longer undefined.

* Any operand that defines a register with a sub-reg, must set
  FullDef to false, because it only defines part of the register.

* Ensures that live-ranges are computed for all regunits of a
  physical reg that's added as implicit-def, as needed for subsequent
  passes, see the conversation on:

    llvm#76416
sdesmalen-arm added a commit that referenced this issue Jan 22, 2025
…alescing SUBREG_TO_REG" (#123632)

This PR aims to reland work done by @arsenm which was previously
reverted due to some tangentially related scheduler issues as discussed
on #76416.

This PR cherry-picks the original commit (0e46b49), and adds
another patch on top with the following changes:

* The code in `updateRegDefsUses` now updates subranges when
  subreg-liveness-tracking is enabled.

* When adding an implicit-def operand for the super-register,
  the code in `reMaterializeTrivialDef` which tries to remove
  undefined subranges should now take into account that the lanes
  from the super-reg are no longer undefined.

Co-authored-by: Matt Arsenault <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] llvm:codegen llvm:regalloc
Projects
None yet
Development

No branches or pull requests

10 participants