MSVC compile error with trunk

Does not seem to be a straight error with LLVM itself, but rather the
tools, linking issues, here are the errors:

Opt:
30> Creating library
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\opt.lib and object
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\opt.exp
30>LLVMScalarOpts.lib(IndVarSimplify.obj) : error LNK2019: unresolved
external symbol "public: bool __thiscall
llvm::IVUsers::AddUsersIfInteresting(class llvm::Instruction *)"
(?AddUsersIfInteresting@IVUsers@llvm@@QAE_NPAVInstruction@2@@Z)
referenced in function "public: virtual bool __thiscall `anonymous
namespace'::IndVarSimplify::runOnLoop(class llvm::LoopBase<class
llvm::BasicBlock> *,class llvm::LPPassManager &)"
(?runOnLoop@IndVarSimplify@?A0xe882fe7a@@UAE_NPAV?$LoopBase@VBasicBlock@llvm@@@llvm@@AAVLPPassManager@4@@Z)
30>LLVMScalarOpts.lib(IndVarSimplify.obj) : error LNK2019: unresolved
external symbol "public: class llvm::SCEVHandle __thiscall
llvm::IVUsers::getReplacementExpr(class llvm::IVStrideUse const
&)const " (?getReplacementExpr@IVUsers@llvm@@QBE?AVSCEVHandle@2@ABVIVStrideUse@2@@Z)
referenced in function "private: void __thiscall `anonymous
namespace'::IndVarSimplify::RewriteIVExpressions(class
llvm::LoopBase<class llvm::BasicBlock> *,class llvm::Type const
*,struct llvm::SCEVExpander &)"
(?RewriteIVExpressions@IndVarSimplify@?A0xe882fe7a@@AAEXPAV?$LoopBase@VBasicBlock@llvm@@@llvm@@PBVType@4@AAUSCEVExpander@4@@Z)
30>LLVMScalarOpts.lib(IndVarSimplify.obj) : error LNK2001: unresolved
external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
30>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
30>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "private: virtual void __thiscall
llvm::IVStrideUse::deleted(void)" (?deleted@IVStrideUse@llvm@@EAEXXZ)
30>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\opt.exe : fatal error
LNK1120: 4 unresolved externals

llc:
33> Creating library
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\llc.lib and object
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\llc.exp
33>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "private: virtual void __thiscall
llvm::IVStrideUse::deleted(void)" (?deleted@IVStrideUse@llvm@@EAEXXZ)
33>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
33>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\llc.exe : fatal error
LNK1120: 2 unresolved externals

lli:
40> Creating library
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\lli.lib and object
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\lli.exp
40>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "private: virtual void __thiscall
llvm::IVStrideUse::deleted(void)" (?deleted@IVStrideUse@llvm@@EAEXXZ)
40>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
40>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\lli.exe : fatal error
LNK1120: 2 unresolved externals

BrainF:
46> Creating library
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\BrainF.lib and object
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\BrainF.exp
46>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "private: virtual void __thiscall
llvm::IVStrideUse::deleted(void)" (?deleted@IVStrideUse@llvm@@EAEXXZ)
46>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
46>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\BrainF.exe : fatal error
LNK1120: 2 unresolved externals

bugpoint:
43> Creating library
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\bugpoint.lib and object
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\bugpoint.exp
43>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "private: virtual void __thiscall
llvm::IVStrideUse::deleted(void)" (?deleted@IVStrideUse@llvm@@EAEXXZ)
43>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
43>LLVMScalarOpts.lib(IndVarSimplify.obj) : error LNK2001: unresolved
external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
43>LLVMScalarOpts.lib(IndVarSimplify.obj) : error LNK2019: unresolved
external symbol "public: bool __thiscall
llvm::IVUsers::AddUsersIfInteresting(class llvm::Instruction *)"
(?AddUsersIfInteresting@IVUsers@llvm@@QAE_NPAVInstruction@2@@Z)
referenced in function "public: virtual bool __thiscall `anonymous
namespace'::IndVarSimplify::runOnLoop(class llvm::LoopBase<class
llvm::BasicBlock> *,class llvm::LPPassManager &)"
(?runOnLoop@IndVarSimplify@?A0xe882fe7a@@UAE_NPAV?$LoopBase@VBasicBlock@llvm@@@llvm@@AAVLPPassManager@4@@Z)
43>LLVMScalarOpts.lib(IndVarSimplify.obj) : error LNK2019: unresolved
external symbol "public: class llvm::SCEVHandle __thiscall
llvm::IVUsers::getReplacementExpr(class llvm::IVStrideUse const
&)const " (?getReplacementExpr@IVUsers@llvm@@QBE?AVSCEVHandle@2@ABVIVStrideUse@2@@Z)
referenced in function "private: void __thiscall `anonymous
namespace'::IndVarSimplify::RewriteIVExpressions(class
llvm::LoopBase<class llvm::BasicBlock> *,class llvm::Type const
*,struct llvm::SCEVExpander &)"
(?RewriteIVExpressions@IndVarSimplify@?A0xe882fe7a@@AAEXPAV?$LoopBase@VBasicBlock@llvm@@@llvm@@PBVType@4@AAUSCEVExpander@4@@Z)
43>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\bugpoint.exe : fatal
error LNK1120: 4 unresolved externals

