Index: llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp =================================================================== --- llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp +++ llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp @@ -141,7 +141,8 @@ continue; } - if (!F.isDeclaration() || F.getFunctionType() == EmptyFT) + if (!F.isDeclaration() || F.getFunctionType() == EmptyFT || + F.getName().startswith("llvm.")) continue; Function *NewF = Index: llvm/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll =================================================================== --- llvm/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll +++ llvm/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll @@ -25,9 +25,13 @@ ; M0: define i64 @ok2 ; M1: define available_externally i64 @ok2 define i64 @ok2(i8* %this, i64 %arg) { + %1 = tail call { i64, i1 } @llvm.sadd.with.overflow.i64(i64 %arg, i64 %arg) ret i64 %arg } +; M1: declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64) +declare { i64, i1 } @llvm.sadd.with.overflow.i64(i64, i64) + ; M0: define void @wrongtype1 ; M1: declare void @wrongtype1() define void @wrongtype1(i8*) {