Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fix of warnings raised by -Wreturn-std-move and -Wself-assign-overloaded #2669

Merged
merged 1 commit into from
Feb 24, 2019
Merged

Minor fix of warnings raised by -Wreturn-std-move and -Wself-assign-overloaded #2669

merged 1 commit into from
Feb 24, 2019

Conversation

junrushao
Copy link
Member

@junrushao junrushao commented Feb 24, 2019

My clang keeps complaining about it.

Update:

For example,

/path/to/tvm/src/relay/pass/type_infer.cc:727:14: warning: local variable 'func' will be copied despite being returned by name [-Wreturn-std-move]
      return func;
             ^~~~
/path/to/tvm/src/relay/pass/type_infer.cc:727:14: note: call 'std::move' explicitly to avoid copying
      return func;
             ^~~~
             std::move(func)

The reason for this is that copy elision is not always turned on, so in this case, std::move is not a pessimization.

See this thraed in LLVM for details.

@tqchen
Copy link
Member

tqchen commented Feb 24, 2019

hmm, I am not sure, in theory these can be optimized by copy elision and we should not explicit move

@junrushao
Copy link
Member Author

I feel weird as well, but clang-7 keeps asking me to explicitly write std::move.

@junrushao
Copy link
Member Author

Looks like “-Wreturn-std-move” reports stuff that are not eligible for RVO

@tqchen tqchen merged commit 4ba3047 into apache:master Feb 24, 2019
@tqchen
Copy link
Member

tqchen commented Feb 24, 2019

OK, I will merge them in for now, Thanks @junrushao1994

@yzhliu yzhliu mentioned this pull request Mar 2, 2019
28 tasks
wweic pushed a commit to neo-ai/tvm that referenced this pull request Mar 9, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Mar 12, 2019
wweic pushed a commit to neo-ai/tvm that referenced this pull request Mar 12, 2019
@junrushao junrushao deleted the fix-Wreturn-std-move branch January 6, 2022 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants