Consider a probability distribution $\pi$ with density $e^{-H(x)}$ on $\mathbb{R}$. Let us say that there is a Poincaré inequality with weight $w$ if for any smooth function $\phi$ satisfying $\int \phi(x) \pi(dx) = 0$ the following inequality holds, $$\int \phi'(x)^2 w^2(x) \pi(dx) \geq \int \phi(x)^2 \pi(dx).$$
Question: given a positive function $h:\mathbb{R} \to (0;+\infty)$, can one compute the optimal weight function $w$ in the sense that $w$ minimizes $\int w^2(x) h^2(x) \pi(dx)$.
Example: if $\pi$ is a Gaussian measure ($i.e$ with $H(x) = \frac{1}{2} x^2$) and $h(x)=1$, playing around with Hermite polynomials, it does not seem very hard to check that $w(x)=\text{Cst}$ is optimal.
In the more general case, it seems like the optimal weight $w_0$ and associated test function $\phi_0$ defined by $\int \phi_0'(x)^2 w_0^2(x) \pi(dx) = \int \phi_0(x)^2 \pi(dx)$ must satisfy $\phi_0'(x)^2 = \lambda h^2(x)$ and $h$ is an eigenfunction of a certain differential operator involving $w_0$. I have not been able to explicitly find $w_0$ by continuing in this direction.
Motivations: given a metric on $\mathbb{R}$ ($i.e$ function $w^2$), one can consider the associated Langevin diffusion that has $\pi$ as invariant distribution. Among all the metric that satisfy certain conditions, which one maximizes the speed of convergence ($i.e$ spectral gap) of the Langevin diffusion towards $\pi$.