AMDGPU: Don't clobber VCC in MUBUF addr64 emulation
Introducing VCC defs during SIFixSGPRCopies is generally
problematic. Avoid it by starting with the VOP3 form with the general
condition register. This is the easiest to fix instance, but doesn't
solve any specific problems I'm looking at.
[llvm-objdump] Switch between ARM/Thumb based on mapping symbols.
The ARMDisassembler changes allow changing between ARM and Thumb mode
based on the MCSubtargetInfo, rather than the Target, which simplifies
the other changes a bit.
I'm not really happy with adding more target-specific logic to
tools/llvm-objdump/, but there isn't any easy way around it: the logic
in question specifically applies to disassembling an object file, and
that code simply isn't located in lib/Target, at least at the moment.
Differential Revision: https://reviews.llvm.org/D60927
[FileCheck] Stop qualifying expressions as numeric
Stop referring to "numeric expression", using simply the term
"expression" instead. Likewise for numeric operation since operations
are only used in numeric expressions.
Reviewers: jhenderson, jdenny, probinson, arichardson
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D63500
FileCheck: Return parse error w/ Error & Expected
Make use of Error and Expected to bubble up diagnostics and force
checking of errors in the callers.
Reviewers: jhenderson, jdenny, probinson, arichardson
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D63125
[analyzer] exploded-graph-rewriter: Implement a --diff mode.
In this mode the tool would avoid duplicating the contents of the
program state on every node, replacing them with a diff-like dump
of changes that happened on that node.
This is useful because most of the time we only interested in whether
the effect of the statement was modeled correctly. A diffed graph would
also be much faster to load and navigate, being much smaller than
the original graph.
The diffs are computed "semantically" as opposed to plain text diffs.
I.e., the diff algorithm is hand-crafted separately for every state trait,
taking the underlying data structures into account. This is especially nice
for Environment because textual diffs would have been terrible.
On the other hand, it requires some boilerplate to implement.
Differential Revision: https://reviews.llvm.org/D62761
[analyzer] exploded-graph-rewriter: Fix escaping StringRegions.
Quotes around StringRegions are now escaped and unescaped correctly,
producing valid JSON.
Additionally, add a forgotten escape for Store values.
Differential Revision: https://reviews.llvm.org/D63519
[analyzer] Fix JSON dumps for store clusters.
Include a unique pointer so that it was possible to figure out if it's
the same cluster in different program states. This allows comparing
dumps of different states against each other.
Differential Revision: https://reviews.llvm.org/D63362
[analyzer] Fix JSON dumps for location contexts.
Location context ID is a property of the location context, not of an item
within it. It's useful to know the id even when there are no items
in the context, eg. for the purposes of figuring out how did contents
of the Environment for the same location context changed across states.
Differential Revision: https://reviews.llvm.org/D62754
[analyzer] NFC: Change evalCall() to provide a CallEvent.
This changes the checker callback signature to use the modern, easy to
use interface. Additionally, this unblocks future work on allowing
checkers to implement evalCall() for calls that don't correspond to any
call-expression or require additional information that's only available
as part of the CallEvent, such as C++ constructors and destructors.
Differential Revision: https://reviews.llvm.org/D62440
[analyzer] DeadStores: Add a crude suppression files generated by DriverKit IIG.
IIG is a replacement for MIG in DriverKit: IIG is autogenerating C++ code.
Suppress dead store warnings on such code, as the tool seems to be producing
them regularly, and the users of IIG are not in position to address these
warnings, as they don't control the autogenerated code. IIG-generated code
is identified by looking at the comments at the top of the file.
Differential Revision: https://reviews.llvm.org/D63118
[analyzer] RetainCount: Add support for OSRequiredCast().
It's a new API for custom RTTI in Apple IOKit/DriverKit framework that is
similar to OSDynamicCast() that's already supported, but crashes instead of
returning null (and therefore causing UB when the cast fails unexpectedly).
Kind of like cast_or_null<> as opposed to dyn_cast_or_null<> in LLVM's RTTI.
Historically, RetainCountChecker was responsible for modeling OSDynamicCast.
This is simply an extension of the same functionality.
Differential Revision: https://reviews.llvm.org/D63117
[DAGCombine] Use ConstantSDNode::getAPIntValue() instead of getZExtValue().
Use getAPIntValue() in a few more places. Most of the time getZExtValue() is fine, but
occasionally there's fuzzed code or someone decides to create i65536 or something.....
[mips] Add (GPR|PTR)_64 predicates to PseudoReturn64 and PseudoIndirectHazardBranch64
This patch is one of a series of patches. The goal is to make P5600
scheduler model complete and turn on the `CompleteModel` flag.
[Util] Add a helper script for converting -print-before-all output into a file based
Simple little utility which takes a opt logfile generated with "opt -print-before-all
-print-module-scope -o /dev/null <args> 2&>1", and splits into a series of individual
"chunk-X.ll" files. The intended purpose is to help automate one step in failure
The imagined workflow is:
New crasher bug reported against clang or other frontend
Frontend run with -emit-llvm equivalent and manually confirmed that opt -O2 <emit.ll>
Run this splitter script
Manually map pass name to invocation command (next on the to automate list)
Run bugpoint on last chunk file + manual command
I chose to dump every chunk rather than only the last since miscompile debugging
frequently requires either manual step by step reduction, or cross feeding IR into
different compiler versions. Not an immediate target, but there may be applications.
Differential Revision: https://reviews.llvm.org/D63461
LFTR for multiple exit loops
Teach IndVarSimply's LinearFunctionTestReplace transform to handle multiple exit loops.
LFTR does two key things 1) it rewrites (all) exit tests in terms of a common IV
potentially eliminating one in the process and 2) it moves any offset/indexing/f(i) style
logic out of the loop.
This turns out to actually be pretty easy to implement. SCEV already has all the
information we need to know what the backedge taken count is for each individual exit. (We
use that when computing the BE taken count for the loop as a whole.) We basically just
need to iterate through the exiting blocks and apply the existing logic with the exit
specific BE taken count. (The previously landed NFC makes this super obvious.)
I chose to go ahead and apply this to all loop exits instead of only latch exits as
originally proposed. After reviewing other passes, the only case I could find where LFTR
form was harmful was LoopPredication. I've fixed the latch case, and guards aren't LFTRed
anyways. We'll have some more work to do on the way towards widenable_conditions, but
that's easily deferred.
I do want to note that I added one bit after the review. When running tests, I saw a new
failure (no idea why didn't see previously) which pointed out LFTR can rewrite a constant
condition back to a loop varying one. This was theoretically possible with a single exit,
but the zero case covered it in practice. With multiple exits, we saw this happening in
practice for the eliminate-comparison.ll test case because we'd compute a ExitCount for
one of the exits which was guaranteed to never actually be reached. Since LFTR ran after
[4 lines not shown]
[Process] Remove unused field from HistoryThread
These fields are unused and have been since their inception, from what
I can tell.
Reviewers: compnerd, JDevlieghere, davide, labath
Subscribers: kubamracek, lldb-commits
Differential Revision: https://reviews.llvm.org/D63357
[MemorySSA] Cleanup trivial phis.
This is unfortunately needed for correctness, if we are to extend the tolerance of the
update API to the way simple loop unswitch is doing cloning.
In simple loop unswitch (as opposed to loop unswitch), not all blocks are cloned. This can
create unreachable cloned blocks (no predecessor), which are later cleaned up.
In MemorySSA, the APIs for supporting these kind of updates (clone + update exit blocks),
make certain assumption on the integrity of the CFG. When cloning, if something was not
cloned, it's values in MemorySSA default to LiveOnEntry. When updating exit blocks, it is
safe to assume that we can first insert phis in the blocks merging two clones, then add
additional phis in the IDF of the blocks that received phis. This no longer holds true if
one of the clones being merged comes from an unreachable block. We'd conservatively need
to add all phis before filling in their incoming definitions. In practice this restriction
can be relaxed if we clean up trivial phis after the first round of insertion.
Subscribers: jlebar, Prazek, llvm-commits
Differential Revision: https://reviews.llvm.org/D63354
[MemorySSA] Use GraphDiff info when computing IDF.
When computing IDF for insert updates, ensure we use the snapshot CFG offered by
Caught by D63389.
Reviewers: kuhar, george.burgess.iv
Subscribers: jlebar, Prazek, llvm-commits, Szelethus
Differential Revision: https://reviews.llvm.org/D63443
[clang][AST] ASTNameGenerator: A refactoring of CodegenNameGeneratorImpl (NFC).
This is a NFC refactor move of CodegenNameGeneratorImpl from clang::Index to
clang:AST (and rename to ASTNameGenerator). The purpose is to make the
highlevel mangling code more reusable inside of clang (say in places like clang
FrontendAction). This does not affect anything in CodegenNameGenerator, except
that CodegenNameGenerator will now use ASTNameGenerator (in AST).
Differential Revision: https://reviews.llvm.org/D63535
AMDGPU: Fix folding immediate into readfirstlane through reg_sequence
The def instruction for the vreg may not match, because it may be
folding through a reg_sequence. The assert was overly conservative and
not necessary. It's not actually important if DefMI really defined the
register, because the fold that will be done cares about the def of
the value that will be folded.
For some reason copies aren't making it through the reg_sequence,
although they should.
[LFTR] Rename variable to minimize confusion [NFC]
(Recommit of r363293 which was reverted when a dependent patch was.)
As pointed out by Nikita in D62625, BackedgeTakenCount is generally used to refer to the
backedge taken count of the loop. A conditional backedge taken count - one which only
applies if a particular exit is taken - is called a ExitCount in SCEV code, so be
[pstl] Remove warnings in tests and headers
Mostly unused parameter, unused local typedefs and shadowed declarations.
This massaging it necessary if we want to be able to run the tests under
the libc++ lit configuration.
Reapply "AMDGPU: Add ds_gws_init / ds_gws_barrier intrinsics"
This reapplies r363678, using the correct chain for the CopyToReg for
v0. glueCopyToM0 counterintuitively changes the operands of the
[llvm-readobj] Match GNU output for DT_RPATH and DT_RUNPATH when dumping dynamic symbol
Reviewers: jhenderson, grimar, MaskRay, rupprecht, espindola
Subscribers: emaste, nemanjai, arichardson, kbarton, llvm-commits
Differential Revision: https://reviews.llvm.org/D63347
[SCEV] Revise a method description to match actual behavior [NFC]
Reword the ScalarEvolution::getExitCount comment in the same terminology as used by
getBackedgeTakenCount since they're equivelent for single exit loops. Also, strengthen
the comment to indicate exiting on the exact iteration specified is guaranteed. Several
transforms implicitly rely on this; and the actual implementation checks for it (via
dominating latch checks). So, spell out the guarantee in the comment.