Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ yaml::AArch64FunctionInfo::AArch64FunctionInfo(
getSVEStackSize(MFI, &llvm::AArch64FunctionInfo::getStackSizePPR)),
HasStackFrame(MFI.hasStackFrame()
? std::optional<bool>(MFI.hasStackFrame())
: std::nullopt) {}
: std::nullopt),
HasStreamingModeChanges(
MFI.hasStreamingModeChanges()
? std::optional<bool>(MFI.hasStreamingModeChanges())
: std::nullopt) {}

void yaml::AArch64FunctionInfo::mappingImpl(yaml::IO &YamlIO) {
MappingTraits<AArch64FunctionInfo>::mapping(YamlIO, *this);
Expand All @@ -55,6 +59,8 @@ void AArch64FunctionInfo::initializeBaseYamlFields(
YamlMFI.StackSizePPR.value_or(0));
if (YamlMFI.HasStackFrame)
setHasStackFrame(*YamlMFI.HasStackFrame);
if (YamlMFI.HasStreamingModeChanges)
setHasStreamingModeChanges(*YamlMFI.HasStreamingModeChanges);
}

static std::pair<bool, bool> GetSignReturnAddress(const Function &F) {
Expand Down
2 changes: 2 additions & 0 deletions llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ struct AArch64FunctionInfo final : public yaml::MachineFunctionInfo {
std::optional<uint64_t> StackSizeZPR;
std::optional<uint64_t> StackSizePPR;
std::optional<bool> HasStackFrame;
std::optional<bool> HasStreamingModeChanges;

AArch64FunctionInfo() = default;
AArch64FunctionInfo(const llvm::AArch64FunctionInfo &MFI);
Expand All @@ -659,6 +660,7 @@ template <> struct MappingTraits<AArch64FunctionInfo> {
YamlIO.mapOptional("stackSizeZPR", MFI.StackSizeZPR);
YamlIO.mapOptional("stackSizePPR", MFI.StackSizePPR);
YamlIO.mapOptional("hasStackFrame", MFI.HasStackFrame);
YamlIO.mapOptional("hasStreamingModeChanges", MFI.HasStreamingModeChanges);
}
};

Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/AArch64/AArch64PostCoalescerPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ bool AArch64PostCoalescer::runOnMachineFunction(MachineFunction &MF) {
if (Src != Dst)
MRI->replaceRegWith(Dst, Src);

if (MI.getOperand(1).isUndef())
for (MachineOperand &MO : MRI->use_operands(Dst))
MO.setIsUndef();

// MI must be erased from the basic block before recalculating the live
// interval.
LIS->RemoveMachineInstrFromMaps(MI);
Expand Down
16 changes: 16 additions & 0 deletions llvm/test/CodeGen/AArch64/aarch64-post-coalescer.mir
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py UTC_ARGS: --version 6
# RUN: llc -mtriple=aarch64 -mattr=+sme -run-pass=aarch64-post-coalescer-pass -o - %s | FileCheck %s

---
name: foo
machineFunctionInfo:
hasStreamingModeChanges: true
body: |
bb.0.entry:
; CHECK-LABEL: name: foo
; CHECK: $d0 = COPY undef %0:fpr64
; CHECK-NEXT: FAKE_USE implicit $d0
%1:fpr64 = COALESCER_BARRIER_FPR64 undef %1
$d0 = COPY %1
FAKE_USE implicit $d0
...
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/AArch64/mir-yaml-has-streaming-mode-changes.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; RUN: llc -mtriple=aarch64 -mattr=+sme -stop-after=aarch64-isel < %s | FileCheck %s

target triple = "aarch64"

declare void @foo() "aarch64_pstate_sm_enabled"

define dso_local void @bar() local_unnamed_addr {
; CHECK-LABEL: name: bar
; CHECK: hasStreamingModeChanges: true
entry:
tail call void @foo() "aarch64_pstate_sm_enabled"
ret void
}