Skip to content

Commit a1834c9

Browse files
committed
[𝘀𝗽𝗿] changes introduced through rebase
Created using spr 1.3.6-beta.1 [skip ci]
1 parent d072c83 commit a1834c9

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

llvm/lib/CodeGen/MIRPrinter.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,20 +558,19 @@ void MIRPrinter::convertCallSiteObjects(yaml::MachineFunction &YMF,
558558
const MachineFunction &MF,
559559
ModuleSlotTracker &MST) {
560560
const auto *TRI = MF.getSubtarget().getRegisterInfo();
561-
for (auto CSInfoMap : MF.getCallSitesInfo()) {
561+
for (auto [MI, CallSiteInfo] : MF.getCallSitesInfo()) {
562562
yaml::CallSiteInfo YmlCS;
563563
yaml::MachineInstrLoc CallLocation;
564564

565565
// Prepare instruction position.
566-
MachineBasicBlock::const_instr_iterator CallI =
567-
CSInfoMap.first->getIterator();
566+
MachineBasicBlock::const_instr_iterator CallI = MI->getIterator();
568567
CallLocation.BlockNum = CallI->getParent()->getNumber();
569568
// Get call instruction offset from the beginning of block.
570569
CallLocation.Offset =
571570
std::distance(CallI->getParent()->instr_begin(), CallI);
572571
YmlCS.CallLocation = CallLocation;
573572

574-
auto [ArgRegPairs, CalleeTypeIds] = CSInfoMap.second;
573+
auto [ArgRegPairs, CalleeTypeIds] = CallSiteInfo;
575574
// Construct call arguments and theirs forwarding register info.
576575
for (auto ArgReg : ArgRegPairs) {
577576
yaml::CallSiteInfo::ArgRegPair YmlArgReg;

llvm/lib/IR/Verifier.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5059,9 +5059,12 @@ void Verifier::visitCalleeTypeMetadata(Instruction &I, MDNode *MD) {
50595059
"!callee_type metadata should only exist on indirect function calls",
50605060
&I);
50615061
for (const auto &Op : MD->operands()) {
5062+
Check(isa<MDNode>(Op.get()),
5063+
"The callee_type metadata must be a list of type metadata nodes");
50625064
auto *TypeMD = cast<MDNode>(Op.get());
50635065
Check(TypeMD->hasGeneralizedMDString(),
5064-
"Invalid \"callee_type\" type identifier", &I);
5066+
"Only generalized type metadata can be part of the callee_type "
5067+
"metadata list");
50655068
}
50665069
}
50675070

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
;; Test if the callee_type metadata attached to indirect call sites adhere to the expected format.
2+
3+
; RUN: not opt -passes=verify < %s 2>&1 | FileCheck %s
4+
define i32 @_Z13call_indirectPFicEc(ptr %func, i8 signext %x) !type !0 {
5+
entry:
6+
%func.addr = alloca ptr, align 8
7+
%x.addr = alloca i8, align 1
8+
store ptr %func, ptr %func.addr, align 8
9+
store i8 %x, ptr %x.addr, align 1
10+
%fptr = load ptr, ptr %func.addr, align 8
11+
%fptr_val = load i8, ptr %x.addr, align 1
12+
;; No failures expected for this callee_type metdata.
13+
%call = call i32 %fptr(i8 signext %fptr_val), !callee_type !1
14+
;; callee_type metdata is a type metadata instead of a list of type metadata nodes.
15+
; CHECK: The callee_type metadata must be a list of type metadata nodes
16+
%call2 = call i32 %fptr(i8 signext %fptr_val), !callee_type !0
17+
;; callee_type metdata is a list of non "gneralized" type metadata.
18+
; CHECK: Only generalized type metadata can be part of the callee_type metadata list
19+
%call3 = call i32 %fptr(i8 signext %fptr_val), !callee_type !4
20+
ret i32 %call
21+
}
22+
23+
!0 = !{i64 0, !"_ZTSFiPvcE.generalized"}
24+
!1 = !{!2}
25+
!2 = !{i64 0, !"_ZTSFicE.generalized"}
26+
!3 = !{i64 0, !"_ZTSFicE"}
27+
!4 = !{!3}
28+
; CHECK-NEXT: error: input module is broken!

0 commit comments

Comments
 (0)