Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ void DFAJumpThreading::unfold(DomTreeUpdater *DTU, LoopInfo *LI,
if (!ProfcheckDisableMetadataFixes)
BI->setMetadata(LLVMContext::MD_prof,
SI->getMetadata(LLVMContext::MD_prof));
DTU->applyUpdates({{DominatorTree::Insert, StartBlock, EndBlock},
{DominatorTree::Insert, StartBlock, NewBlock}});
DTU->applyUpdates({{DominatorTree::Insert, StartBlock, NewBlock}});
} else {
BasicBlock *EndBlock = SIUse->getParent();
BasicBlock *NewBlockT = BasicBlock::Create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,9 +445,67 @@ bb2: ; preds = %select.unfold
unreachable
}


define i16 @DTU_update_crash() {
; CHECK-LABEL: @DTU_update_crash(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[FOR_BODY_SELECTBLOCK:%.*]]
; CHECK: for.body.selectblock:
; CHECK-NEXT: br i1 false, label [[SWITCHBLOCK_JT0:%.*]], label [[SEL_SI_UNFOLD_FALSE_JT0:%.*]]
; CHECK: sel.si.unfold.false:
; CHECK-NEXT: br label [[SWITCHBLOCK:%.*]]
; CHECK: sel.si.unfold.false.jt0:
; CHECK-NEXT: [[DOTSI_UNFOLD_PHI_JT0:%.*]] = phi i32 [ 0, [[FOR_BODY_SELECTBLOCK]] ]
; CHECK-NEXT: br label [[SWITCHBLOCK_JT0]]
; CHECK: switchblock:
; CHECK-NEXT: [[SWITCHBLOCK_PHI:%.*]] = phi i32 [ poison, [[SEL_SI_UNFOLD_FALSE:%.*]] ]
; CHECK-NEXT: [[P_24_ADDR_3:%.*]] = phi i32 [ 0, [[SEL_SI_UNFOLD_FALSE]] ]
; CHECK-NEXT: switch i32 [[SWITCHBLOCK_PHI]], label [[CLEANUP:%.*]] [
; CHECK-NEXT: i32 0, label [[FOR_INC:%.*]]
; CHECK-NEXT: i32 1, label [[CLEANUP]]
; CHECK-NEXT: i32 5, label [[FOR_BODY_SELECTBLOCK]]
; CHECK-NEXT: ]
; CHECK: switchblock.jt0:
; CHECK-NEXT: [[SWITCHBLOCK_PHI_JT0:%.*]] = phi i32 [ 0, [[FOR_BODY_SELECTBLOCK]] ], [ [[DOTSI_UNFOLD_PHI_JT0]], [[SEL_SI_UNFOLD_FALSE_JT0]] ]
; CHECK-NEXT: [[P_24_ADDR_3_JT0:%.*]] = phi i32 [ 0, [[FOR_BODY_SELECTBLOCK]] ], [ 0, [[SEL_SI_UNFOLD_FALSE_JT0]] ]
; CHECK-NEXT: br label [[FOR_INC]]
; CHECK: for.inc:
; CHECK-NEXT: br i1 false, label [[FOR_BODY_SELECTBLOCK]], label [[CLEANUP]]
; CHECK: cleanup:
; CHECK-NEXT: call void (...) @llvm.fake.use(i32 [[P_24_ADDR_3_JT0]])
; CHECK-NEXT: ret i16 0
;
entry:
br label %for.body.selectblock

for.body.selectblock: ; preds = %for.inc, %switchblock, %entry
%sel = select i1 false, i32 0, i32 0
br label %switchblock

switchblock: ; preds = %for.body.selectblock
%switchblock.phi = phi i32 [ %sel, %for.body.selectblock ]
%p_24.addr.3 = phi i32 [ 0, %for.body.selectblock ]
switch i32 %switchblock.phi, label %cleanup [
i32 0, label %for.inc
i32 1, label %cleanup
i32 5, label %for.body.selectblock
]

for.inc: ; preds = %switchblock
br i1 false, label %for.body.selectblock, label %cleanup

cleanup: ; preds = %for.inc, %switchblock, %switchblock
call void (...) @llvm.fake.use(i32 %p_24.addr.3)
ret i16 0
}

declare void @llvm.fake.use(...)

!0 = !{!"function_entry_count", i32 10}
!1 = !{!"branch_weights", i32 3, i32 5}
;.
; CHECK: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: readwrite) }
;.
; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i32 10}
; CHECK: [[PROF1]] = !{!"branch_weights", i32 3, i32 5}
;.