forked from llvm-mirror/llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cfi] Avoid branch veneers in jump tables when possible.
Summary: When jumptable encoding does not match target code encoding (arm vs thumb), a veneer is inserted by the linker. We can not avoid this in all cases, because entries within one jumptable must have the same encoding, but we can make it less common by selecting the jumptable encoding to match the majority of its targets. This change only covers FullLTO, and not ThinLTO. Reviewers: pcc Subscribers: aemerson, mehdi_amini, javed.absar, kristof.beyls, llvm-commits, hiraditya Differential Revision: https://reviews.llvm.org/D37171 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312054 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
2 changed files
with
97 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
; RUN: opt -S -mtriple=arm-unknown-linux-gnu -lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%S/Inputs/use-typeid1-typeid2.yaml -lowertypetests-write-summary=%t < %s | FileCheck %s | ||
|
||
target datalayout = "e-p:64:64" | ||
|
||
define void @f1() "target-features"="+thumb-mode" !type !0 { | ||
ret void | ||
} | ||
|
||
define void @g1() "target-features"="-thumb-mode" !type !0 { | ||
ret void | ||
} | ||
|
||
define void @f2() "target-features"="+thumb-mode" !type !1 { | ||
ret void | ||
} | ||
|
||
define void @g2() "target-features"="-thumb-mode" !type !1 { | ||
ret void | ||
} | ||
|
||
define void @h2() "target-features"="-thumb-mode" !type !1 { | ||
ret void | ||
} | ||
|
||
!0 = !{i32 0, !"typeid1"} | ||
!1 = !{i32 0, !"typeid2"} | ||
|
||
; CHECK: define private void {{.*}} #[[AT:.*]] section ".text.cfi" align 4 { | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: call void asm sideeffect "b.w $0\0Ab.w $1\0A", "s,s"(void ()* @f1.cfi, void ()* @g1.cfi) | ||
; CHECK-NEXT: unreachable | ||
; CHECK-NEXT: } | ||
|
||
; CHECK: define private void {{.*}} #[[AA:.*]] section ".text.cfi" align 4 { | ||
; CHECK-NEXT: entry: | ||
; CHECK-NEXT: call void asm sideeffect "b $0\0Ab $1\0Ab $2\0A", "s,s,s"(void ()* @f2.cfi, void ()* @g2.cfi, void ()* @h2.cfi) | ||
; CHECK-NEXT: unreachable | ||
; CHECK-NEXT: } | ||
|
||
; CHECK-DAG: attributes #[[AA]] = { naked "target-features"="-thumb-mode" } | ||
; CHECK-DAG: attributes #[[AT]] = { naked "target-cpu"="cortex-a8" "target-features"="+thumb-mode" } |