Duplicate TM->addAnalysisPasses() calls in AddEmitPasses()

Hi,

In clang/lib/CodeGen/BackendUtil.cpp, EmitAssemblyHelper::AddEmitPasses() calls TM->addAnalysisPasses(*PM) in line 502 and later calls TM->addPassesToEmitFile() in line 521.

In LLVMTargetMachine.cpp:138, TM->addPassesToEmitFile() calls (local, line 84) addPassesToGenerateCode() which also calls TM->addAnalysisPasses() in line 91.

So we end with two calls to addAnalysisPasses().

Is there a purpose to the duplicate call or just a bug?

Yaron