Index: llvm/lib/Transforms/IPO/FunctionSpecialization.cpp =================================================================== --- llvm/lib/Transforms/IPO/FunctionSpecialization.cpp +++ llvm/lib/Transforms/IPO/FunctionSpecialization.cpp @@ -55,6 +55,7 @@ #include "llvm/IR/IntrinsicInst.h" #include "llvm/Transforms/Scalar/SCCP.h" #include "llvm/Transforms/Utils/Cloning.h" +#include "llvm/Transforms/Utils/Local.h" #include "llvm/Transforms/Utils/SCCPSolver.h" #include "llvm/Transforms/Utils/SizeOpts.h" #include @@ -376,7 +377,7 @@ // Remove the instruction from Block and Solver. if (auto *I = dyn_cast(V)) { - if (I->isSafeToRemove()) { + if (wouldInstructionBeTriviallyDead(I)) { ReplacedWithConstant.push_back(I); Solver.removeLatticeValueFor(I); }