llvm/llvm-project

[AMDGPU][GlobalIsel] ICE: cannot select G_PHI

Open

#200,792 opened on 2026年6月1日

GitHub で見る
 (13 comments) (0 reactions) (1 assignee)C++ (10,782 forks)batch import
backend:AMDGPUconfirmedcrash-on-validgood first issuellvm:globalisel

Repository metrics

Stars
 (26,378 stars)
PR merge metrics
 (平均マージ 1d 2h) (30d で 1,000 merged PRs)

説明

The following bitcode module triggers an internal compiler error for -global-isel -O0 in f68ef5b4303de763ecf37fd57cbefc3891ee48c0:

define i32 @__ockl_get_num_groups() {
  %1 = load i16, ptr addrspace(4) null, align 2
  %2 = icmp ne i16 %1, 0
  br label %3

3:                                                ; preds = %0
  %4 = phi i1 [ %2, %0 ]
  %5 = zext i1 %4 to i32
  ret i32 %5
}

Reproducer: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a -O0 -global-isel module.ll

Failure: LLVM ERROR: cannot select: %12:sreg_64_xexec(s1) = G_PHI %11:vcc(s1), %bb.1 (in function: __ockl_get_num_groups

Bug found by @ElliotBLabs.

コントリビューターガイド