[PATCH] D115699: [llvm-profgen] Skip disassembling for PLT section

Lei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 14 12:59:11 PST 2021


wlei added inline comments.


================
Comment at: llvm/test/tools/llvm-profgen/inline-noprobe2.test:76
 ;CHECK:   3: 5
-;CHECK: main:820:0
+quick_sort:903:25
+ 1: 24
----------------
hoy wrote:
> wlei wrote:
> > wlei wrote:
> > > hoy wrote:
> > > > wenlei wrote:
> > > > > wlei wrote:
> > > > > > wenlei wrote:
> > > > > > > are these test changes expected?
> > > > > > Oh, sorry, it's the same to https://reviews.llvm.org/D115538, previously I removed by mistake. Let me removed this here.
> > > > > If you put them in a stack, these earlier/unrelated changes won't show up. 
> > > > > 
> > > > > But still.. why are the remaining test changes, are they all due to PLT?
> > > > Good question. Do the counters changed refer to PLT calls?
> > > This patch is in the bottom of the patch stack. It appeared that those counter changes are all fixed by the following two patches. I guess it's due to the wrong leading external addr processing. let me confirm what's wrong.
> > OK, it turned out that the PLT address is just the leading LBR's target, remembering before the two external fix, the whole samples will be ignored. 
> > 
> > ```
> > 0x400540 is plt
> > 400870 0x400870/0x400540/P/-/-/1  0x4008bf/0x400870/P/-/-/7  0x7f7448e88cc1/0x400875/P/-/-/1  
> > ```
> > 
> > 
> > 
> I see. So the counters 5.1, 5.3 ... correspond to a call to the PLT entries right?
Nearby the call to PLT, the code after return from PLT.

range [0x400875, 0x4008bf]

```
  400870:	e8 cb fc ff ff       	callq  400540 <rand at plt>
  400875:	48 98                	cltq   
  400877:	48 69 c8 1f 85 eb 51 	imul   $0x51eb851f,%rax,%rcx
  40087e:	48 89 ca             	mov    %rcx,%rdx
  400881:	48 c1 ea 3f          	shr    $0x3f,%rdx
  400885:	48 c1 f9 26          	sar    $0x26,%rcx
  400889:	01 d1                	add    %edx,%ecx
  40088b:	69 c9 c8 00 00 00    	imul   $0xc8,%ecx,%ecx
  400891:	29 c8                	sub    %ecx,%eax
  400893:	89 04 ab             	mov    %eax,(%rbx,%rbp,4)
  400896:	48 83 c5 01          	add    $0x1,%rbp
  40089a:	48 81 fd c8 00 00 00 	cmp    $0xc8,%rbp
  4008a1:	0f 84 69 ff ff ff    	je     400810 <main+0x30>
  4008a7:	40 0f b6 c5          	movzbl %bpl,%eax
  4008ab:	69 c0 cd 00 00 00    	imul   $0xcd,%eax,%eax
  4008b1:	c1 e8 0a             	shr    $0xa,%eax
  4008b4:	83 e0 fe             	and    $0xfffffffe,%eax
  4008b7:	8d 04 80             	lea    (%rax,%rax,4),%eax
  4008ba:	f7 d8                	neg    %eax
  4008bc:	40 00 e8             	add    %bpl,%al
  4008bf:	75 af                	jne    400870 <main+0x90>
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115699/new/

https://reviews.llvm.org/D115699



More information about the llvm-commits mailing list