[PATCH] D75300: Support prefix padding for alignment purposes (Relaxable instructions only)

Kan Shengchen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 04:30:38 PDT 2020


skan added a comment.

In D75300#1916196 <https://reviews.llvm.org/D75300#1916196>, @reames wrote:

> SKan, any chance you could bugpoint the failing IR?  Having to setup a full clang and SPEC build to reproduce will be very time intensive.


I have minimized the test case

    .text
  .L1:
  .rept 126
    int3
  .endr
    jmp .L1
  .rept 30
    int3
  .endr
  .p2align 5

Compile this with command

  clang "-cc1as" "-triple" "x86_64-unknown-linux-gnu" "-filetype" "obj" "-main-file-name" "toke.s" "-target-cpu" "x86-64" "-mllvm" "-x86-pad-max-prefix-size=5" "-o" "test.o" "test.s"

and you would get the error

  test.s:8:3: error: value of -130 is too large for field of 1 byte.
    jmp .L1

**Reason of failure:**
In this patch, we try to relax the instruction first and then try to add prefixes to it, which makes the `jmp` require a larger negative offset than it can encode.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75300/new/

https://reviews.llvm.org/D75300





More information about the llvm-commits mailing list