Skip to content

Commit 6d67f0b

Browse files
Merge pull request #11255 from rastogishubham/FixReg
Return nullopt if Reg is undef.
2 parents 19df051 + 4020b50 commit 6d67f0b

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10139,6 +10139,9 @@ describeORRLoadedValue(const MachineInstr &MI, Register DescribedReg,
1013910139
Register DestReg = DestSrc->Destination->getReg();
1014010140
Register SrcReg = DestSrc->Source->getReg();
1014110141

10142+
if (!DestReg.isValid() || !SrcReg.isValid())
10143+
return std::nullopt;
10144+
1014210145
auto Expr = DIExpression::get(MI.getMF()->getFunction().getContext(), {});
1014310146

1014410147
// If the described register is the destination, just return the source.
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This test should not crash when generating call-site information.
2+
# It was created to make sure that if isCopyLikeInstr in TargetInstrInfo.h
3+
# returns an undef Dest Reg or Src Reg, we don't try to get a SubReg for it.
4+
5+
# RUN: llc -start-before=aarch64-asm-printer %s -filetype=obj -o /dev/null --emit-call-site-info | FileCheck %s
6+
7+
--- |
8+
define noundef i32 @wladihawlihalhlad(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 !dbg !23 {
9+
ret i32 0
10+
}
11+
define void @__fooo(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2) local_unnamed_addr #0 !dbg !53 {
12+
ret void
13+
}
14+
!llvm.module.flags = !{!2, !8}
15+
!llvm.dbg.cu = !{!9}
16+
!2 = !{i32 2,!"Debug Info Version",i32 3}
17+
!8 = !{i32 7,!"frame-pointer",i32 1}
18+
!9 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_11,file: !10,emissionKind: FullDebug,sysroot: "/")
19+
!10 = !DIFile(filename: "afhjacs.cpp",directory: "wkudawkudbakwdbku")
20+
!23 = distinct !DISubprogram( type: !27,flags: DIFlagPrototyped | DIFlagAllCallsDescribed,unit: !9,retainedNodes: !46)
21+
!27 = !DISubroutineType(types: !28)
22+
!28 = !{}
23+
!30 = !DIDerivedType(tag: DW_TAG_pointer_type,baseType: !33)
24+
!33 = distinct !DICompositeType(tag: DW_TAG_structure_type,identifier: "laihfaelhaleheaf")
25+
!35 = !DISubprogram( spFlags: DISPFlagOptimized)
26+
!46 = !{ }
27+
!47 = !DILocalVariable( arg: 1,scope: !23,flags: DIFlagArtificial | DIFlagObjectPointer)
28+
!49 = !DILocalVariable( scope: !23,type: !30)
29+
!50 = !DILocation( scope: !23)
30+
!51 = !DILocation( scope: !23)
31+
!53 = distinct !DISubprogram( unit: !9,declaration: !35)
32+
name: wladihawlihalhlad
33+
stack:
34+
- { id: 0, name: '', type: spill-slot, offset: -8, size: 8, alignment: 8,
35+
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
36+
- { id: 1, name: '', type: spill-slot, offset: -16, size: 8, alignment: 8,
37+
debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }
38+
callSites:
39+
- { bb: 0, offset: 9, fwdArgRegs:
40+
- { arg: 2, reg: '$w2' } }
41+
body: |
42+
bb.0 (%ir-block.2):
43+
DBG_VALUE $x0, $noreg, !47, !DIExpression(), debug-location !50
44+
DBG_VALUE $x1, $noreg, !49, !DIExpression(), debug-location !50
45+
frame-setup PACIBSP implicit-def $lr, implicit killed $lr, implicit $sp
46+
early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -2 :: (store (s64) into %stack.1), (store (s64) into %stack.0)
47+
$fp = frame-setup ADDXri $sp, 0, 0
48+
frame-setup CFI_INSTRUCTION def_cfa $w29, 16
49+
frame-setup CFI_INSTRUCTION offset $w30, -8
50+
frame-setup CFI_INSTRUCTION offset $w29, -16
51+
$x2 = ORRXrs $xzr, undef $noreg, 0, implicit $wzr, debug-location !51
52+
BL @__fooo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit killed $x1, implicit killed $w2, implicit-def $sp, debug-location !51

0 commit comments

Comments
 (0)