This is an archive of the discontinued LLVM Phabricator instance.

Use ArrayRef instead of raw pointers. NFC
ClosedPublic

Authored by sepavloff on Jan 31 2023, 11:49 PM.

Details

Summary

Change signature of TargetLowering::getRoundingControlRegisters so that
it returns ArrayRef, not plain pointer.

Diff Detail

Event Timeline

sepavloff created this revision.Jan 31 2023, 11:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 11:49 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
sepavloff requested review of this revision.Jan 31 2023, 11:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 31 2023, 11:49 PM
pengfei accepted this revision.Feb 1 2023, 1:03 AM

LG.

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
14950–14951

Maybe return {AArch64::FPCR};?

llvm/lib/Target/X86/X86ISelLowering.cpp
3103

ditto.

This revision is now accepted and ready to land.Feb 1 2023, 1:03 AM
efriedma added inline comments.Feb 1 2023, 10:08 AM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
14950–14951

I'm pretty sure return {AArch64::FPCR}; would be a use-after-free. (It allocates an std::initializer_list on the stack, then returns a reference to it.)

pengfei added inline comments.Feb 1 2023, 6:46 PM
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
14950–14951

Thanke @efriedma! You are right https://godbolt.org/z/ar7rd7v8M
Sorry for misleading.

This revision was automatically updated to reflect the committed changes.