On Wed, Oct 4, 2023 at 3:46 PM Varghese, Vipin <vipin.vargh...@amd.com> wrote: > > [AMD Official Use Only - General] > > Hi Jerrin, > > Apologies for the delay, I missed on the comment > > ``` > > for (i = 0; i < nr_buf; i++) { > > + void *src = rte_pktmbuf_mtod(dsts[i], void *); > > + void *dst = rte_pktmbuf_mtod(srcs[i], void *); > > Use _const_ in fast path if src and dst in not changing as better > optimization hint to compiler. > ``` > > Thanks for the suggestion, but may I ask this differently `rte_memcpy` is > defined with `always_inline` and all places where src used is with `const *`. > Hence I have different view there as `setting const * for always_inline > definition has the same effect too`.
Yeah, most likely. However, Is the above behavior is documented in gcc/clang? if not, the compiler is free to change as it deemed to fit based on the register allocation and optimization flags etc.