[llvm] [ThinLTO] Don't mark calloc function dead (PR #72673)

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 11:26:54 PST 2023


================
@@ -0,0 +1,35 @@
+; RUN: opt -module-summary %s -o %t1.bc
+; RUN: opt -module-summary %p/Inputs/calloc.ll -o %t2.bc
+; RUN: llvm-lto2 run -save-temps -o %t.out \
+; RUN:   %t1.bc -r=%t1.bc,_Z7DoStuffv,px -r=%t1.bc,_ZnwmRKSt9nothrow_t,px \
+; RUN:          -r=%t1.bc,_ZSt7nothrow -r=%t1.bc,malloc,l \
+; RUN:   %t2.bc -r=%t2.bc,malloc,pl -r=%t2.bc,calloc,pl
+; RUN: llvm-dis %t.out.2.5.precodegen.bc -o - | FileCheck %s
+
+; CHECK: define {{.*}} @calloc
----------------
teresajohnson wrote:

Sure that seems fine too. My point was just that if we aren't checking anything from that main file, then there is no need to have it, as I don't believe it affects whether calloc is kept in the other file. And if the operator new isn't needed, but it is sufficient to just have a function that directly calls both malloc and memset in order to get the folding to calloc, then just have that and remove anything extraneous.

https://github.com/llvm/llvm-project/pull/72673


More information about the llvm-commits mailing list