Repository navigation
Constant pool should share values #35268
Copy link
Copy link
Closed
Labels
JitUntriagedCLR JIT issues needing additional triageCLR JIT issues needing additional triagearch-x64area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIoptimization
Milestone
Description
Activity
- addedarea-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
on Apr 22, 2020 - addeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Apr 22, 2020 - removeduntriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
on Apr 24, 2020 - addedJitUntriagedCLR JIT issues needing additional triageCLR JIT issues needing additional triage
on Oct 28, 2020 I think this issue may have been resolved. On my machine, the sample above generates the following code:
; Assembly listing for method Program:Process(double):double ; Emitting BLENDED_CODE for X64 CPU with AVX - Windows ; optimized code ; rsp based frame ; fully interruptible ; No PGO data ; Final local variable assignments ; ; V00 arg0 [V00,T00] ( 13, 43 ) double -> mm0 ; V01 loc0 [V01,T01] ( 4, 10 ) double -> mm1 ;# V02 OutArgs [V02 ] ( 1, 1 ) lclBlk ( 0) [rsp+00H] "OutgoingArgSpace" ; V03 cse0 [V03,T02] ( 3, 9 ) double -> mm2 "CSE - aggressive" ; ; Lcl frame size = 0 G_M22436_IG01: ;; offset=0000H C5F877 vzeroupper ;; bbWeight=1 PerfScore 1.00 G_M22436_IG02: ;; offset=0003H C5FB100D4D000000 vmovsd xmm1, qword ptr [reloc @RWD00] C5E857D2 vxorps xmm2, xmm2 C5F92EC2 vucomisd xmm0, xmm2 7636 jbe SHORT G_M22436_IG04 C5FB101543000000 vmovsd xmm2, qword ptr [reloc @RWD08] align [0 bytes] ;; bbWeight=1 PerfScore 9.33 G_M22436_IG03: ;; offset=001DH C5F359C8 vmulsd xmm1, xmm1, xmm0 C5FB5C052F000000 vsubsd xmm0, xmm0, qword ptr [reloc @RWD00] C5FB5CC2 vsubsd xmm0, xmm0, xmm2 C5FB5C0523000000 vsubsd xmm0, xmm0, qword ptr [reloc @RWD00] C5FB5CC2 vsubsd xmm0, xmm0, xmm2 C5E057DB vxorps xmm3, xmm3 C5F92EC3 vucomisd xmm0, xmm3 77DA ja SHORT G_M22436_IG03 ;; bbWeight=4 PerfScore 89.33 G_M22436_IG04: ;; offset=0043H C5F828C1 vmovaps xmm0, xmm1 ;; bbWeight=1 PerfScore 0.25 G_M22436_IG05: ;; offset=0047H C3 ret ;; bbWeight=1 PerfScore 1.00 RWD00 dq 3FF0000000000000h ; 1 RWD08 dq 4000000000000000h ; 2
Looks like only two constants are created in the constant pool now. Perhaps this was solved with: #44419
Thanks for checking. I'll go ahead and close this issue.
- ghost locked as resolved and limited conversation to collaborators
on Dec 2, 2021
Metadata
Metadata
Assignees
Labels
JitUntriagedCLR JIT issues needing additional triageCLR JIT issues needing additional triagearch-x64area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIoptimization
Doubles added to constant pool are not shared: the same constant appearing multiple times appears multiple times in the constant pool.
Using the example from #35257:
The generated x64 assembly is:
In this case, RWD00, RWD08, and RWD24 are identical, and RWD16 and RWD32 are identical.
The constant pool is (conceptually) read-only (I believe), so we only need one of each unique value in the table.
category:cq
theme:constant-pool
skill-level:intermediate
cost:medium