Question about built code size

I would guess that your 3.7.1 build is a release build and your 4.0.1 build is a debug build. Possibly related to https://reviews.llvm.org/rL285789 although I haven't verified this.

You could explicitly pass -DCMAKE_BUILD_TYPE=RelWithDebInfo or -DCMAKE_BUILD_TYPE=Release to your cmake invocation.

Hope this helps,
Ismail