[llvm] [AMDGPU] Don't unify divergent exit nodes with `musttail` calls (PR #126395)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 8 22:03:58 PST 2025


================
@@ -0,0 +1,25 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
+; RUN: opt -S -passes=amdgpu-unify-divergent-exit-nodes -mtriple=amdgcn-amd-amdhsa -mcpu=gfx90a %s -o - | FileCheck %s
+
+define void @spill_sgpr_with_tail_call() {
+; CHECK-LABEL: define void @spill_sgpr_with_tail_call(
+; CHECK-SAME: ) #[[ATTR0:[0-9]+]] {
+; CHECK-NEXT:    [[L1:%.*]] = load i1, ptr null, align 1
+; CHECK-NEXT:    br i1 [[L1]], label %[[SW_C:.*]], label %[[SW_D:.*]]
+; CHECK:       [[SW_D]]:
+; CHECK-NEXT:    musttail call void null()
+; CHECK-NEXT:    ret void
+; CHECK:       [[SW_C]]:
+; CHECK-NEXT:    ret void
+;
+  %L1 = load i1, ptr null, align 1
+  br i1 %L1, label %SW_C, label %SW_D
+
+SW_D:
+  musttail call void null()
----------------
arsenm wrote:

Also test a non void case. Does musttail support invoke?

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


More information about the llvm-commits mailing list