  We investigate the role of a local $U(1)'$ symmetry for the problem of CP
violation in the effective theory for two Higgs doublet models and its
microscopic counterparts. First, in two Higgs doublet models with $U(1)'$, we
show that the higher-dimensional operators in the scalar potential violate the
CP symmetry with an interplay with the mixing mass parameter, giving rise to
small mixings between CP-even and CP-odd scalars. Motivated by the $B$-meson
anomalies in recent years, we take the flavored $U(1)'$ to be a benchmark model
for specifying the flavor structure. Then, we calculate the electric dipole
moment of electron (eEDM) at two loops due to the CP-violating
higher-dimensional operators and identify the correlation between the masses of
heavy Higgs bosons and the cutoff scale from the bound on eEDM. We also comment
on the possibility of making an independent test of the CP violation in the
collider searches for heavy Higgs bosons. Finally, we show how the obtained
eEDM results in the effective theory can be used to constrain microscopic
models with an explicit CP violation in the partially decoupled or dark
sectors.
