39 lines · plain
1;; With +relax, J below needs a relocation to ensure the target is correct2;; after linker relaxation. See https://github.com/ClangBuiltLinux/linux/issues/19653 4; RUN: llc -mtriple=riscv64 -mattr=-relax -filetype=obj < %s \5; RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefixes=CHECK,NORELAX6; RUN: llc -mtriple=riscv64 -mattr=+relax -filetype=obj < %s \7; RUN: | llvm-objdump -d -r - | FileCheck %s --check-prefixes=CHECK,RELAX8 9; CHECK: j {{.*}}10; RELAX-NEXT: R_RISCV_JAL {{.*}}11; CHECK-NEXT: auipc ra, 0x012; CHECK-NEXT: R_RISCV_CALL_PLT f13; RELAX-NEXT: R_RISCV_RELAX *ABS*14; CHECK-NEXT: jalr ra15; CHECK-NEXT: j {{.*}}16; CHECK-NEXT: j {{.*}}17; RELAX-NEXT: R_RISCV_JAL .L018; NORELAX-NEXT: li a0, 0x019; RELAX-EMPTY:20 21define dso_local noundef signext i32 @main() local_unnamed_addr #0 {22entry:23 callbr void asm sideeffect ".option push\0A.option norelax\0Aj $0\0A.option pop\0A", "!i"()24 to label %asm.fallthrough [label %label]25 26asm.fallthrough: ; preds = %entry27 tail call void @f()28 callbr void asm sideeffect ".option push\0A.option norelax\0Aj $0\0A.option pop\0A", "!i"()29 to label %asm.fallthrough [label %label]30 br label %label31 32label: ; preds = %asm.fallthrough, %entry33 ret i32 034}35 36declare void @f()37 38attributes #0 = { nounwind "target-features"="-c,+relax" }39