This is an archive of the discontinued LLVM Phabricator instance.

[M68k] fix -Wdefaulted-function-deleted and -Woverloaded-virtual
ClosedPublic

Authored by nickdesaulniers on Apr 29 2021, 4:16 PM.

Details

Summary

Fixes the following warnings observerd when building the experimental
m68k backend (-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="M68k"):

../lib/Target/M68k/M68kMachineFunction.h:71:3: warning: explicitly
defaulted default constructor is implicitly deleted
[-Wdefaulted-function-deleted]

M68kMachineFunctionInfo() = default;
^

../lib/Target/M68k/M68kMachineFunction.h:24:20: note: default
constructor of 'M68kMachineFunctionInfo' is implicitly deleted because
field 'MF' of reference type 'llvm::MachineFunction &' would not be
initialized

MachineFunction &MF;
                 ^

In file included from ../lib/Target/M68k/M68kISelLowering.cpp:18:
In file included from ../lib/Target/M68k/M68kSubtarget.h:17:
../lib/Target/M68k/M68kFrameLowering.h:60:8: warning:
'llvm::M68kFrameLowering::emitCalleeSavedFrameMoves' hides overloaded
virtual functions [-Woverloaded-virtual]

void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
     ^

../include/llvm/CodeGen/TargetFrameLowering.h:215:3: note: hidden
overloaded virtual function
'llvm::TargetFrameLowering::emitCalleeSavedFrameMoves' declared here:
different number of parameters (2 vs 3)

emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
^

../include/llvm/CodeGen/TargetFrameLowering.h:218:16: note: hidden
overloaded virtual function
'llvm::TargetFrameLowering::emitCalleeSavedFrameMoves' declared here:
different number of parameters (4 vs 3)

