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

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 14:00:01 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
----------------
MaskRay wrote:

We want to test references from one TU to both `malloc` and `calloc` with a stub implementation of `calloc`. I think it is more genuine for `calloc.ll` to define `malloc` along with `calloc` (otherwise `malloc` is undefined while `calloc` is defined, making the test less like a real world scenario).

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


More information about the llvm-commits mailing list