[llvm-branch-commits] [llvm] VE: Compute live-ins after splitting for EXTEND_STACK expansion (PR #221553)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Sep 6 03:53:41 PDT 2026


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/221553

expandExtendStackPseudo splits its block but left the new blocks without
live-in lists, so their uses of registers live across the split are
rejected by -verify-machineinstrs.

Co-authored-by: Claude (Claude-Opus-4.8)

>From 7dbdc02e2f5bd0c2aefff489f737a53342277d06 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Sun, 6 Sep 2026 05:41:23 +0200
Subject: [PATCH] VE: Compute live-ins after splitting for EXTEND_STACK
 expansion

expandExtendStackPseudo splits its block but left the new blocks without
live-in lists, so their uses of registers live across the split are
rejected by -verify-machineinstrs.

Co-authored-by: Claude (Claude-Opus-4.8)
---
 llvm/lib/Target/VE/VEInstrInfo.cpp          | 5 +++++
 llvm/test/CodeGen/VE/Scalar/builtin_sjlj.ll | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Target/VE/VEInstrInfo.cpp b/llvm/lib/Target/VE/VEInstrInfo.cpp
index 3538dd0b521ab..2023a78b955a5 100644
--- a/llvm/lib/Target/VE/VEInstrInfo.cpp
+++ b/llvm/lib/Target/VE/VEInstrInfo.cpp
@@ -16,6 +16,7 @@
 #include "VESubtarget.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/CodeGen/LivePhysRegs.h"
 #include "llvm/CodeGen/MachineFrameInfo.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineMemOperand.h"
@@ -1074,6 +1075,10 @@ bool VEInstrInfo::expandExtendStackPseudo(MachineInstr &MI) const {
       .addImm(0);
 
   MI.eraseFromParent(); // The pseudo instruction is gone now.
+
+  LivePhysRegs LiveRegs;
+  computeAndAddLiveIns(LiveRegs, *sinkMBB);
+  computeAndAddLiveIns(LiveRegs, *syscallMBB);
   return true;
 }
 
diff --git a/llvm/test/CodeGen/VE/Scalar/builtin_sjlj.ll b/llvm/test/CodeGen/VE/Scalar/builtin_sjlj.ll
index 2713d61d16c2f..eb2261859a256 100644
--- a/llvm/test/CodeGen/VE/Scalar/builtin_sjlj.ll
+++ b/llvm/test/CodeGen/VE/Scalar/builtin_sjlj.ll
@@ -1,5 +1,5 @@
-; RUN: llc < %s -mtriple=ve | FileCheck %s
-; RUN: llc < %s -mtriple=ve -relocation-model=pic | \
+; RUN: llc < %s -mtriple=ve -verify-machineinstrs | FileCheck %s
+; RUN: llc < %s -mtriple=ve -relocation-model=pic -verify-machineinstrs | \
 ; RUN:     FileCheck %s -check-prefix=PIC
 
 %struct.__jmp_buf_tag = type { [25 x i64], i64, [16 x i64] }



More information about the llvm-branch-commits mailing list