Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

[missed optimization opportunity] clang still generates code for empty loop over an std::map object #50661

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR51694
Status NEW
Importance P enhancement
Reported by Yuri (yuri@tsoft.com)
Reported on 2021-08-31 15:47:34 -0700
Last modified on 2021-08-31 15:48:22 -0700
Version 11.0
Hardware PC FreeBSD
CC blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments testcase.cpp (173 bytes, text/x-c++src)
Blocks
Blocked by
See also
Created attachment 25208
testcase.cpp

The attached testcase iterates through the std::map object with empty for-body.

clang-14 still generates some code in this function when it should be empty.

Replacing the type of the argument with std::vector correctly leads to an empty
function.
Quuxplusone commented 3 years ago

Attached testcase.cpp (173 bytes, text/x-c++src): testcase.cpp