@@ -102,6 +102,50 @@ bool ARMTTIImpl::areInlineCompatible(const Function *Caller,
102102 // the callers'.
103103 bool MatchSubset = ((CallerBits & CalleeBits) & InlineFeaturesAllowed) ==
104104 (CalleeBits & InlineFeaturesAllowed);
105+
106+ LLVM_DEBUG ({
107+ dbgs () << " === Inline compatibility debug ===\n " ;
108+ dbgs () << " Caller: " << Caller->getName () << " \n " ;
109+ dbgs () << " Callee: " << Callee->getName () << " \n " ;
110+
111+ // Bit diffs
112+ FeatureBitset MissingInCaller = CalleeBits & ~CallerBits; // callee-only
113+ FeatureBitset ExtraInCaller = CallerBits & ~CalleeBits; // caller-only
114+
115+ // Counts
116+ dbgs () << " Only-in-caller bit count: " << ExtraInCaller.count () << " \n " ;
117+ dbgs () << " Only-in-callee bit count: " << MissingInCaller.count () << " \n " ;
118+
119+ dbgs () << " Only-in-caller feature indices [" ;
120+ {
121+ bool First = true ;
122+ for (size_t I = 0 , E = ExtraInCaller.size (); I < E; ++I) {
123+ if (ExtraInCaller.test (I)) {
124+ if (!First) dbgs () << " , " ;
125+ dbgs () << I;
126+ First = false ;
127+ }
128+ }
129+ }
130+ dbgs () << " ]\n " ;
131+
132+ dbgs () << " Only-in-callee feature indices [" ;
133+ {
134+ bool First = true ;
135+ for (size_t I = 0 , E = MissingInCaller.size (); I < E; ++I) {
136+ if (MissingInCaller.test (I)) {
137+ if (!First) dbgs () << " , " ;
138+ dbgs () << I;
139+ First = false ;
140+ }
141+ }
142+ }
143+ dbgs () << " ]\n " ;
144+
145+ // Indicies map to features as found in llvm-project/(your_build)/lib/Target/ARM/ARMGenSubtargetInfo.inc
146+ dbgs () << " MatchExact=" << (MatchExact ? " true" : " false" )
147+ << " MatchSubset=" << (MatchSubset ? " true" : " false" ) << " \n " ;
148+ });
105149 return MatchExact && MatchSubset;
106150}
107151
0 commit comments