[PATCH] D133193: [GlobalOpt] Fix debug variance problem in hasOnlyColdCalls
Mikael Holmén via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 2 02:51:48 PDT 2022
uabelho created this revision.
uabelho added reviewers: aeubanks, nikic, syzaara.
Herald added subscribers: ormris, bjope, hiraditya, nemanjai.
Herald added a project: All.
uabelho requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
hasOnlyColdCalls skipped over calls to intrinsics, but it did so after
checking the linkage of the called function. This meant that the presence
of a call to a debug intrinsic could affect the outcome of the
optimization.
In my original reproducer (for an out of tree target) it was particularly
interesting, because the actual IR after GlobalOpt was not different with
debug instrinsics present, so -print-after-all printouts didn't show
anything there.
However, without debuginfo, GlobalOpt went further and ran
BlockFrequencyAnalysis and (more importanly) LoopAnalysis, and later on in
the pipeline, instcombine behaved in different ways when LoopInfo was
present.
So a call to a dbg.declare prevented running LoopAnalysis in
GlobalOpt, which later prevented InstCombine from doing an optimization.
The dbg-intrinsic-loopanalysis.ll testcase tries to expose this.
Then I also noted that adding a dbg.declare actually made the existing
testcase colccc_coldsites.ll generate different code, so I modified that
to now test it behaves the same way with and without the dbg.declare.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D133193
Files:
llvm/lib/Transforms/IPO/GlobalOpt.cpp
llvm/test/Transforms/GlobalOpt/PowerPC/coldcc_coldsites.ll
llvm/test/Transforms/GlobalOpt/dbg-intrinsic-loopanalysis.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133193.457540.patch
Type: text/x-patch
Size: 6408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220902/027f9d82/attachment.bin>
More information about the llvm-commits
mailing list