This is an archive of the discontinued LLVM Phabricator instance.

[CallSiteInfo] Fix the assertions regarding updating the CallSiteInfo
ClosedPublic

Authored by djtodoro on Jan 30 2020, 5:57 AM.

Details

Summary

The call site info was not updated correctly when deleting corresponding call instructions.

(this was split from the D73534)

Diff Detail

Event Timeline

djtodoro created this revision.Jan 30 2020, 5:57 AM
asbirlea removed a subscriber: asbirlea.Jan 30 2020, 9:13 AM
vsk added inline comments.Jan 30 2020, 1:05 PM
llvm/lib/CodeGen/MachineLICM.cpp
1373

I'm a bit confused by this one. ExtractHoistableLoad can hoist a call? What cases MI->isDereferenceableInvariantLoad(AA) and MI->isCall() to both be true?

llvm/lib/CodeGen/TargetLoweringBase.cpp
1074 ↗(On Diff #241425)

Should PATCHPOINT/STATEPOINT/STACKMAP instructions ever be assigned call site info in the first place? It seems like these should not even get call site entries.

Maybe we could add a helper, like MachineInstr::isCandidateForCallSiteEntry(), that we can check before calling addCallArgsForwardingRegs.

1095 ↗(On Diff #241425)

Ditto for PATCHABLE_EVENT_CALL, seems risky to emit call site info for this.

1115 ↗(On Diff #241425)

Ditto for PATCHABLE_TYPED_EVENT_CALL.

llvm/test/CodeGen/AArch64/arm64-anyregcc.ll
3 ↗(On Diff #241425)

It seems like the FileCheck commands added to these tests can just be removed, as they aren't strictly checking the 'callSites' info in the yaml. Without the FileCheck invocation, the test will still assert if assertions are enabled.

djtodoro marked 2 inline comments as done.Jan 31 2020, 12:03 AM

@vsk Thanks for the comments!

llvm/lib/CodeGen/TargetLoweringBase.cpp
1074 ↗(On Diff #241425)

Maybe we could add a helper, like MachineInstr::isCandidateForCallSiteEntry(), that we can check before calling addCallArgsForwardingRegs.

We have an assertion within the addCallArgsForwardingRegs() checking the call site info is created only for the calls, but it turns out we have calls we do not want to handle here...

I agree, the MachineInstr::isCandidateForCallSiteEntry() is great idea to get this things into the good shape!
I will work on adding that!

llvm/test/CodeGen/AArch64/arm64-anyregcc.ll
3 ↗(On Diff #241425)

I thought removing them in the next patch from the stack. These should just show the places where the assertions have occurred.

djtodoro marked an inline comment as done.Jan 31 2020, 2:43 AM
djtodoro added inline comments.
llvm/lib/CodeGen/MachineLICM.cpp
1373

I was surprised as well.

The case I found this:
CALL64m $rip, 1, $noreg, target-flags(x86-gotpcrel) @objc_msgSend, $noreg, <regmask $bh $bl $bp $bph $bpl $bx $ebp $ebx $hbp $hbx $rbp $rbx $r12 $r13 $r14 $r15 $r12b $r13b $r14b $r15b $r12bh $r13bh $r14bh $r15bh $r12d $r13d $r14d $r15d $r12w $r13w $r14w $r15w $r12wh and 3 more...>, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit-def $rsp, implicit-def $ssp, implicit-def $rax :: (load 8 from got)

from the llvm/test/CodeGen/X86/hoist-invariant-load.ll

djtodoro updated this revision to Diff 242872.Feb 6 2020, 4:37 AM

-Using the isCandidateForCallSiteEntry()

vsk accepted this revision.Feb 6 2020, 1:26 PM

LGTM, pending resolution of https://reviews.llvm.org/D74121 vs. https://reviews.llvm.org/D74159. (I believe this can easily be rebased on top of either patch.)

This revision is now accepted and ready to land.Feb 6 2020, 1:26 PM
vsk accepted this revision.Feb 7 2020, 10:25 AM
This revision was automatically updated to reflect the committed changes.