Unless '--enable-gcc-opt' is passed, configure removes '-O2' from CFLAGS. At this time, passing it seems to do nothing (going by configure.ac).
commit ac1b6b8c9c3baca87e8f568b6d2e68c9c87ecbcd Author: David Seifert <soap@gentoo.org> Date: Mon Jun 5 18:31:26 2017 +0200 media-libs/libsndfile: Revbump to honour user CFLAGS Bug: https://bugs.gentoo.org/show_bug.cgi?id=620782