[llvm] 01ef3ff - [NFC][LowerTypeTests] Expand tests for CFI jump table hotness ordering (#223848)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 18 10:50:34 PDT 2026
Author: Vitaly Buka
Date: 2026-09-18T17:50:27Z
New Revision: 01ef3ffcdc4e9f75ba31bcbde41520874243bc1a
URL: https://github.com/llvm/llvm-project/commit/01ef3ffcdc4e9f75ba31bcbde41520874243bc1a
DIFF: https://github.com/llvm/llvm-project/commit/01ef3ffcdc4e9f75ba31bcbde41520874243bc1a.diff
LOG: [NFC][LowerTypeTests] Expand tests for CFI jump table hotness ordering (#223848)
Expand pre-commit test coverage to establish the baseline CFI jump table
layout before implementing hotness-based reordering in
https://github.com/llvm/llvm-project/pull/221046.
We expand these tests to verify we accurately track hotness data
originating from `cfi.functions` metadata, BlockFrequencyInfo (BFI)
counts, and IR function attributes (hot/cold). By covering these inputs,
we ensure the correct hotness tier is propagated for layout decisions
across different profile sources and LTO targets.
These tests verify the baseline declaration-order layout where functions
within each strict type are placed without hotness consideration, making
the subsequent reordering diff explicit and easy to review.
PR Stack:
* https://github.com/llvm/llvm-project/pull/220776
* https://github.com/llvm/llvm-project/pull/221043
* https://github.com/llvm/llvm-project/pull/221044
* https://github.com/llvm/llvm-project/pull/223843
* https://github.com/llvm/llvm-project/pull/223846
* ➤ https://github.com/llvm/llvm-project/pull/223848
* https://github.com/llvm/llvm-project/pull/221046
Assisted-by: Gemini
Added:
Modified:
llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness-summary.ll
llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness-summary.ll b/llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness-summary.ll
index a47216f4f43a2..dabcac5231a67 100644
--- a/llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness-summary.ll
+++ b/llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness-summary.ll
@@ -1,10 +1,10 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs --version 6
; RUN: opt -S %s -passes=lowertypetests -lowertypetests-summary-action=export -lowertypetests-read-summary=%s | FileCheck %s
-; TODO: Tests that functions in a jump table are reordered according to call edge hotness
-; recorded in the ThinLTO summary index:
-; 1. (Highest priority) Within each strict type, hotter functions are placed later,
-; ordered strictly by: Cold (0) < Unknown (1) < None (2) < Hot (3) < Critical (4).
+; Tests that functions in a jump table are reordered according to hotness passed
+; in cfi.functions metadata:
+; 1. (Highest priority) Within each strict type, hotter functions are placed later:
+; Cold (0) < Unknown (1) < None (2) < Hot (3) < Critical (4).
; 2. (High priority) Across fragments, the fragment with the globally hottest function
; (@f_critical) is placed at the very end of the jump table.
; 3. (Best effort) Each strict type's members remain contiguous (lowered to range checks, no holes).
@@ -15,35 +15,35 @@ target triple = "x86_64-unknown-linux-gnu"
@0 = private unnamed_addr constant [8 x ptr] [ptr @f_critical, ptr @g_unknown, ptr @f_cold, ptr @g_hot, ptr @f_none, ptr @g_cold, ptr @f_unknown, ptr @f_hot], align 16
; Strict typeid1 and typeid2 functions defined in scrambled order:
-define void @f_critical() !type !0 !type !1 {
+define void @f_critical() !type !0 !type !1 !guid !{i64 14457025706112322155} {
ret void
}
-define void @g_unknown() !type !2 !type !1 {
+define void @g_unknown() !type !2 !type !1 !guid !{i64 16691380702939550262} {
ret void
}
-define void @f_cold() !type !0 !type !1 {
+define void @f_cold() !type !0 !type !1 !guid !{i64 3658589069114391263} {
ret void
}
-define void @g_hot() !type !2 !type !1 {
+define void @g_hot() !type !2 !type !1 !guid !{i64 18081025037889099144} {
ret void
}
-define void @f_none() !type !0 !type !1 {
+define void @f_none() !type !0 !type !1 !guid !{i64 1928809046209326017} {
ret void
}
-define void @g_cold() !type !2 !type !1 {
+define void @g_cold() !type !2 !type !1 !guid !{i64 4485074774011110174} {
ret void
}
-define void @f_unknown() !type !0 !type !1 {
+define void @f_unknown() !type !0 !type !1 !guid !{i64 1205929326482009600} {
ret void
}
-define void @f_hot() !type !0 !type !1 {
+define void @f_hot() !type !0 !type !1 !guid !{i64 9377218764429055595} {
ret void
}
@@ -68,66 +68,64 @@ define i1 @test_generalized(ptr %p) {
!1 = !{i32 0, !"typeid2"}
!2 = !{i32 0, !"typeid.generalized"}
+!cfi.functions = !{!3, !4, !5, !6, !7, !8, !9, !10}
+!3 = !{!"f_cold", i8 0, i64 3658589069114391263, !0}
+!4 = !{!"f_unknown", i8 4, i64 1205929326482009600, !0}
+!5 = !{!"f_none", i8 8, i64 1928809046209326017, !0}
+!6 = !{!"f_hot", i8 12, i64 9377218764429055595, !0}
+!7 = !{!"f_critical", i8 16, i64 14457025706112322155, !0}
+!8 = !{!"g_cold", i8 0, i64 4485074774011110174, !2}
+!9 = !{!"g_unknown", i8 4, i64 16691380702939550262, !2}
+!10 = !{!"g_hot", i8 12, i64 18081025037889099144, !2}
+
+
^0 = module: (path: "cfi-jumptable-hotness-summary.o", hash: (0, 0, 0, 0, 0))
-; Caller function calling jump table targets with various hotness tiers:
-^1 = gv: (guid: 100, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1, calls: ((callee: ^2, hotness: cold), (callee: ^3, hotness: unknown), (callee: ^4, hotness: none), (callee: ^5, hotness: hot), (callee: ^6, hotness: critical), (callee: ^7, hotness: cold), (callee: ^8, hotness: cold), (callee: ^8, hotness: unknown), (callee: ^9, hotness: none), (callee: ^9, hotness: hot)))))
-
-; Functions in typeid1 covering all 5 call edge hotness types:
-; f_cold (GUID: 3658589069114391263) -> Cold (tier 0)
-^2 = gv: (guid: 3658589069114391263, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
-; f_unknown (GUID: 1205929326482009600) -> Unknown (tier 1)
-^3 = gv: (guid: 1205929326482009600, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
-; f_none (GUID: 1928809046209326017) -> None (tier 2)
-^4 = gv: (guid: 1928809046209326017, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
-; f_hot (GUID: 9377218764429055595) -> Hot (tier 3)
-^5 = gv: (guid: 9377218764429055595, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
-; f_critical (GUID: 14457025706112322155) -> Critical (tier 4)
-^6 = gv: (guid: 14457025706112322155, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
-
-; Functions in typeid2:
-; g_cold (GUID: 4485074774011110174) -> Cold (tier 0)
-^7 = gv: (guid: 4485074774011110174, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
-; g_unknown (GUID: 16691380702939550262) -> multiple calls (cold, unknown), max hotness Unknown (tier 1)
-^8 = gv: (guid: 16691380702939550262, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
-; g_hot (GUID: 18081025037889099144) -> multiple calls, max hotness Hot (tier 3)
-^9 = gv: (guid: 18081025037889099144, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 1)))
+^1 = gv: (guid: 100, summaries: (function: (module: ^0, flags: (live: 1), insts: 1, refs: (^2, ^3, ^4, ^5, ^6, ^7, ^8, ^9))))
+^2 = gv: (guid: 3658589069114391263, summaries: (function: (module: ^0, flags: (live: 1), insts: 1)))
+^3 = gv: (guid: 1205929326482009600, summaries: (function: (module: ^0, flags: (live: 1), insts: 1)))
+^4 = gv: (guid: 1928809046209326017, summaries: (function: (module: ^0, flags: (live: 1), insts: 1)))
+^5 = gv: (guid: 9377218764429055595, summaries: (function: (module: ^0, flags: (live: 1), insts: 1)))
+^6 = gv: (guid: 14457025706112322155, summaries: (function: (module: ^0, flags: (live: 1), insts: 1)))
+^7 = gv: (guid: 4485074774011110174, summaries: (function: (module: ^0, flags: (live: 1), insts: 1)))
+^8 = gv: (guid: 16691380702939550262, summaries: (function: (module: ^0, flags: (live: 1), insts: 1)))
+^9 = gv: (guid: 18081025037889099144, summaries: (function: (module: ^0, flags: (live: 1), insts: 1)))
; CHECK-LABEL: define hidden void @f_critical.cfi(
-; CHECK-SAME: ) !type [[META0:![0-9]+]] !type [[META1:![0-9]+]] {
+; CHECK-SAME: ) !type [[META1:![0-9]+]] !type [[META10:![0-9]+]] !guid [[META11:![0-9]+]] {
; CHECK-NEXT: ret void
;
;
; CHECK-LABEL: define hidden void @g_unknown.cfi(
-; CHECK-SAME: ) !type [[META2:![0-9]+]] !type [[META1]] {
+; CHECK-SAME: ) !type [[META7:![0-9]+]] !type [[META10]] !guid [[META12:![0-9]+]] {
; CHECK-NEXT: ret void
;
;
; CHECK-LABEL: define hidden void @f_cold.cfi(
-; CHECK-SAME: ) !type [[META0]] !type [[META1]] {
+; CHECK-SAME: ) !type [[META1]] !type [[META10]] !guid [[META13:![0-9]+]] {
; CHECK-NEXT: ret void
;
;
; CHECK-LABEL: define hidden void @g_hot.cfi(
-; CHECK-SAME: ) !type [[META2]] !type [[META1]] {
+; CHECK-SAME: ) !type [[META7]] !type [[META10]] !guid [[META14:![0-9]+]] {
; CHECK-NEXT: ret void
;
;
; CHECK-LABEL: define hidden void @f_none.cfi(
-; CHECK-SAME: ) !type [[META0]] !type [[META1]] {
+; CHECK-SAME: ) !type [[META1]] !type [[META10]] !guid [[META15:![0-9]+]] {
; CHECK-NEXT: ret void
;
;
; CHECK-LABEL: define hidden void @g_cold.cfi(
-; CHECK-SAME: ) !type [[META2]] !type [[META1]] {
+; CHECK-SAME: ) !type [[META7]] !type [[META10]] !guid [[META16:![0-9]+]] {
; CHECK-NEXT: ret void
;
;
; CHECK-LABEL: define hidden void @f_unknown.cfi(
-; CHECK-SAME: ) !type [[META0]] !type [[META1]] {
+; CHECK-SAME: ) !type [[META1]] !type [[META10]] !guid [[META17:![0-9]+]] {
; CHECK-NEXT: ret void
;
;
; CHECK-LABEL: define hidden void @f_hot.cfi(
-; CHECK-SAME: ) !type [[META0]] !type [[META1]] {
+; CHECK-SAME: ) !type [[META1]] !type [[META10]] !guid [[META18:![0-9]+]] {
; CHECK-NEXT: ret void
;
;
@@ -159,7 +157,7 @@ define i1 @test_generalized(ptr %p) {
;
;
; CHECK-LABEL: define private void @.cfi.jumptable(
-; CHECK-SAME: ) #[[ATTR1:[0-9]+]] prefalign(8) !elf_section_properties [[META3:![0-9]+]] {
+; CHECK-SAME: ) #[[ATTR1:[0-9]+]] prefalign(8) !elf_section_properties [[META19:![0-9]+]] {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @f_critical.cfi)
; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @f_cold.cfi)
@@ -172,8 +170,16 @@ define i1 @test_generalized(ptr %p) {
; CHECK-NEXT: unreachable
;
;.
-; CHECK: [[META0]] = !{i32 0, !"typeid1"}
-; CHECK: [[META1]] = !{i32 0, !"typeid2"}
-; CHECK: [[META2]] = !{i32 0, !"typeid.generalized"}
-; CHECK: [[META3]] = !{i64 1879002126, i64 8}
+; CHECK: [[META1]] = !{i32 0, !"typeid1"}
+; CHECK: [[META7]] = !{i32 0, !"typeid.generalized"}
+; CHECK: [[META10]] = !{i32 0, !"typeid2"}
+; CHECK: [[META11]] = !{i64 -3989718367597229461}
+; CHECK: [[META12]] = !{i64 -1755363370770001354}
+; CHECK: [[META13]] = !{i64 3658589069114391263}
+; CHECK: [[META14]] = !{i64 -365719035820452472}
+; CHECK: [[META15]] = !{i64 1928809046209326017}
+; CHECK: [[META16]] = !{i64 4485074774011110174}
+; CHECK: [[META17]] = !{i64 1205929326482009600}
+; CHECK: [[META18]] = !{i64 -9069525309280496021}
+; CHECK: [[META19]] = !{i64 1879002126, i64 8}
;.
diff --git a/llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness.ll b/llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness.ll
index e8d8b8531798d..bc5c783c1b5eb 100644
--- a/llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness.ll
+++ b/llvm/test/Transforms/LowerTypeTests/cfi-jumptable-hotness.ll
@@ -2,13 +2,17 @@
; RUN: opt -S -passes=lowertypetests -mtriple=x86_64-unknown-linux-gnu %s | FileCheck %s
; TODO: Tests that functions in a jump table are reordered according to hotness priorities:
-; 1. (Highest priority) Within each strict type / fragment, hotter functions are placed later:
-; cold (no count) < cold (with count) < unannotated (count 0) < count 10 < count 100 < hot (count 0) < hot (with count).
-; - Tier 0: functions with 'cold' attribute (ties broken by entry count).
-; - Tier 1: unannotated / default functions (ties broken by entry count).
-; - Tier 3: functions with 'hot' attribute (ties broken by entry count).
-; - Tier comparison takes precedence over count: cold with count < unannotated count 0,
-; and unannotated count 100 < hot count 0.
+; 1. (Highest priority) Within each strict type / fragment, hotter functions are placed later.
+; Hotness is computed as the maximum execution count across entry and basic blocks,
+; with 'hot' attribute boosting to INT64_MAX:
+; Expected hotness order for functions in this test:
+; - cold / unannotated (count 0): 0
+; - unannotated (count 10): 10
+; - cold (count 42): 42
+; - unannotated (count 100): 100
+; - unannotated (count 1000): 1000
+; - cfg hot (entry count 10, loop block count 10000): 10000
+; - hot (count 0 / 500 / 1000): INT64_MAX
; 2. (High priority) Across fragments, the fragment with the globally hottest function
; is placed at the very end of the jump table (so the globally hottest function is
; the last entry in .cfi.jumptable).
@@ -18,19 +22,27 @@ target datalayout = "e-p:64:64"
; Pass functions in arbitrary / scrambled order to verify that hotness sorting
; is independent of input declaration order.
- at 0 = private unnamed_addr constant [14 x ptr] [
+ at 0 = private unnamed_addr constant [22 x ptr] [
ptr @f_hot_count1000,
+ ptr @h_hot,
ptr @f_cold,
ptr @g_hot_count500,
+ ptr @j_cfg_hot,
ptr @f_count100,
+ ptr @h_cold,
ptr @g_cold,
ptr @f_cold_count42,
+ ptr @j_normal,
ptr @g_normal,
+ ptr @h_count1000,
ptr @f_normal,
ptr @g_count10,
+ ptr @j_count1000,
ptr @g_cold_count42,
ptr @f_count10,
+ ptr @h_normal,
ptr @g_count100,
+ ptr @j_cold,
ptr @f_hot,
ptr @g_hot
], align 16
@@ -91,6 +103,52 @@ define void @g_hot() hot !type !1 !type !2 {
ret void
}
+; Group h_: verifies that a function with the 'hot' attribute wins (INT64_MAX)
+; over a function with a high entry count (1000) and no 'hot' attribute.
+define void @h_cold() cold !type !8 !type !2 {
+ ret void
+}
+
+define void @h_normal() !type !8 !type !2 {
+ ret void
+}
+
+define void @h_count1000() !prof !5 !type !8 !type !2 {
+ ret void
+}
+
+define void @h_hot() hot !type !8 !type !2 {
+ ret void
+}
+
+; Group j_: verifies that BFI CFG block execution count (10000 in loop block)
+; wins over a function with a flat CFG and high entry count (1000).
+define void @j_cold() cold !type !9 !type !2 {
+ ret void
+}
+
+define void @j_normal() !type !9 !type !2 {
+ ret void
+}
+
+define void @j_count1000() !prof !5 !type !9 !type !2 {
+ ret void
+}
+
+define void @j_cfg_hot() !prof !3 !type !9 !type !2 {
+entry:
+ br label %loop
+
+loop:
+ %i = phi i32 [ 0, %entry ], [ %next, %loop ]
+ %next = add i32 %i, 1
+ %cond = icmp slt i32 %next, 1000
+ br i1 %cond, label %loop, label %exit, !prof !10
+
+exit:
+ ret void
+}
+
declare i1 @llvm.type.test(ptr %ptr, metadata %bitset) nounwind readnone
define i1 @test_typeid1(ptr %p) {
@@ -103,6 +161,16 @@ define i1 @test_typeid2(ptr %p) {
ret i1 %x
}
+define i1 @test_typeid_h(ptr %p) {
+ %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid_h")
+ ret i1 %x
+}
+
+define i1 @test_typeid_j(ptr %p) {
+ %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid_j")
+ ret i1 %x
+}
+
define i1 @test_generalized(ptr %p) {
%x = call i1 @llvm.type.test(ptr %p, metadata !"typeid.generalized")
ret i1 %x
@@ -116,6 +184,9 @@ define i1 @test_generalized(ptr %p) {
!5 = !{!"function_entry_count", i64 1000}
!6 = !{!"function_entry_count", i64 42}
!7 = !{!"function_entry_count", i64 500}
+!8 = !{i32 0, !"typeid_h"}
+!9 = !{i32 0, !"typeid_j"}
+!10 = !{!"branch_weights", i32 999, i32 1}
; CHECK-LABEL: define hidden void @f_hot_count1000.cfi(
; CHECK-SAME: ) #[[ATTR0:[0-9]+]] !prof [[PROF0:![0-9]+]] !type [[META1:![0-9]+]] !type [[META2:![0-9]+]] {
@@ -187,6 +258,54 @@ define i1 @test_generalized(ptr %p) {
; CHECK-NEXT: ret void
;
;
+; CHECK-LABEL: define hidden void @h_cold.cfi(
+; CHECK-SAME: ) #[[ATTR1]] !type [[META8:![0-9]+]] !type [[META2]] {
+; CHECK-NEXT: ret void
+;
+;
+; CHECK-LABEL: define hidden void @h_normal.cfi(
+; CHECK-SAME: ) !type [[META8]] !type [[META2]] {
+; CHECK-NEXT: ret void
+;
+;
+; CHECK-LABEL: define hidden void @h_count1000.cfi(
+; CHECK-SAME: ) !prof [[PROF0]] !type [[META8]] !type [[META2]] {
+; CHECK-NEXT: ret void
+;
+;
+; CHECK-LABEL: define hidden void @h_hot.cfi(
+; CHECK-SAME: ) #[[ATTR0]] !type [[META8]] !type [[META2]] {
+; CHECK-NEXT: ret void
+;
+;
+; CHECK-LABEL: define hidden void @j_cold.cfi(
+; CHECK-SAME: ) #[[ATTR1]] !type [[META9:![0-9]+]] !type [[META2]] {
+; CHECK-NEXT: ret void
+;
+;
+; CHECK-LABEL: define hidden void @j_normal.cfi(
+; CHECK-SAME: ) !type [[META9]] !type [[META2]] {
+; CHECK-NEXT: ret void
+;
+;
+; CHECK-LABEL: define hidden void @j_count1000.cfi(
+; CHECK-SAME: ) !prof [[PROF0]] !type [[META9]] !type [[META2]] {
+; CHECK-NEXT: ret void
+;
+;
+; CHECK-LABEL: define hidden void @j_cfg_hot.cfi(
+; CHECK-SAME: ) !prof [[PROF7]] !type [[META9]] !type [[META2]] {
+; CHECK-NEXT: [[ENTRY:.*]]:
+; CHECK-NEXT: br label %[[LOOP:.*]]
+; CHECK: [[LOOP]]:
+; CHECK-NEXT: [[I:%.*]] = phi i32 [ 0, %[[ENTRY]] ], [ [[NEXT:%.*]], %[[LOOP]] ]
+; CHECK-NEXT: [[NEXT]] = add i32 [[I]], 1
+; CHECK-NEXT: [[COND:%.*]] = icmp slt i32 [[NEXT]], 1000
+; CHECK-NEXT: br i1 [[COND]], label %[[LOOP]], label %[[EXIT:.*]], !prof [[PROF10:![0-9]+]]
+; CHECK: [[EXIT]]:
+; CHECK-NEXT: ret void
+;
+;
; CHECK-LABEL: define i1 @test_typeid1(
; CHECK-SAME: ptr [[P:%.*]]) {
; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P]] to i64
@@ -205,17 +324,35 @@ define i1 @test_generalized(ptr %p) {
; CHECK-NEXT: ret i1 [[TMP4]]
;
;
+; CHECK-LABEL: define i1 @test_typeid_h(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P]] to i64
+; CHECK-NEXT: [[TMP2:%.*]] = sub i64 ptrtoint (ptr getelementptr (i8, ptr @.cfi.jumptable, i64 136) to i64), [[TMP1]]
+; CHECK-NEXT: [[TMP3:%.*]] = call i64 @llvm.fshr.i64(i64 [[TMP2]], i64 [[TMP2]], i64 3)
+; CHECK-NEXT: [[TMP4:%.*]] = icmp ule i64 [[TMP3]], 3
+; CHECK-NEXT: ret i1 [[TMP4]]
+;
+;
+; CHECK-LABEL: define i1 @test_typeid_j(
+; CHECK-SAME: ptr [[P:%.*]]) {
+; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P]] to i64
+; CHECK-NEXT: [[TMP2:%.*]] = sub i64 ptrtoint (ptr getelementptr (i8, ptr @.cfi.jumptable, i64 168) to i64), [[TMP1]]
+; CHECK-NEXT: [[TMP3:%.*]] = call i64 @llvm.fshr.i64(i64 [[TMP2]], i64 [[TMP2]], i64 3)
+; CHECK-NEXT: [[TMP4:%.*]] = icmp ule i64 [[TMP3]], 3
+; CHECK-NEXT: ret i1 [[TMP4]]
+;
+;
; CHECK-LABEL: define i1 @test_generalized(
; CHECK-SAME: ptr [[P:%.*]]) {
; CHECK-NEXT: [[TMP1:%.*]] = ptrtoint ptr [[P]] to i64
-; CHECK-NEXT: [[TMP2:%.*]] = sub i64 ptrtoint (ptr getelementptr (i8, ptr @.cfi.jumptable, i64 104) to i64), [[TMP1]]
+; CHECK-NEXT: [[TMP2:%.*]] = sub i64 ptrtoint (ptr getelementptr (i8, ptr @.cfi.jumptable, i64 168) to i64), [[TMP1]]
; CHECK-NEXT: [[TMP3:%.*]] = call i64 @llvm.fshr.i64(i64 [[TMP2]], i64 [[TMP2]], i64 3)
-; CHECK-NEXT: [[TMP4:%.*]] = icmp ule i64 [[TMP3]], 13
+; CHECK-NEXT: [[TMP4:%.*]] = icmp ule i64 [[TMP3]], 21
; CHECK-NEXT: ret i1 [[TMP4]]
;
;
; CHECK-LABEL: define private void @.cfi.jumptable(
-; CHECK-SAME: ) #[[ATTR3:[0-9]+]] prefalign(8) !elf_section_properties [[META8:![0-9]+]] {
+; CHECK-SAME: ) #[[ATTR3:[0-9]+]] prefalign(8) !elf_section_properties [[META11:![0-9]+]] {
; CHECK-NEXT: [[ENTRY:.*:]]
; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @f_hot_count1000.cfi)
; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @f_cold.cfi)
@@ -231,6 +368,14 @@ define i1 @test_generalized(ptr %p) {
; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @g_cold_count42.cfi)
; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @g_count100.cfi)
; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @g_hot.cfi)
+; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @h_cold.cfi)
+; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @h_normal.cfi)
+; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @h_count1000.cfi)
+; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @h_hot.cfi)
+; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @j_cold.cfi)
+; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @j_normal.cfi)
+; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @j_count1000.cfi)
+; CHECK-NEXT: call void asm sideeffect "jmp ${0:c}@plt\0Aint3\0Aint3\0Aint3\0A", "s"(ptr @j_cfg_hot.cfi)
; CHECK-NEXT: unreachable
;
;.
@@ -242,5 +387,8 @@ define i1 @test_generalized(ptr %p) {
; CHECK: [[PROF5]] = !{!"function_entry_count", i64 100}
; CHECK: [[PROF6]] = !{!"function_entry_count", i64 42}
; CHECK: [[PROF7]] = !{!"function_entry_count", i64 10}
-; CHECK: [[META8]] = !{i64 1879002126, i64 8}
+; CHECK: [[META8]] = !{i32 0, !"typeid_h"}
+; CHECK: [[META9]] = !{i32 0, !"typeid_j"}
+; CHECK: [[PROF10]] = !{!"branch_weights", i32 999, i32 1}
+; CHECK: [[META11]] = !{i64 1879002126, i64 8}
;.
More information about the llvm-commits
mailing list