|
| 1 | +; This test checks if two similar functions, @0 and @1, are not merged as they are unnamed. |
| 2 | + |
| 3 | +; RUN: opt -mtriple=arm64-apple-darwin -S --passes=global-merge-func %s | FileCheck %s |
| 4 | +; RUN: llc -mtriple=arm64-apple-darwin -enable-global-merge-func=true < %s | FileCheck %s |
| 5 | + |
| 6 | +; CHECK-NOT: .Tgm |
| 7 | + |
| 8 | +@g = external local_unnamed_addr global [0 x i32], align 4 |
| 9 | +@g1 = external global i32, align 4 |
| 10 | +@g2 = external global i32, align 4 |
| 11 | + |
| 12 | +define i32 @0(i32 %a) { |
| 13 | +entry: |
| 14 | + %idxprom = sext i32 %a to i64 |
| 15 | + %arrayidx = getelementptr inbounds [0 x i32], [0 x i32]* @g, i64 0, i64 %idxprom |
| 16 | + %0 = load i32, i32* %arrayidx, align 4 |
| 17 | + %1 = load volatile i32, i32* @g1, align 4 |
| 18 | + %mul = mul nsw i32 %1, %0 |
| 19 | + %add = add nsw i32 %mul, 1 |
| 20 | + ret i32 %add |
| 21 | +} |
| 22 | + |
| 23 | +define i32 @1(i32 %a) { |
| 24 | +entry: |
| 25 | + %idxprom = sext i32 %a to i64 |
| 26 | + %arrayidx = getelementptr inbounds [0 x i32], [0 x i32]* @g, i64 0, i64 %idxprom |
| 27 | + %0 = load i32, i32* %arrayidx, align 4 |
| 28 | + %1 = load volatile i32, i32* @g2, align 4 |
| 29 | + %mul = mul nsw i32 %1, %0 |
| 30 | + %add = add nsw i32 %mul, 1 |
| 31 | + ret i32 %add |
| 32 | +} |
0 commit comments