I found an answer that shows how to detect the phase in cases like $0$, $\pi/8$, $\pi/2$, $\pi/4$ or $\pi$ for circuit to prepare state as H P, where P is a phase gate like $I$, $U1(\pi/8)$, $S$, $T$ or $Z$.
But in my case the circuit to prepare state is $X H P$, where $P$ is $X$ gate (conditionally phase $\pi$) or $ID$ (conditionally phase 0).
This circuit in Qasm with conditionally phase equal to $\pi$:
x q; h q; x q;
with conditionally phase equal to $0$:
x q; h q; id q;
Appending $H$ gate (as in the above answer) don't detect a difference for conditionally phase $\pi$ and phase $0$ (but does detect for phases $\pi/2$, $\pi/4$, $\pi/8$ if $P$ is $S$, $T$, $U1(\pi/8)$, respectively).
Is it possible to detect the conditionally phase $P$ $\pi$ or 0 for this circuit to prepare state?