Skip to content

Commit 05e08cd

Browse files
authored
Revert "[llvm] Add CalleeTypeIds field to CallSiteInfo" (llvm#150335)
Reverts llvm#87574, which breaks LLVM :: CodeGen/MIR/X86/call-site-info-ambiguous-indirect-call-typeid.mir tests on linux-arm64 builders.
1 parent 11d97b3 commit 05e08cd

File tree

11 files changed

+11
-156
lines changed

11 files changed

+11
-156
lines changed

llvm/include/llvm/CodeGen/CommandFlags.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ LLVM_ABI bool getEnableStackSizeSection();
133133

134134
LLVM_ABI bool getEnableAddrsig();
135135

136-
LLVM_ABI bool getEnableCallGraphSection();
137-
138136
LLVM_ABI bool getEmitCallSiteInfo();
139137

140138
LLVM_ABI bool getEnableMachineFunctionSplitter();

llvm/include/llvm/CodeGen/MIRYamlMapping.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,6 @@ struct CallSiteInfo {
482482

483483
MachineInstrLoc CallLocation;
484484
std::vector<ArgRegPair> ArgForwardingRegs;
485-
/// Numeric callee type identifiers for the callgraph section.
486-
std::vector<uint64_t> CalleeTypeIds;
487485

488486
bool operator==(const CallSiteInfo &Other) const {
489487
return CallLocation.BlockNum == Other.CallLocation.BlockNum &&
@@ -513,7 +511,6 @@ template <> struct MappingTraits<CallSiteInfo> {
513511
YamlIO.mapRequired("offset", CSInfo.CallLocation.Offset);
514512
YamlIO.mapOptional("fwdArgRegs", CSInfo.ArgForwardingRegs,
515513
std::vector<CallSiteInfo::ArgRegPair>());
516-
YamlIO.mapOptional("calleeTypeIds", CSInfo.CalleeTypeIds);
517514
}
518515

519516
static const bool flow = true;

llvm/include/llvm/CodeGen/MachineFunction.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,6 @@ class LLVM_ABI MachineFunction {
515515
struct CallSiteInfo {
516516
/// Vector of call argument and its forwarding register.
517517
SmallVector<ArgRegPair, 1> ArgRegPairs;
518-
/// Callee type ids.
519-
SmallVector<ConstantInt *, 4> CalleeTypeIds;
520518
};
521519

522520
struct CalledGlobalInfo {

llvm/include/llvm/Target/TargetOptions.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,10 @@ class TargetOptions {
133133
EmitStackSizeSection(false), EnableMachineOutliner(false),
134134
EnableMachineFunctionSplitter(false),
135135
EnableStaticDataPartitioning(false), SupportsDefaultOutlining(false),
136-
EmitAddrsig(false), BBAddrMap(false), EmitCallGraphSection(false),
137-
EmitCallSiteInfo(false), SupportsDebugEntryValues(false),
138-
EnableDebugEntryValues(false), ValueTrackingVariableLocations(false),
139-
ForceDwarfFrameSection(false), XRayFunctionIndex(true),
140-
DebugStrictDwarf(false), Hotpatch(false),
136+
EmitAddrsig(false), BBAddrMap(false), EmitCallSiteInfo(false),
137+
SupportsDebugEntryValues(false), EnableDebugEntryValues(false),
138+
ValueTrackingVariableLocations(false), ForceDwarfFrameSection(false),
139+
XRayFunctionIndex(true), DebugStrictDwarf(false), Hotpatch(false),
141140
PPCGenScalarMASSEntries(false), JMCInstrument(false),
142141
EnableCFIFixup(false), MisExpect(false), XCOFFReadOnlyPointers(false),
143142
VerifyArgABICompliance(true),
@@ -320,9 +319,6 @@ class TargetOptions {
320319
/// to selectively generate basic block sections.
321320
std::shared_ptr<MemoryBuffer> BBSectionsFuncListBuf;
322321

323-
/// Emit section containing call graph metadata.
324-
unsigned EmitCallGraphSection : 1;
325-
326322
/// The flag enables call site info production. It is used only for debug
327323
/// info, and it is restricted only to optimized code. This can be used for
328324
/// something else, so that should be controlled in the frontend.

llvm/lib/CodeGen/CommandFlags.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ CGOPT(EABI, EABIVersion)
101101
CGOPT(DebuggerKind, DebuggerTuningOpt)
102102
CGOPT(bool, EnableStackSizeSection)
103103
CGOPT(bool, EnableAddrsig)
104-
CGOPT(bool, EnableCallGraphSection)
105104
CGOPT(bool, EmitCallSiteInfo)
106105
CGOPT(bool, EnableMachineFunctionSplitter)
107106
CGOPT(bool, EnableStaticDataPartitioning)
@@ -462,11 +461,6 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
462461
cl::init(false));
463462
CGBINDOPT(EnableAddrsig);
464463

465-
static cl::opt<bool> EnableCallGraphSection(
466-
"call-graph-section", cl::desc("Emit a call graph section"),
467-
cl::init(false));
468-
CGBINDOPT(EnableCallGraphSection);
469-
470464
static cl::opt<bool> EmitCallSiteInfo(
471465
"emit-call-site-info",
472466
cl::desc(
@@ -601,7 +595,6 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
601595
Options.EnableMachineFunctionSplitter = getEnableMachineFunctionSplitter();
602596
Options.EnableStaticDataPartitioning = getEnableStaticDataPartitioning();
603597
Options.EmitAddrsig = getEnableAddrsig();
604-
Options.EmitCallGraphSection = getEnableCallGraphSection();
605598
Options.EmitCallSiteInfo = getEmitCallSiteInfo();
606599
Options.EnableDebugEntryValues = getEnableDebugEntryValues();
607600
Options.ForceDwarfFrameSection = getForceDwarfFrameSection();

llvm/lib/CodeGen/MIRParser/MIRParser.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -504,21 +504,13 @@ bool MIRParserImpl::initializeCallSiteInfo(
504504
return error(Error, ArgRegPair.Reg.SourceRange);
505505
CSInfo.ArgRegPairs.emplace_back(Reg, ArgRegPair.ArgNo);
506506
}
507-
if (!YamlCSInfo.CalleeTypeIds.empty()) {
508-
for (auto CalleeTypeId : YamlCSInfo.CalleeTypeIds) {
509-
IntegerType *Int64Ty = Type::getInt64Ty(Context);
510-
CSInfo.CalleeTypeIds.push_back(ConstantInt::get(Int64Ty, CalleeTypeId,
511-
/*isSigned=*/false));
512-
}
513-
}
514507

515-
if (TM.Options.EmitCallSiteInfo || TM.Options.EmitCallGraphSection)
508+
if (TM.Options.EmitCallSiteInfo)
516509
MF.addCallSiteInfo(&*CallI, std::move(CSInfo));
517510
}
518511

519-
if (!YamlMF.CallSitesInfo.empty() &&
520-
!(TM.Options.EmitCallSiteInfo || TM.Options.EmitCallGraphSection))
521-
return error("call site info provided but not used");
512+
if (YamlMF.CallSitesInfo.size() && !TM.Options.EmitCallSiteInfo)
513+
return error(Twine("Call site info provided but not used"));
522514
return false;
523515
}
524516

llvm/lib/CodeGen/MIRPrinter.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -525,30 +525,24 @@ static void convertCallSiteObjects(yaml::MachineFunction &YMF,
525525
const MachineFunction &MF,
526526
ModuleSlotTracker &MST) {
527527
const auto *TRI = MF.getSubtarget().getRegisterInfo();
528-
for (auto [MI, CallSiteInfo] : MF.getCallSitesInfo()) {
528+
for (auto CSInfo : MF.getCallSitesInfo()) {
529529
yaml::CallSiteInfo YmlCS;
530530
yaml::MachineInstrLoc CallLocation;
531531

532532
// Prepare instruction position.
533-
MachineBasicBlock::const_instr_iterator CallI = MI->getIterator();
533+
MachineBasicBlock::const_instr_iterator CallI = CSInfo.first->getIterator();
534534
CallLocation.BlockNum = CallI->getParent()->getNumber();
535535
// Get call instruction offset from the beginning of block.
536536
CallLocation.Offset =
537537
std::distance(CallI->getParent()->instr_begin(), CallI);
538538
YmlCS.CallLocation = CallLocation;
539-
540-
auto [ArgRegPairs, CalleeTypeIds] = CallSiteInfo;
541539
// Construct call arguments and theirs forwarding register info.
542-
for (auto ArgReg : ArgRegPairs) {
540+
for (auto ArgReg : CSInfo.second.ArgRegPairs) {
543541
yaml::CallSiteInfo::ArgRegPair YmlArgReg;
544542
YmlArgReg.ArgNo = ArgReg.ArgNo;
545543
printRegMIR(ArgReg.Reg, YmlArgReg.Reg, TRI);
546544
YmlCS.ArgForwardingRegs.emplace_back(YmlArgReg);
547545
}
548-
// Get type ids.
549-
for (auto *CalleeTypeId : CalleeTypeIds) {
550-
YmlCS.CalleeTypeIds.push_back(CalleeTypeId->getZExtValue());
551-
}
552546
YMF.CallSitesInfo.push_back(std::move(YmlCS));
553547
}
554548

llvm/lib/CodeGen/MachineFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ MachineFunction::getCallSiteInfo(const MachineInstr *MI) {
920920
assert(MI->isCandidateForAdditionalCallInfo() &&
921921
"Call site info refers only to call (MI) candidates");
922922

923-
if (!Target.Options.EmitCallSiteInfo && !Target.Options.EmitCallGraphSection)
923+
if (!Target.Options.EmitCallSiteInfo)
924924
return CallSitesInfo.end();
925925
return CallSitesInfo.find(MI);
926926
}

llvm/test/CodeGen/MIR/X86/call-site-info-ambiguous-indirect-call-typeid.mir

Lines changed: 0 additions & 31 deletions
This file was deleted.

llvm/test/CodeGen/MIR/X86/call-site-info-direct-calls-typeid.mir

Lines changed: 0 additions & 54 deletions
This file was deleted.

0 commit comments

Comments
 (0)