File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed
Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ ; REQUIRES: x86
2+
3+ ; RUN: rm -rf %t && split-file %s %t && cd %t
4+ ; RUN: llvm-as main.ll -o main.o
5+ ; RUN: llvm-as bcmp.ll -o bcmp.o
6+ ; RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux-gnu memcmp.s -o memcmp.o
7+ ; RUN: llvm-ar rc libc.a bcmp.o memcmp.o
8+
9+ ;; Ensure that no memcmp->bcmp translation occurs during LTO because bcmp is in
10+ ;; bitcode, but was not brought into the link. This would fail the link by
11+ ;; extracting bitcode after LTO.
12+ ; RUN: ld.lld -o out main.o -L. -lc
13+ ; RUN: llvm-nm out | FileCheck %s
14+
15+ ;--- bcmp.ll
16+ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
17+ target triple = "x86_64-unknown-linux-gnu"
18+
19+ define i32 @bcmp(ptr %0, ptr %1, i64 %2) {
20+ ret i32 0
21+ }
22+
23+ ;--- memcmp.s
24+ .globl memcmp
25+ memcmp:
26+ ret
27+
28+ ;--- main.ll
29+ target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
30+ target triple = "x86_64-unknown-linux-gnu"
31+
32+ define i1 @_start(ptr %0, ptr %1, i64 %2) {
33+ %cmp = call i32 @memcmp(ptr %0, ptr %1, i64 %2)
34+ %eq = icmp eq i32 %cmp, 0
35+ ret i1 %eq
36+ }
37+
38+ ; CHECK-NOT: bcmp
39+ ; CHECK: memcmp
40+ declare i32 @memcmp(ptr, ptr, i64)
41+
You can’t perform that action at this time.
0 commit comments