[llvm] r308500 - ThinLTOBitcodeWriter: Do not rewrite intrinsic functions when splitting modules.
Peter Collingbourne via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 19 10:54:29 PDT 2017
Author: pcc
Date: Wed Jul 19 10:54:29 2017
New Revision: 308500
URL: http://llvm.org/viewvc/llvm-project?rev=308500&view=rev
Log:
ThinLTOBitcodeWriter: Do not rewrite intrinsic functions when splitting modules.
Changing the type of an intrinsic may invalidate the IR.
Differential Revision: https://reviews.llvm.org/D35593
Modified:
llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll
Modified: llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp?rev=308500&r1=308499&r2=308500&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp Wed Jul 19 10:54:29 2017
@@ -141,7 +141,9 @@ void simplifyExternals(Module &M) {
continue;
}
- if (!F.isDeclaration() || F.getFunctionType() == EmptyFT)
+ if (!F.isDeclaration() || F.getFunctionType() == EmptyFT ||
+ // Changing the type of an intrinsic may invalidate the IR.
+ F.getName().startswith("llvm."))
continue;
Function *NewF =
Modified: llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll?rev=308500&r1=308499&r2=308500&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll (original)
+++ llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll Wed Jul 19 10:54:29 2017
@@ -25,9 +25,13 @@ define i64 @ok1(i8* %this) {
; 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*) {
More information about the llvm-commits
mailing list