<div dir="ltr"><div>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.</div><div><br></div>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.<div><br></div><div>Can you please also prepare a similar test for gold?</div><div><br></div><div>Thanks,</div><div>Peter</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 21, 2017 at 7:46 AM, Martell Malone via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">martell added a comment.<br>
<br>
I got the following test case working as `test/ELF/lto/codemodel.ll`<br>
<span class=""><br>
  ; REQUIRES: x86<br>
  ; RUN: llvm-as %s -o %t.o<br>
</span>  ; RUN: ld.lld -m elf_x86_64 %t.o -o %ts -e foo --lto-O0 -mllvm -code-model=small<br>
  ; RUN: ld.lld -m elf_x86_64 %t.o -o %tl -e foo --lto-O0 -mllvm -code-model=large<br>
  ; RUN: llvm-objdump -d %ts | FileCheck %s --check-prefix=CHECK-SMALL<br>
  ; RUN: llvm-objdump -d %tl | FileCheck %s --check-prefix=CHECK-LARGE<br>
<br>
  target triple = "x86_64-unknown-linux-gnu"<br>
  target datalayout = "e-m:e-i64:64-f80:128-n8:16:<wbr>32:64-S128"<br>
<br>
  @data = internal constant [0 x i32] []<br>
<span class=""><br>
  define i32 @foo() nounwind readonly {<br>
  entry:<br>
  ; CHECK-SMALL-LABEL:  foo:<br>
</span>  ; CHECK-SMALL: movl    -3814(%rip), %eax<br>
  ; CHECK-LARGE-LABEL: foo:<br>
  ; CHECK-LARGE: movabsq $2097440, %rax<br>
  ; CHECK-LARGE: movl    (%rax), %eax<br>
<span class="">      %0 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @data, i64 0, i64 0), align 4<br>
</span>      ret i32 %0<br>
  }<br>
<br>
@pcc do you want me to keep `test/ELF/code-model.s` also ?<br>
Also do you have any issues you have with the above testcase?<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D29445" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D29445</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div>