Fibonacci:
48>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "private: virtual void __thiscall
llvm::IVStrideUse::deleted(void)" (?deleted@IVStrideUse@llvm@@EAEXXZ)
48>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
48>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\Fibonacci.exe : fatal
error LNK1120: 2 unresolved externals

HowToUseJIT:
49> Creating library
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\HowToUseJIT.lib and object
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\HowToUseJIT.exp
49>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "private: virtual void __thiscall
llvm::IVStrideUse::deleted(void)" (?deleted@IVStrideUse@llvm@@EAEXXZ)
49>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
49>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\HowToUseJIT.exe : fatal
error LNK1120: 2 unresolved externals

Kaleidoscope:
50> Creating library
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\Kaleidoscope.lib and object
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\Kaleidoscope.exp
50>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "private: virtual void __thiscall
llvm::IVStrideUse::deleted(void)" (?deleted@IVStrideUse@llvm@@EAEXXZ)
50>LLVMScalarOpts.lib(LoopStrengthReduce.obj) : error LNK2001:
unresolved external symbol "public: static char llvm::IVUsers::ID"
(?ID@IVUsers@llvm@@2DA)
50>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\Kaleidoscope.exe : fatal
error LNK1120: 2 unresolved externals

Yes, I know they are mostly duplicated linking errors, but this also
shows all the apps that fail as well, since not all fail.
This was with MSVC2k5 in debug build, happens in all build types though.

Please prepare a patch, thanks!

-Chris

Confirmed, once IVUsers.cpp is added to the LLVMAnalysis library,
fixed some of those errors, but there are more still. Patch is
attached for the IVUsers.cpp add to the CMakeLists.txt file.

32> Creating library
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\llc.lib and object
R:\SDKs\llvm\trunk_VC8_building\lib\Debug\llc.exp
32>LLVMCodeGen.lib(PrologEpilogInserter.obj) : error LNK2001:
unresolved external symbol "public: virtual void __thiscall
llvm::PEI::getAnalysisUsage(class llvm::AnalysisUsage &)const "
(?getAnalysisUsage@PEI@llvm@@UBEXAAVAnalysisUsage@2@@Z)
32>LLVMCodeGen.lib(PrologEpilogInserter.obj) : error LNK2019:
unresolved external symbol "private: void __thiscall
llvm::PEI::clearAllSets(void)" (?clearAllSets@PEI@llvm@@AAEXXZ)
referenced in function "public: virtual bool __thiscall
llvm::PEI::runOnMachineFunction(class llvm::MachineFunction &)"
(?runOnMachineFunction@PEI@llvm@@UAE_NAAVMachineFunction@2@@Z)
32>LLVMCodeGen.lib(PrologEpilogInserter.obj) : error LNK2019:
unresolved external symbol "private: void __thiscall
llvm::PEI::placeCSRSpillsAndRestores(class llvm::MachineFunction &)"
(?placeCSRSpillsAndRestores@PEI@llvm@@AAEXAAVMachineFunction@2@@Z)
referenced in function "public: virtual bool __thiscall
llvm::PEI::runOnMachineFunction(class llvm::MachineFunction &)"
(?runOnMachineFunction@PEI@llvm@@UAE_NAAVMachineFunction@2@@Z)
32>R:\SDKs\llvm\trunk_VC8_building\bin\Debug\llc.exe : fatal error
LNK1120: 3 unresolved externals

Do note, this linking error appears a few times, but they are all
identical to this one, looks like the last.

IVUsers_cpp_to_CMakeLists.patch (364 Bytes)

Yep, missing ShrinkWrapping.cpp in the lib\CodeGen\CMakeLists.txt
file. Have not tested (out of time, need to stop this), but I am
rather certain that it is just that problem now.