[llvm-bugs] [Bug 42603] New: clang++ miss optimization at -O2 in OpenJDK’s stubRoutine.cpp
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Jul 12 09:22:29 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42603
Bug ID: 42603
Summary: clang++ miss optimization at -O2 in OpenJDK’s
stubRoutine.cpp
Product: clang
Version: 8.0
Hardware: PC
OS: OpenBSD
Status: NEW
Severity: normal
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: bsdkurt at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Summary:
Building OpenJDK 11u on OpenBSD/i386 in fastdebug mode fails due to miss
optimization of stubRoutines.cpp at -O2 or -O3. Building this file with -O1
corrects the issue.
Details:
When OpenJDK is built in fastdebug mode on OpenBSD/i386, some test code is
enabled in stubRoutines.cpp (test_arraycopy_func). This test code aligns a
pointer to 8 bytes (align_up), then calls another function via a pointer that
was passed as an argument to test_arraycopy_func. The called function checks
the alignment (is_aligned). When compiled at -O2 or higher the align_up has
been optimized away incorrectly and the called method fails its alignment
check. Reducing optimization level to -O1 results in correct output where the
pointer has been aligned.
I have bisected the compile at -O2 and found that the output works up to pass
5170 but fails if higher. However, in order to do this I had to apply the patch
from bug 42584:
https://bugs.llvm.org/attachment.cgi?id=22229
The preprocessed source for this crash is 11MB and is too big to attach (even
when compressed). The preprocessed source and build script can be downloaded
here:
http://www.intricatesoftware.com/distfiles/clang++.openjdk.stubRoutines.tar.gz
Here is some of the BISECT context. Including pass 5171 results in the miss
optimization:
BISECT: running pass (5116) Simplify the CFG on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5117) Combine redundant instructions on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5118) Tail Call Elimination on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5119) Simplify the CFG on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5120) Reassociate expressions on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5121) Simplify the CFG on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5122) Combine redundant instructions on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5123) MergedLoadStoreMotion on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5124) Global Value Numbering on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5125) MemCpy Optimization on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5126) Sparse Conditional Constant Propagation on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5127) Bit-Tracking Dead Code Elimination on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5128) Combine redundant instructions on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5129) Jump Threading on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5130) Value Propagation on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5131) Dead Store Elimination on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5132) Aggressive Dead Code Elimination on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5133) Simplify the CFG on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5134) Combine redundant instructions on function
(_Z8align_upImiET_S0_T0_)
BISECT: running pass (5135) Remove unused exception handling info on SCC
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5136) Function Integration/Inlining on SCC
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5137) Deduce function attributes on SCC
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5138) SROA on function (_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5139) Early CSE w/ MemorySSA on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5140) Speculatively execute instructions if target has
divergent branches on function (_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5141) Jump Threading on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5142) Value Propagation on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5143) Simplify the CFG on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5144) Combine redundant instructions on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5145) Tail Call Elimination on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5146) Simplify the CFG on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5147) Reassociate expressions on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5148) Simplify the CFG on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5149) Combine redundant instructions on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5150) MergedLoadStoreMotion on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5151) Global Value Numbering on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5152) MemCpy Optimization on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5153) Sparse Conditional Constant Propagation on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5154) Bit-Tracking Dead Code Elimination on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5155) Combine redundant instructions on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5156) Jump Threading on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5157) Value Propagation on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5158) Dead Store Elimination on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5159) Aggressive Dead Code Elimination on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5160) Simplify the CFG on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5161) Combine redundant instructions on function
(_Z8align_upIhiEPT_S1_T0_)
BISECT: running pass (5162) Remove unused exception handling info on SCC
(_ZL19test_arraycopy_funcPhi)
BISECT: running pass (5163) Function Integration/Inlining on SCC
(_ZL19test_arraycopy_funcPhi)
BISECT: running pass (5164) Deduce function attributes on SCC
(_ZL19test_arraycopy_funcPhi)
BISECT: running pass (5165) SROA on function (_ZL19test_arraycopy_funcPhi)
BISECT: running pass (5166) Early CSE w/ MemorySSA on function
(_ZL19test_arraycopy_funcPhi)
BISECT: running pass (5167) Speculatively execute instructions if target has
divergent branches on function (_ZL19test_arraycopy_funcPhi)
BISECT: running pass (5168) Jump Threading on function
(_ZL19test_arraycopy_funcPhi)
BISECT: running pass (5169) Value Propagation on function
(_ZL19test_arraycopy_funcPhi)
BISECT: running pass (5170) Simplify the CFG on function
(_ZL19test_arraycopy_funcPhi)
BISECT: NOT running pass (5171) Combine redundant instructions on function
(_ZL19test_arraycopy_funcPhi)
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190712/c46dcaac/attachment-0001.html>
More information about the llvm-bugs
mailing list