forked from OSchip/llvm-project
Revert "[SimplifyCFG] Sinking indirect calls - they're already indirect anyways"
Seems to break indirect call promotion, LTO/Resolution/X86/load-sample-prof-icp.ll fails.
This reverts commit e57cf128b3
.
This commit is contained in:
parent
e57cf128b3
commit
262c679d32
|
@ -1748,10 +1748,11 @@ static bool canSinkInstructions(
|
|||
!canReplaceOperandWithVariable(I0, OI))
|
||||
// We can't create a PHI from this GEP.
|
||||
return false;
|
||||
// Don't *create* indirect calls! The called value is the final operand.
|
||||
auto *CB = dyn_cast<CallBase>(I0);
|
||||
if (CB && OI == OE - 1 && !CB->isIndirectCall())
|
||||
// Don't create indirect calls! The called value is the final operand.
|
||||
if (isa<CallBase>(I0) && OI == OE - 1) {
|
||||
// FIXME: if the call was *already* indirect, we should do this.
|
||||
return false;
|
||||
}
|
||||
for (auto *I : Insts)
|
||||
PHIOperands[I].push_back(I->getOperand(OI));
|
||||
}
|
||||
|
|
|
@ -1383,9 +1383,14 @@ if.end:
|
|||
|
||||
define void @indirect_caller(i1 %c, i32 %v, void (i32)* %foo, void (i32)* %bar) {
|
||||
; CHECK-LABEL: @indirect_caller(
|
||||
; CHECK-NEXT: end:
|
||||
; CHECK-NEXT: [[BAR_SINK:%.*]] = select i1 [[C:%.*]], void (i32)* [[FOO:%.*]], void (i32)* [[BAR:%.*]]
|
||||
; CHECK-NEXT: tail call void [[BAR_SINK]](i32 [[V:%.*]])
|
||||
; CHECK-NEXT: br i1 [[C:%.*]], label [[CALL_FOO:%.*]], label [[CALL_BAR:%.*]]
|
||||
; CHECK: call_foo:
|
||||
; CHECK-NEXT: tail call void [[FOO:%.*]](i32 [[V:%.*]])
|
||||
; CHECK-NEXT: br label [[END:%.*]]
|
||||
; CHECK: call_bar:
|
||||
; CHECK-NEXT: tail call void [[BAR:%.*]](i32 [[V]])
|
||||
; CHECK-NEXT: br label [[END]]
|
||||
; CHECK: end:
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
br i1 %c, label %call_foo, label %call_bar
|
||||
|
|
Loading…
Reference in New Issue