Index: lib/Transforms/Utils/LibCallsShrinkWrap.cpp =================================================================== --- lib/Transforms/Utils/LibCallsShrinkWrap.cpp +++ lib/Transforms/Utils/LibCallsShrinkWrap.cpp @@ -29,6 +29,7 @@ #include "llvm/Transforms/Utils/LibCallsShrinkWrap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" +#include "llvm/Analysis/GlobalsModRef.h" #include "llvm/Analysis/TargetLibraryInfo.h" #include "llvm/IR/CFG.h" #include "llvm/IR/Constants.h" @@ -529,7 +530,7 @@ } void LibCallsShrinkWrapLegacyPass::getAnalysisUsage(AnalysisUsage &AU) const { - AU.setPreservesCFG(); + AU.addPreserved(); AU.addRequired(); } @@ -561,6 +562,8 @@ bool Changed = runImpl(F, TLI); if (!Changed) return PreservedAnalyses::all(); - return PreservedAnalyses::none(); + auto PA = PreservedAnalyses(); + PA.preserve(); + return PA; } } Index: test/Transforms/InstCombine/shrinkwrap-nopreserve.ll =================================================================== --- /dev/null +++ test/Transforms/InstCombine/shrinkwrap-nopreserve.ll @@ -0,0 +1,8 @@ +; RUN: opt -instcombine -libcalls-shrinkwrap -gvn + +define void @main() { + %_tmp31 = call float @acosf(float 2.000000e+00) + ret void +} + +declare float @acosf(float)