Index: llvm/include/llvm/CodeGen/MachineFunction.h =================================================================== --- llvm/include/llvm/CodeGen/MachineFunction.h +++ llvm/include/llvm/CodeGen/MachineFunction.h @@ -983,10 +983,14 @@ return VariableDbgInfos; } + /// Start tracking the arguments passed to the call \p CallI. void addCallArgsForwardingRegs(const MachineInstr *CallI, CallSiteInfoImpl &&CallInfo) { - assert(CallI->isCall()); - CallSitesInfo[CallI] = std::move(CallInfo); + assert(CallI->isCandidateForCallSiteEntry()); + bool Inserted = + CallSitesInfo.try_emplace(CallI, std::move(CallInfo)).second; + (void)Inserted; + assert(Inserted && "Call site info not unique"); } const CallSiteInfoMap &getCallSitesInfo() const { Index: llvm/include/llvm/CodeGen/MachineInstr.h =================================================================== --- llvm/include/llvm/CodeGen/MachineInstr.h +++ llvm/include/llvm/CodeGen/MachineInstr.h @@ -683,6 +683,10 @@ return hasProperty(MCID::Call, Type); } + /// Return true if this is a call instruction that may have an associated + /// call site entry in the debug info. + bool isCandidateForCallSiteEntry() const; + /// Returns true if the specified instruction stops control flow /// from executing the instruction immediately following it. Examples include /// unconditional branches and return instructions. Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp =================================================================== --- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -764,7 +764,7 @@ // Skip instructions which aren't calls. Both calls and tail-calling jump // instructions (e.g TAILJMPd64) are classified correctly here. - if (!MI.isCall()) + if (!MI.isCandidateForCallSiteEntry()) continue; // TODO: Add support for targets with delay slots (see: beginInstruction). Index: llvm/lib/CodeGen/MachineInstr.cpp =================================================================== --- llvm/lib/CodeGen/MachineInstr.cpp +++ llvm/lib/CodeGen/MachineInstr.cpp @@ -696,6 +696,20 @@ getParent()->erase_instr(this); } +bool MachineInstr::isCandidateForCallSiteEntry() const { + if (!isCall(MachineInstr::IgnoreBundle)) + return false; + switch (getOpcode()) { + case TargetOpcode::PATCHABLE_EVENT_CALL: + case TargetOpcode::PATCHABLE_TYPED_EVENT_CALL: + case TargetOpcode::PATCHPOINT: + case TargetOpcode::STACKMAP: + case TargetOpcode::STATEPOINT: + return false; + } + return true; +} + unsigned MachineInstr::getNumExplicitOperands() const { unsigned NumOperands = MCID->getNumOperands(); if (!MCID->isVariadic()) Index: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp =================================================================== --- llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp +++ llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp @@ -863,7 +863,8 @@ MI = &*std::next(Before); } - if (MI->isCall() && DAG->getTarget().Options.EnableDebugEntryValues) + if (MI->isCandidateForCallSiteEntry() && + DAG->getTarget().Options.EnableDebugEntryValues) MF.addCallArgsForwardingRegs(MI, DAG->getSDCallSiteInfo(Node)); return MI; Index: llvm/test/CodeGen/AArch64/arm64-anyregcc.ll =================================================================== --- llvm/test/CodeGen/AArch64/arm64-anyregcc.ll +++ llvm/test/CodeGen/AArch64/arm64-anyregcc.ll @@ -1,4 +1,4 @@ -; RUN: llc < %s -mtriple=arm64-apple-darwin | FileCheck %s +; RUN: llc < %s -debug-entry-values -mtriple=arm64-apple-darwin | FileCheck %s ; Stackmap Header: no constants - 6 callsites ; CHECK-LABEL: .section __LLVM_STACKMAPS,__llvm_stackmaps Index: llvm/test/CodeGen/AArch64/arm64-patchpoint.ll =================================================================== --- llvm/test/CodeGen/AArch64/arm64-patchpoint.ll +++ llvm/test/CodeGen/AArch64/arm64-patchpoint.ll @@ -1,5 +1,5 @@ -; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone < %s | FileCheck %s -; RUN: llc -mtriple=arm64-apple-darwin -enable-misched=0 -mcpu=cyclone -fast-isel -fast-isel-abort=1 < %s | FileCheck %s +; RUN: llc -mtriple=arm64-apple-darwin -debug-entry-values -enable-misched=0 -mcpu=cyclone < %s | FileCheck %s +; RUN: llc -mtriple=arm64-apple-darwin -debug-entry-values -enable-misched=0 -mcpu=cyclone -fast-isel -fast-isel-abort=1 < %s | FileCheck %s ; Trivial patchpoint codegen ; Index: llvm/test/CodeGen/X86/statepoint-allocas.ll =================================================================== --- llvm/test/CodeGen/X86/statepoint-allocas.ll +++ llvm/test/CodeGen/X86/statepoint-allocas.ll @@ -1,5 +1,5 @@ ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py -; RUN: llc -verify-machineinstrs < %s | FileCheck %s +; RUN: llc -verify-machineinstrs -debug-entry-values < %s | FileCheck %s ; Check that we can lower a use of an alloca both as a deopt value (where the ; exact meaning is up to the consumer of the stackmap) and as an explicit spill ; slot used for GC. Index: llvm/test/CodeGen/X86/xray-custom-log.ll =================================================================== --- llvm/test/CodeGen/X86/xray-custom-log.ll +++ llvm/test/CodeGen/X86/xray-custom-log.ll @@ -1,5 +1,5 @@ -; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s -; RUN: llc -verify-machineinstrs -filetype=asm -o - \ +; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s +; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - \ ; RUN: -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" { Index: llvm/test/CodeGen/X86/xray-typed-event-log.ll =================================================================== --- llvm/test/CodeGen/X86/xray-typed-event-log.ll +++ llvm/test/CodeGen/X86/xray-typed-event-log.ll @@ -1,5 +1,5 @@ -; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s -; RUN: llc -verify-machineinstrs -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \ +; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s +; RUN: llc -verify-machineinstrs -debug-entry-values -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \ ; RUN: -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" {