[PATCH] D29445: LTO: add a code-model flag

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 11:22:43 PST 2017


I don't think you need code-model.s because lld's test suite is the wrong
place for what is effectively a test of llvm's CommandLine library. If you
wanted to, you could prepare a separate change with a test that verifies
that we handle enum cl::opt flags correctly (including error handling), but
that test should live in llvm's test suite.

My one suggestion for the codemodel.ll test case is that you can return the
address of the global to simplify the IR a little and avoid the need for
--lto-O0.

Can you please also prepare a similar test for gold?

Thanks,
Peter

On Tue, Feb 21, 2017 at 7:46 AM, Martell Malone via Phabricator <
reviews at reviews.llvm.org> wrote:

> martell added a comment.
>
> I got the following test case working as `test/ELF/lto/codemodel.ll`
>
>   ; REQUIRES: x86
>   ; RUN: llvm-as %s -o %t.o
>   ; RUN: ld.lld -m elf_x86_64 %t.o -o %ts -e foo --lto-O0 -mllvm
> -code-model=small
>   ; RUN: ld.lld -m elf_x86_64 %t.o -o %tl -e foo --lto-O0 -mllvm
> -code-model=large
>   ; RUN: llvm-objdump -d %ts | FileCheck %s --check-prefix=CHECK-SMALL
>   ; RUN: llvm-objdump -d %tl | FileCheck %s --check-prefix=CHECK-LARGE
>
>   target triple = "x86_64-unknown-linux-gnu"
>   target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
>
>   @data = internal constant [0 x i32] []
>
>   define i32 @foo() nounwind readonly {
>   entry:
>   ; CHECK-SMALL-LABEL:  foo:
>   ; CHECK-SMALL: movl    -3814(%rip), %eax
>   ; CHECK-LARGE-LABEL: foo:
>   ; CHECK-LARGE: movabsq $2097440, %rax
>   ; CHECK-LARGE: movl    (%rax), %eax
>       %0 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @data, i64
> 0, i64 0), align 4
>       ret i32 %0
>   }
>
> @pcc do you want me to keep `test/ELF/code-model.s` also ?
> Also do you have any issues you have with the above testcase?
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D29445
>
>
>
>


-- 
-- 
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170221/d5a184a1/attachment.html>


More information about the llvm-commits mailing list