Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Function called at the end of multiple paths results in different x86_64 assembly than equivalent call after all paths have completed #42268

Open Quuxplusone opened 4 years ago

Quuxplusone commented 4 years ago
Bugzilla Link PR43298
Status NEW
Importance P enhancement
Reported by John Milford (jmunxsys@yahoo.com)
Reported on 2019-09-12 12:41:56 -0700
Last modified on 2019-09-12 12:41:56 -0700
Version trunk
Hardware PC Linux
CC htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments Compiler Explorer C++ Editor #1 Code (1).cpp (708 bytes, application/octet-stream)
Blocks
Blocked by
See also
Created attachment 22490
Code that exhibits the issue

https://godbolt.org/z/37Leg_

Clang trunk (371698) is able to reduce "munge" to the same code as "munge2".
(BTW all versions of gcc, icc, and older clang versions could not.)

However, "munge1" and "munge3" get a slightly longer version that loads and
stores to/from a register instead of using immediates.  As best I can tell
these are all represent equivalent functions and should have the same ASM
representation for a given optimization level.
Quuxplusone commented 4 years ago

Attached Compiler Explorer C++ Editor #1 Code (1).cpp (708 bytes, application/octet-stream): Code that exhibits the issue