Missing TerminatorInst in the trunk no. 350084

I stumbled upon a baffling error while compiling my pass. I was moving my development environment and updated LLVM to the trunk number 350084 in the meantime.

[ 11%] Building CXX object lib/Transforms/TimePred/CMakeFiles/TimePred.dir/Common/Formatter.cpp.o
/home/gwangmu/opt/llvm/lib/Transforms/TimePred/Common/Formatter.cpp:182:24: error: ‘TerminatorInst’ was not declared in this scope
void Formatter::write<TerminatorInst *>(TerminatorInst *obj)
^~~~~~~~~~~~~~
/home/gwangmu/opt/llvm/lib/Transforms/TimePred/Common/Formatter.cpp:182:18: error: parse error in template argument list
void Formatter::write<TerminatorInst *>(TerminatorInst *obj)
^~~~~~~~~~~~~~~~~~~~~~~
/home/gwangmu/opt/llvm/lib/Transforms/TimePred/Common/Formatter.cpp:182:42: error: template-id ‘write< >’ used as a declarator
void Formatter::write<TerminatorInst *>(TerminatorInst *obj)
^~~~~~~~~~~~~~

At first I thought TerminatorInst has been moved to another header, but it seems TerminatorInst has been totally removed at some point. Some of the terminators that I know is now even inheriting the very base class (Instruction) not TerminatorInst.

(In llvm/IR/Instructions.h)
2911 ///
2912 class BranchInst : public Instruction {
2913 /// Ops list - Branches are strange. The operands are ordered:

2829 ///
2830 class ReturnInst : public Instruction {
2831 ReturnInst(const ReturnInst &RI);

Was TerminatorInst actually removed and deprecated? If it’s the case, is there any workaround that I can use when fixing my pass not to use TerminatorInst, hopefully with a minimum amount of change?

Regards,
Gwangmu Lee.

Yes, it has been removed.
See http://lists.llvm.org/pipermail/llvm-dev/2018-May/123407.html

-Krzysztof

Hi,
Maybe you could use Instruction and cast it to the class you want using dyn_cast? I don’t know if it is the best approach anyway.

HTH