ghc passes -tbaa to opt, even when the user overrides opt's args
The ghc flag --llvm-tbaa
(Opt_LlvmTBAA
) controls whether "-tbaa" is passed to opt. However this is an opt "pass flag" and should be omitted like other pass flags when the user passes -optlo
, ref runLlvmOptPhase, comment:
-- don't specify anything if user has specified commands. We do this
-- for opt but not llc since opt is very specifically for optimisation
-- passes only, so if the user is passing us extra options we assume
-- they know what they are doing and don't get in the way.
This causes a problem in #21936 (closed) where we must pass -fno-llvm-tbaa
to prevent ghc from passing invalid options to opt.