This is an archive of the discontinued LLVM Phabricator instance.

PreISelIntrinsicLowering: Check RuntimeLibcalls instead of TLI for memory functions
ClosedPublic

Authored by arsenm on Aug 9 2023, 6:01 PM.

Details

Summary

We need a better mechanism for expressing which calls you are allowed
to emit and which calls are recognized. This should be applied to the 17 branch.

Diff Detail

Event Timeline

arsenm created this revision.Aug 9 2023, 6:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 6:01 PM
arsenm requested review of this revision.Aug 9 2023, 6:01 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 9 2023, 6:01 PM
Herald added a subscriber: wdng. · View Herald Transcript
arsenm updated this revision to Diff 548840.Aug 9 2023, 6:02 PM

Fix diff

paulkirth accepted this revision.Aug 10 2023, 10:13 AM

Thanks for getting a patch out so quickly. This looks like it avoids the issue we were seeing in our build.

llvm/test/Transforms/PreISelIntrinsicLowering/X86/load-relative.ll
1

Why were load-relative.ll and obj-arc.ll made x86 specific tests? They seem like they should work on any platform.

I'm not opposed to the change, but it's unclear to me what this accomplishes.

This revision is now accepted and ready to land.Aug 10 2023, 10:13 AM
arsenm added inline comments.Aug 10 2023, 10:14 AM
llvm/test/Transforms/PreISelIntrinsicLowering/X86/load-relative.ll
1

The test needs a TargetMachine to query the subtarget. It was weird this didn't have one before

paulkirth added inline comments.Aug 10 2023, 10:38 AM
llvm/test/Transforms/PreISelIntrinsicLowering/X86/load-relative.ll
1

Right, I missed that. Moving this makes total sense. Thanks for the explanation.

nikic added a subscriber: nikic.Aug 11 2023, 12:23 AM
nikic added inline comments.
llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
208

This is using the TLI for the wrong function: It's the one for the intrinsic, rather than the one for the intrinsic caller.

arsenm added inline comments.Aug 11 2023, 9:18 AM
llvm/lib/CodeGen/PreISelIntrinsicLowering.cpp
208

I think this is harmless because the runtime libcall system isn't really refined per function. It's effectively a hardcoded table driven off the triple