LLVM/llvm 363905compiler-rt/trunk/lib/fuzzer/dataflow DataFlow.cpp, compiler-rt/trunk/test/fuzzer only-some-bytes.test OnlySomeBytesTest.cpp

[libFuzzer] ensure that DFT and autofocus works for C++ (mangled) functions

LLVM/llvm 363904llvm/trunk/lib/Target/AMDGPU SIInstrInfo.cpp, llvm/trunk/test/CodeGen/AMDGPU mubuf-legalize-operands.mir

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/llvm 363903llvm/trunk/include/llvm/Object ELFObjectFile.h, llvm/trunk/lib/Target/ARM/Disassembler ARMDisassembler.cpp

[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

LLVM/llvm 363902llvm/trunk/lib/Target/AMDGPU AMDGPUSubtarget.h SIISelLowering.cpp

AMDGPU: Consolidate some getGeneration checks

This is incomplete, and ideally these would all be removed, but it's
better to localize them to the subtarget first with comments about
what they're for.

LLVM/llvm 363901llvm/trunk/docs/CommandGuide FileCheck.rst, llvm/trunk/include/llvm/Support FileCheck.h

[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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63500

LLVM/llvm 363900llvm/trunk/include/llvm/Support FileCheck.h, llvm/trunk/lib/Support FileCheck.cpp

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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63125

LLVM/llvm 363899llvm/trunk/lib/Target/AMDGPU AMDGPUISelDAGToDAG.cpp SIInstrInfo.td, llvm/trunk/test/CodeGen/AMDGPU shrink-add-sub-constant.ll sminmax.v2i16.ll

AMDGPU: Undo sub x, c canonicalization for v2i16

Should avoid regression from D62341

LLVM/llvm 363898cfe/trunk/test/Analysis/exploded-graph-rewriter environment_diff.dot store_diff.dot, cfe/trunk/utils/analyzer exploded-graph-rewriter.py

[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

LLVM/llvm 363897cfe/trunk/lib/StaticAnalyzer/Core RegionStore.cpp, cfe/trunk/test/Analysis/exploded-graph-rewriter escapes.c lit.local.cfg

[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

LLVM/llvm 363896cfe/trunk/lib/StaticAnalyzer/Core RegionStore.cpp, cfe/trunk/test/Analysis dump_egraph.cpp expr-inspection.c

[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

LLVM/llvm 363895cfe/trunk/lib/Analysis AnalysisDeclContext.cpp, cfe/trunk/lib/StaticAnalyzer/Core Environment.cpp ExprEngine.cpp

[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

LLVM/llvm 363894cfe/trunk/lib/StaticAnalyzer/Core DynamicTypeMap.cpp, cfe/trunk/test/Analysis dump_egraph.cpp

[analyzer] Fix JSON dumps for dynamic type information.

They're now valid JSON.

Differential Revision: https://reviews.llvm.org/D62716

LLVM/llvm 363893cfe/trunk/lib/StaticAnalyzer/Checkers ChrootChecker.cpp BuiltinFunctionChecker.cpp, cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker RetainCountChecker.cpp

[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

LLVM/llvm 363892cfe/trunk/lib/StaticAnalyzer/Checkers DeadStoresChecker.cpp, cfe/trunk/test/Analysis deadstores-driverkit.cpp os_object_base.h

[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

LLVM/llvm 363891cfe/trunk/lib/Analysis RetainSummaryManager.cpp, cfe/trunk/test/Analysis osobject-retain-release.cpp os_object_base.h

[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

LLVM/llvm 363890cfe/trunk/lib/Headers avx512vlintrin.h avx512bwintrin.h

[X86] Correct the __min_vector_width__ attribute on a few intrinsics.

LLVM/llvm 363889clang-tools-extra/trunk/clangd Protocol.h, clang-tools-extra/trunk/clangd/test fixits-duplication.test

[clangd] Include the diagnostics's code when comparing diagnostics

Summary: This fixes https://github.com/clangd/clangd/issues/60

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63316

LLVM/llvm 363888llvm/trunk/test/CodeGen/AMDGPU shrink-add-sub-constant.ll

AMDGPU: Add baseline test for vector sub x, c canonicalization

This will catch regressions from D62341, and show improvements from a
future patch to fix them.

LLVM/llvm 363887llvm/trunk/lib/CodeGen/SelectionDAG DAGCombiner.cpp

[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.....

LLVM/llvm 363886llvm/trunk/lib/Target/Mips Mips32r6InstrInfo.td Mips64r6InstrInfo.td, llvm/trunk/test/MC/Disassembler/Mips/mips32r6 valid-mips32r6.txt valid-mips32r6-el.txt

[mips] Mark the `lwupc` instruction as MIPS64 R6 only

The "The MIPS64 Instruction Set Reference Manual" [1] states that
the `lwupc` is MIPS64 Release 6 only. It should not be supported
for 32-bit CPUs.


LLVM/llvm 363885llvm/trunk/lib/Target/Mips Mips64InstrInfo.td

[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.

LLVM/llvm 363884llvm/trunk/utils chunk-print-before-all.py

[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

LLVM/llvm 363883llvm/trunk/lib/Transforms/Scalar IndVarSimplify.cpp, llvm/trunk/test/Transforms/IndVarSimplify lftr-multi-exit.ll eliminate-comparison.ll

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]

LLVM/llvm 363882llvm/trunk/test/Transforms/IndVarSimplify eliminate-comparison.ll

[Tests] Autogen a test so that future changes are understandable

LLVM/llvm 363881lldb/trunk/source/Plugins/InstrumentationRuntime/MainThreadChecker MainThreadCheckerRuntime.cpp, lldb/trunk/source/Plugins/InstrumentationRuntime/UBSan UBSanRuntime.cpp

[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

LLVM/llvm 363880llvm/trunk/lib/Analysis MemorySSAUpdater.cpp, llvm/trunk/test/Analysis/MemorySSA simple_loop_unswitch_nontrivial.ll

[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.

Reviewers: george.burgess.iv

Subscribers: jlebar, Prazek, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63354

LLVM/llvm 363879llvm/trunk/lib/Analysis MemorySSAUpdater.cpp

[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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63443

LLVM/llvm 363878cfe/trunk/include/clang/AST Mangle.h, cfe/trunk/include/clang/Index CodegenNameGenerator.h

[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

LLVM/llvm 363877llvm/trunk/lib/Transforms/Scalar IndVarSimplify.cpp

[LFTR] Stylistic cleanup as suggested in last review comment of D62939 [NFC]

(Resumbit of r363292 which was reverted along w/an earlier patch)

LLVM/llvm 363876llvm/trunk/lib/Target/AMDGPU SIFoldOperands.cpp SIInstrInfo.cpp, llvm/trunk/test/CodeGen/AMDGPU fold-readlane.mir constant-address-space-32bit.ll

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.

LLVM/llvm 363875llvm/trunk/lib/Transforms/Scalar IndVarSimplify.cpp

[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 
consistent here.

LLVM/llvm 363874llvm/trunk/lib/Target/AArch64 AArch64AsmPrinter.cpp, llvm/trunk/test/CodeGen/AArch64 hwasan-check-memaccess.ll

hwasan: Shrink outlined checks by 1 instruction.

Turns out that we can save an instruction by folding the right shift into
the compare.

Differential Revision: https://reviews.llvm.org/D63568

LLVM/llvm 363873cfe/trunk/include/clang/AST JSONNodeDumper.h, cfe/trunk/lib/AST JSONNodeDumper.cpp

Print whether a generic selection expression is result dependent when dumping the AST to 

LLVM/llvm 363872pstl/trunk/include/pstl/internal parallel_backend_utils.h, pstl/trunk/test/std/algorithms/alg.modifying.operations replace.pass.cpp generate.pass.cpp

[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.

LLVM/llvm 363871cfe/trunk/include/clang/Basic BuiltinsAMDGPU.def, cfe/trunk/test/CodeGenOpenCL builtins-amdgcn.cl

Reapply "r363684: AMDGPU: Add GWS instruction builtins"

LLVM/llvm 363870llvm/trunk/lib/Target/AMDGPU AMDGPUISelDAGToDAG.cpp, llvm/trunk/test/CodeGen/AMDGPU llvm.amdgcn.ds.gws.barrier.ll llvm.amdgcn.ds.gws.init.ll

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
original node.

LLVM/llvm 363869cfe/trunk/include/clang/AST JSONNodeDumper.h, cfe/trunk/lib/AST JSONNodeDumper.cpp

Print out the union field being initialized by an InitListExpr when dumping the AST to 

LLVM/llvm 363868lld/trunk/test/ELF new-dtags.test shared-ppc64.s, llvm/trunk/test/tools/llvm-readobj elf-dynamic-malformed.test elf-dynamic-tags.test

[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

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63347

LLVM/llvm 363867llvm/trunk/include/llvm/Analysis ScalarEvolution.h

[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.

LLVM/llvm 363866cfe/trunk/include/clang/AST JSONNodeDumper.h, cfe/trunk/lib/AST JSONNodeDumper.cpp

Dump the value calculated by a constant expression when dumping the AST to JSON.

LLVM/llvm 363865llvm/trunk/utils/gn/secondary/llvm/lib/CodeGen BUILD.gn

gn build: Merge r363757.

LLVM/llvm 363864llvm/trunk/utils/gn/secondary/clang/unittests/Tooling BUILD.gn

gn build: Merge r363848.

LLVM/llvm 363863llvm/trunk/utils/gn/secondary/clang/test BUILD.gn

gn build: Merge r363846.

LLVM/llvm 363862llvm/trunk/utils/gn/secondary/clang/lib/Headers BUILD.gn

gn build: Merge r363794.

LLVM/llvm 363861llvm/trunk/utils/gn/secondary/clang-tools-extra/clangd/refactor/tweaks BUILD.gn

gn build: Merge r363680.

LLVM/llvm 363860llvm/trunk/utils/gn/secondary/clang-tools-extra/clang-tidy/fuchsia BUILD.gn

gn build: Merge r363712.

LLVM/llvm 363859cfe/trunk/test/AST ast-dump-if-json.cpp

Switching this test to use output generated by script; NFC.

LLVM/llvm 363858llvm/trunk/test/tools/llvm-objdump/X86 disassemble-code-data-mix.s, llvm/trunk/tools/llvm-objdump llvm-objdump.cpp

[llvm-objdump] Remove unnecessary indentation when dumping ELF data.

Reviewers: MaskRay, jhenderson, rupprecht

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D63393

LLVM/llvm 363857cfe/trunk/lib/AST Expr.cpp, cfe/trunk/test/Sema warn-binary-conditional-expression-unused.c

[AST] Fixed extraneous warnings for binary conditional operator

Binary conditional operator gave warnings where ternary operators
did not. They have been fixed to warn similarly to ternary operators.

Link: https://bugs.llvm.org/show_bug.cgi?id=42239

Reviewers: rsmith, aaron.ballman, nickdesaulniers

Reviewed By: rsmith, nickdesaulniers

Subscribers: srhines, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63369

LLVM/llvm 363856llvm/trunk/lib/CodeGen/SelectionDAG TargetLowering.cpp

[TargetLowering] SimplifyDemandedBits - add ANY_EXTEND_VECTOR_INREG support

Move 'lowest' demanded elt -> bitcast fold out of ZERO_EXTEND_VECTOR_INREG into