Skip to content

Commit 39c5123

Browse files
committed
[LTT] Mark as unkown weak function tests.
1 parent 30386f3 commit 39c5123

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

llvm/lib/Transforms/IPO/LowerTypeTests.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,6 +1493,9 @@ void LowerTypeTestsModule::replaceWeakDeclarationWithJumpTablePtr(
14931493
Constant::getNullValue(F->getType()));
14941494
Value *Select = Builder.CreateSelect(ICmp, JT,
14951495
Constant::getNullValue(F->getType()));
1496+
1497+
if (auto *SI = dyn_cast<SelectInst>(Select))
1498+
setExplicitlyUnknownBranchWeightsIfProfiled(*SI, DEBUG_TYPE);
14961499
// For phi nodes, we need to update the incoming value for all operands
14971500
// with the same predecessor.
14981501
if (PN)

llvm/test/Transforms/LowerTypeTests/function-weak.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ target triple = "x86_64-unknown-linux-gnu"
3232
declare !type !0 extern_weak void @f()
3333

3434
; CHECK: define zeroext i1 @check_f()
35-
define zeroext i1 @check_f() {
35+
define zeroext i1 @check_f() !prof !{!"function_entry_count", i32 10} {
3636
entry:
3737
; CHECK: [[CMP:%.*]] = icmp ne ptr @f, null
38-
; CHECK: [[SEL:%.*]] = select i1 [[CMP]], ptr @[[JT:.*]], ptr null
38+
; CHECK: [[SEL:%.*]] = select i1 [[CMP]], ptr @[[JT:.*]], ptr null, !prof ![[SELPROF:[0-9]+]]
3939
; CHECK: [[PTI:%.*]] = ptrtoint ptr [[SEL]] to i1
4040
; CHECK: ret i1 [[PTI]]
4141
ret i1 ptrtoint (ptr @f to i1)
@@ -165,3 +165,4 @@ define i1 @foo(ptr %p) {
165165
; CHECK-NEXT: }
166166

167167
!0 = !{i32 0, !"typeid1"}
168+
; CHECK: ![[SELPROF]] = !{!"unknown", !"lowertypetests"}

0 commit comments

Comments
 (0)