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

Martell Malone via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 21 07:46:18 PST 2017


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





More information about the llvm-commits mailing list