virtual void emitCalleeSavedFrameMoves(MachineBasicBlock &MBB,
             ^

pr/50071

Diff Detail

Event Timeline

nickdesaulniers requested review of this revision.Apr 29 2021, 4:16 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 29 2021, 4:16 PM
myhsu accepted this revision.Apr 29 2021, 10:07 PM

LGTM, Thank you!

This revision is now accepted and ready to land.Apr 29 2021, 10:07 PM
This revision was landed with ongoing or failed builds.Apr 30 2021, 11:23 AM
This revision was automatically updated to reflect the committed changes.

@myhsu (or someone else with M68k familiarity) - the virtual function fix here is a semantic change (previously whatever was calling the virtual function would not have been getting the implementation it is now getting). Is there any testing that could be added to demonstrate that this semantic change is correct/avoid the regression/test the codepath that is missing coverage?

@myhsu (or someone else with M68k familiarity) - the virtual function fix here is a semantic change (previously whatever was calling the virtual function would not have been getting the implementation it is now getting). Is there any testing that could be added to demonstrate that this semantic change is correct/avoid the regression/test the codepath that is missing coverage?

@myhsu Ping on this question ^

myhsu added a comment.May 17 2021, 3:21 PM

@myhsu (or someone else with M68k familiarity) - the virtual function fix here is a semantic change (previously whatever was calling the virtual function would not have been getting the implementation it is now getting). Is there any testing that could be added to demonstrate that this semantic change is correct/avoid the regression/test the codepath that is missing coverage?

@myhsu Ping on this question ^

Sorry I missed your previous comment. I will try to add a test accordingly.

@myhsu (or someone else with M68k familiarity) - the virtual function fix here is a semantic change (previously whatever was calling the virtual function would not have been getting the implementation it is now getting). Is there any testing that could be added to demonstrate that this semantic change is correct/avoid the regression/test the codepath that is missing coverage?

@myhsu Ping on this question ^

This might not be the right place to ask, but I accidentally found that no one outside lib/Target is actually using emitCalleeSavedFrameMoves with 4 arguments (please correct me if I'm wrong. I only found one call site of emitCalleeSavedFrameMoves with 2 arguments). Combing with the diff presented here, this patch is actually a NFC one. So I don't think adding a test will be necessary here.
A spin-off question might be: Why was emitCalleeSavedFrameMoves with 4 arguments got exposed as virtual function at the first place if no one is using it?

@myhsu (or someone else with M68k familiarity) - the virtual function fix here is a semantic change (previously whatever was calling the virtual function would not have been getting the implementation it is now getting). Is there any testing that could be added to demonstrate that this semantic change is correct/avoid the regression/test the codepath that is missing coverage?

@myhsu Ping on this question ^

This might not be the right place to ask, but I accidentally found that no one outside lib/Target is actually using emitCalleeSavedFrameMoves with 4 arguments (please correct me if I'm wrong. I only found one call site of emitCalleeSavedFrameMoves with 2 arguments). Combing with the diff presented here, this patch is actually a NFC one. So I don't think adding a test will be necessary here.
A spin-off question might be: Why was emitCalleeSavedFrameMoves with 4 arguments got exposed as virtual function at the first place if no one is using it?

Could you check the version control history of the function? Perhaps it was added for some use at some point, but that use is no longer needed and it could now be removed?

myhsu added a comment.May 20 2021, 9:44 AM

@myhsu (or someone else with M68k familiarity) - the virtual function fix here is a semantic change (previously whatever was calling the virtual function would not have been getting the implementation it is now getting). Is there any testing that could be added to demonstrate that this semantic change is correct/avoid the regression/test the codepath that is missing coverage?

@myhsu Ping on this question ^

This might not be the right place to ask, but I accidentally found that no one outside lib/Target is actually using emitCalleeSavedFrameMoves with 4 arguments (please correct me if I'm wrong. I only found one call site of emitCalleeSavedFrameMoves with 2 arguments). Combing with the diff presented here, this patch is actually a NFC one. So I don't think adding a test will be necessary here.
A spin-off question might be: Why was emitCalleeSavedFrameMoves with 4 arguments got exposed as virtual function at the first place if no one is using it?

Could you check the version control history of the function? Perhaps it was added for some use at some point, but that use is no longer needed and it could now be removed?

It was first introduced in https://reviews.llvm.org/D79978.
emitCalleeSavedFrameMoves with 4 arguments was not used outside lib/Target in that particular patch and I doubt anyone (lib/CodeGen) has used it ever since then.
I can send a patch regarding this matter if that's appropriate.

@myhsu (or someone else with M68k familiarity) - the virtual function fix here is a semantic change (previously whatever was calling the virtual function would not have been getting the implementation it is now getting). Is there any testing that could be added to demonstrate that this semantic change is correct/avoid the regression/test the codepath that is missing coverage?

@myhsu Ping on this question ^

This might not be the right place to ask, but I accidentally found that no one outside lib/Target is actually using emitCalleeSavedFrameMoves with 4 arguments (please correct me if I'm wrong. I only found one call site of emitCalleeSavedFrameMoves with 2 arguments). Combing with the diff presented here, this patch is actually a NFC one. So I don't think adding a test will be necessary here.
A spin-off question might be: Why was emitCalleeSavedFrameMoves with 4 arguments got exposed as virtual function at the first place if no one is using it?

Could you check the version control history of the function? Perhaps it was added for some use at some point, but that use is no longer needed and it could now be removed?

It was first introduced in https://reviews.llvm.org/D79978.

Ah, thanks for the pointer!

emitCalleeSavedFrameMoves with 4 arguments was not used outside lib/Target in that particular patch and I doubt anyone (lib/CodeGen) has used it ever since then.
I can send a patch regarding this matter if that's appropriate.

Yep, sounds good to me. Please do!

@myhsu (or someone else with M68k familiarity) - the virtual function fix here is a semantic change (previously whatever was calling the virtual function would not have been getting the implementation it is now getting). Is there any testing that could be added to demonstrate that this semantic change is correct/avoid the regression/test the codepath that is missing coverage?

@myhsu Ping on this question ^

This might not be the right place to ask, but I accidentally found that no one outside lib/Target is actually using emitCalleeSavedFrameMoves with 4 arguments (please correct me if I'm wrong. I only found one call site of emitCalleeSavedFrameMoves with 2 arguments). Combing with the diff presented here, this patch is actually a NFC one. So I don't think adding a test will be necessary here.
A spin-off question might be: Why was emitCalleeSavedFrameMoves with 4 arguments got exposed as virtual function at the first place if no one is using it?

Could you check the version control history of the function? Perhaps it was added for some use at some point, but that use is no longer needed and it could now be removed?

It was first introduced in https://reviews.llvm.org/D79978.

Ah, thanks for the pointer!

emitCalleeSavedFrameMoves with 4 arguments was not used outside lib/Target in that particular patch and I doubt anyone (lib/CodeGen) has used it ever since then.
I can send a patch regarding this matter if that's appropriate.

Yep, sounds good to me. Please do!

Sorry for the delay, I'd just submitted https://reviews.llvm.org/D103328