[PATCH] D35593: ThinLTOBitcodeWriter: Do not rewrite intrinsic functions when splitting modules.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 19 10:55:00 PDT 2017


This revision was automatically updated to reflect the committed changes.
pcc marked an inline comment as done.
Closed by commit rL308500: ThinLTOBitcodeWriter: Do not rewrite intrinsic functions when splitting modules. (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D35593?vs=107213&id=107345#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35593

Files:
  llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
  llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll


Index: llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll
===================================================================
--- llvm/trunk/test/Transforms/ThinLTOBitcodeWriter/split-vfunc.ll
+++ llvm/trunk/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*) {
Index: llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
+++ llvm/trunk/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
@@ -141,7 +141,9 @@
       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 =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35593.107345.patch
Type: text/x-patch
Size: 1297 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170719/3b360828/attachment.bin>


More information about the llvm-commits mailing list