SuccessChanges

Changes from Git (git http://labmaster3.local/git/llvm-project.git)

Summary

  1. [clangd] Filter pch related flags coming from the user (details)
  2. [gn build] Port 35d867a790c (details)
  3. [InstCombine] fold fpext into exact integer-to-FP cast (details)
  4. [LAA] Remove one addRuntimeChecks function (NFC). (details)
  5. [mlir] Initialize the Region::container field to nullptr by default (details)
  6. [mlir] Affine dim and symbol checkers: support detached regions (details)
  7. Revert "[LAA] Remove one addRuntimeChecks function (NFC)." (details)
  8. LoopPass.h - remove unnecessary PMStack forward declaration. NFC. (details)
  9. Mangler.h - reduce GlobalValue.h include to forward declaration. NFC. (details)
  10. PassManager.h - remove unused raw_ostream.h include. NFC. (details)
  11. CoverageMapping.h - remove unused StringSet.h include. NFC. (details)
  12. PassInstrumentation.h - reduce TypeName.h include to StringRef forward declaration. NFC. (details)
  13. Recommit "[LAA] Remove one addRuntimeChecks function (NFC)." (details)
  14. [InstCombine] matchOrConcat - match BITREVERSE (details)
  15. [CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC (details)
  16. [CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC (details)
  17. [InstCombine] canonicalize bitcast after insertelement into undef (details)
  18. Local.h - remove unused forward declaration. NFC. (details)
  19. LoopUtils.h - remove unused forward declarations. NFC. (details)
  20. CodeMetrics.cpp - remove unused includes. NFC. (details)
  21. [LAA] Move runtime-check generation to Transforms/Utils/loopUtils (NFC) (details)
  22. [gcov] Fix .gcda decoding and support GCC 8, 9 and 10 (details)
  23. [gcov] Don't skip leading zeros when reading a string (details)
  24. [AssumeBundles] Prevent generation of some redundant assumes (details)
  25. [gcov] Temporarily unsupport host-byteorder-big-endian (details)
  26. [compiler-rt][test] Add feature host-byteorder-big-endian (details)
  27. [gcov] Temporarily unsupport host-byteorder-big-endian (details)
Commit 35d867a790c2bcf2008b2ee1895ae8af2793b797 by kadircet
[clangd] Filter pch related flags coming from the user

Summary:
PCH format is unstable, hence using a preamble built with a different
version of clang (or even worse, a different compiler) might result in
unexpected behaviour.

PCH creation on the other hand is something clangd wouldn't want to perform, as
it doesn't generate any output files.

This patch makes sure clangd drops any PCH related compile commands after
parsing the command line args.

Fixes https://github.com/clangd/clangd/issues/248

Reviewers: sammccall

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

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79669
The file was modifiedclang-tools-extra/clangd/unittests/CMakeLists.txt
The file was modifiedclang-tools-extra/clangd/Compiler.cpp
The file was addedclang-tools-extra/clangd/unittests/CompilerTests.cpp
Commit 1d2c1fcf41d32f8f6db312f8e0262291cda4002b by llvmgnsyncbot
[gn build] Port 35d867a790c
The file was modifiedllvm/utils/gn/secondary/clang-tools-extra/clangd/unittests/BUILD.gn
Commit a62533c29f842ba39c6e47a09b59bb0ae2dcc31b by spatel
[InstCombine] fold fpext into exact integer-to-FP cast

We can combine a floating-point extension cast with a conversion
from integer if we know the earlier cast is exact.

This is an optimization suggested in PR36617:
https://bugs.llvm.org/show_bug.cgi?id=36617#c19

However, this patch does not change the example suggested there.
This patch only uses the existing analysis to handle cases where
the integer source value magnitude is narrower than the
intermediate FP mantissa (guarantees that the conversion to FP is
exact). Follow-up patches to the analysis function can enable
more cases.

Differential Revision: https://reviews.llvm.org/D79116
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
The file was modifiedllvm/test/Transforms/InstCombine/fpextend.ll
Commit c28114c8ffde705d7e16cd4c065fd23269661c81 by flo
[LAA] Remove one addRuntimeChecks function (NFC).

In order to reduce the API surface area (preparation for D78460), remove
a addRuntimeChecks() function and do the additional check in the single
caller.

Reviewers: Ayal, anemet

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D79679
The file was modifiedllvm/include/llvm/Analysis/LoopAccessAnalysis.h
The file was modifiedllvm/lib/Analysis/LoopAccessAnalysis.cpp
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit c71101d9efced2291d46992d32dc88577aef2cf6 by zinenko
[mlir] Initialize the Region::container field to nullptr by default

Region has a default constructor that is called when a region is constructed
while an operation is being created, and therefore before the region can be
attached to this operation. The `container` field is uninitialized, which makes
it impossible to check programmatically if a Region is attached to an operation
or not, leading to sly memory errors when this field is read. Initialize it to
nullptr by default and thus make sure one can check if a region is attached to
an operation or not.
The file was modifiedmlir/include/mlir/IR/Region.h
Commit 11c4fc6c4844f9bea694b96b84ad07bde9d39e19 by zinenko
[mlir] Affine dim and symbol checkers: support detached regions

Functions checking whether an SSA value is a valid dimension or symbol for
affine operations can be called on values defined in a detached region (a
region that is not yet attached to an operation), for example, during parsing
or operation construction. These functions will attempt to uncondtionally
dereference a pointer to the parent operation of a region, which may be null
(as fixed by the previous commit, uninitialized before that). Since one cannot
know to which operation a region will be attached, conservatively this
operation would not be a valid affine scope and act accordingly, instead of
crashing.
The file was modifiedmlir/lib/Dialect/Affine/IR/AffineOps.cpp
Commit fc44617f28847417e55836193bbe8e9c3f09eca9 by flo
Revert "[LAA] Remove one addRuntimeChecks function (NFC)."

This reverts commit c28114c8ffde705d7e16cd4c065fd23269661c81.

This causes some bots to fail:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-android/builds/30596/steps/build%20android%2Faarch64/logs/stdio
The file was modifiedllvm/lib/Analysis/LoopAccessAnalysis.cpp
The file was modifiedllvm/include/llvm/Analysis/LoopAccessAnalysis.h
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit af93311a8c21413875c16cfaf920ae2586b59b84 by llvm-dev
LoopPass.h - remove unnecessary PMStack forward declaration. NFC.

We have to include LegacyPassManagers.h where its defined.
The file was modifiedllvm/include/llvm/Analysis/LoopPass.h
Commit 1df85dd4e94e0693b161eda4bc007379303110da by llvm-dev
Mangler.h - reduce GlobalValue.h include to forward declaration. NFC.

Exposes implicit dependency in ModuleSymbolTable.h - added missing Module forward declaration.
The file was modifiedllvm/include/llvm/Object/ModuleSymbolTable.h
The file was modifiedllvm/include/llvm/IR/Mangler.h
Commit 741778faedf678c866fa6a44ec4270bc62c5a27c by llvm-dev
PassManager.h - remove unused raw_ostream.h include. NFC.
The file was modifiedllvm/include/llvm/IR/PassManager.h
Commit d7f1eafd03bce220af80c15254c92c0c9304b880 by llvm-dev
CoverageMapping.h - remove unused StringSet.h include. NFC.
The file was modifiedllvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
Commit 0dd42e5fd32fb609a9333d73619c905d1a5e6cd4 by llvm-dev
PassInstrumentation.h - reduce TypeName.h include to StringRef forward declaration. NFC.
The file was modifiedllvm/include/llvm/IR/PassInstrumentation.h
Commit 96c63f544f6825d4fa378c374139b09455c15d0c by flo
Recommit "[LAA] Remove one addRuntimeChecks function (NFC)."

The failing assertion has been fixed and the problematic test case has
been added.

This reverts the revert commit fc44617f28847417e55836193bbe8e9c3f09eca9.
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
The file was modifiedllvm/include/llvm/Analysis/LoopAccessAnalysis.h
The file was modifiedllvm/lib/Analysis/LoopAccessAnalysis.cpp
The file was addedllvm/test/Transforms/LoopVectorize/runtime-check-needed-but-empty.ll
Commit bab44a698e821292ecce4ee01a61964a0a40c33e by llvm-dev
[InstCombine] matchOrConcat - match BITREVERSE

Fold or(zext(bitreverse(x)),shl(zext(bitreverse(y)),bw/2) -> bitreverse(or(zext(x),shl(zext(y),bw/2))

Practically this is the same as the BSWAP pattern so we might as well handle it.
The file was modifiedllvm/test/Transforms/InstCombine/or-concat.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Commit bcc5ed7b24e921c8902d0d0db614576bd249f128 by spatel
[CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC

This test would break with the proposed change to IR canonicalization
in D79171. The raw unoptimized IR from clang is massive, so I've
replaced -instcombine with -mem2reg to make it more manageable,
but still be unlikely to break with unrelated changed to optimization.
The file was modifiedclang/test/CodeGen/aarch64-neon-fp16fml.c
Commit d02b3aba37d9a18691669392ff26ec28b51741f5 by spatel
[CodeGen] fix test to be (mostly) independent of LLVM optimizer; NFC

This test would break with the proposed change to IR canonicalization
in D79171.

The test tried to do the right thing by only using -mem2reg with opt,
but it was using -O3 before that step, so the opt part was meaningless.
The file was modifiedclang/test/CodeGen/arm-mve-intrinsics/cplusplus.cpp
Commit 856cc60bc1ad07b5cba1ab81160c1c3ef8ff4c23 by spatel
[InstCombine] canonicalize bitcast after insertelement into undef

We have a transform in the opposite direction only for the x86 MMX type,
Other types are not handled either way before this patch.

The motivating case from PR45748:
https://bugs.llvm.org/show_bug.cgi?id=45748
...is the last test diff. In that example, we are triggering an existing
bitcast transform, so we reduce the number of casts, and that should give
us the ideal x86 codegen.

Differential Revision: https://reviews.llvm.org/D79171
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
The file was modifiedllvm/test/Transforms/InstCombine/bitcast-vec-canon.ll
Commit e303b926203da509346d86e00a78880240aa78ff by llvm-dev
Local.h - remove unused forward declaration. NFC.
The file was modifiedllvm/include/llvm/Transforms/Utils/Local.h
Commit 4874f263c858bfeed45ac3230ddef398cf1fc5dc by llvm-dev
LoopUtils.h - remove unused forward declarations. NFC.
The file was modifiedllvm/include/llvm/Transforms/Utils/LoopUtils.h
Commit d5a2870a6e99d8fe4ae03283ed21a56abafe1e3c by llvm-dev
CodeMetrics.cpp - remove unused includes. NFC.
The file was modifiedllvm/lib/Analysis/CodeMetrics.cpp
Commit 8528186b9bfcb0e422a1046871f855edcf3389f6 by flo
[LAA] Move runtime-check generation to Transforms/Utils/loopUtils (NFC)

Currently LAA's uses of ScalarEvolutionExpander blocks moving the
expander from Analysis to Transforms. Conceptually the expander does not
fit into Analysis (it is only used for code generation) and
runtime-check generation also seems to be better suited as a
transformation utility.

Reviewers: Ayal, anemet

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D78460
The file was modifiedllvm/lib/Analysis/LoopAccessAnalysis.cpp
The file was modifiedllvm/lib/Transforms/Utils/LoopVersioning.cpp
The file was modifiedllvm/lib/Transforms/Utils/LoopUtils.cpp
The file was modifiedllvm/include/llvm/Transforms/Utils/LoopUtils.h
The file was modifiedllvm/include/llvm/Analysis/LoopAccessAnalysis.h
The file was modifiedllvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Commit 2d00eb17cac40d96f357490d005c4601271bbba3 by maskray
[gcov] Fix .gcda decoding and support GCC 8, 9 and 10

GCDAProfiling.c unnecessarily writes function names to .gcda files.
GCC 4.2 gcc/libgcov.c (now renamed to libgcc/libgcov*) did not write function
names. gcov-7 (compatible) crashes on .gcda produced by libclang_rt.profile
rL176173 realized the problem and introduced a mode to remove function
names.

llvm-cov code apparently takes GCDAProfiling.c output format as truth
and tries to decode function names.  Additionally, llvm-cov tries to
decode tags in certain order which does not match libgcov emitted .gcda
files.

This patch fixes the .gcda decoder and makes it work with GCC 8 and 9
(10 is compatible with 9). Note, line statistics are broken and not
fixed by this patch.

Add test/tools/llvm-cov/gcov-{4.7,8,9}.c to test compatibility.
The file was modifiedllvm/lib/ProfileData/GCOV.cpp
The file was removedllvm/test/tools/llvm-cov/gcov47_compatibility.cpp
The file was addedllvm/test/tools/llvm-cov/Inputs/gcov-4.7.gcda
The file was modifiedllvm/test/tools/llvm-cov/llvm-cov.test
The file was modifiedllvm/tools/llvm-cov/gcov.cpp
The file was removedllvm/test/tools/llvm-cov/Inputs/gcov47_compatibility.gcno
The file was addedllvm/test/tools/llvm-cov/Inputs/gcov-9.gcda
The file was modifiedllvm/include/llvm/ProfileData/GCOV.h
The file was modifiedllvm/lib/ProfileData/SampleProfReader.cpp
The file was addedllvm/test/tools/llvm-cov/Inputs/gcov-8.gcno
The file was addedllvm/test/tools/llvm-cov/gcov-4.7.c
The file was removedllvm/test/tools/llvm-cov/Inputs/gcov47_compatibility.gcda
The file was addedllvm/test/tools/llvm-cov/Inputs/gcov-8.gcda
The file was addedllvm/test/tools/llvm-cov/gcov-8.c
The file was addedllvm/test/tools/llvm-cov/gcov-9.c
The file was addedllvm/test/tools/llvm-cov/Inputs/gcov-4.7.gcno
The file was addedllvm/test/tools/llvm-cov/Inputs/gcov-9.gcno
Commit 7f22ceeaae74911d97773644a1058659f329887e by maskray
[gcov] Don't skip leading zeros when reading a string

Even a 2003 version of gcov_read_string does not have the behavior
described by rL204881. The wrong impression might come from
libclang_rt.profile (GCDAProfiling.c)'s corrupted output (since the
initial import rL144865). Note, the corrupted output crashes gcov.
The file was modifiedllvm/include/llvm/ProfileData/GCOV.h
Commit 821a0f23d83921bf32a0a290b5f267f3514d09df by tyker
[AssumeBundles] Prevent generation of some redundant assumes

Summary: with this patch the assume salvageKnowledge will not generate assume if all knowledge is already available in an assume with valid context. assume bulider can also in some cases update an existing assume with better information.

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78014
The file was modifiedllvm/test/Analysis/BasicAA/featuretest.ll
The file was modifiedllvm/lib/Analysis/AssumeBundleQueries.cpp
The file was modifiedllvm/lib/Transforms/Utils/AssumeBundleBuilder.cpp
The file was modifiedllvm/test/Transforms/EarlyCSE/guards.ll
The file was modifiedllvm/include/llvm/Transforms/Utils/AssumeBundleBuilder.h
The file was modifiedllvm/include/llvm/Analysis/AssumeBundleQueries.h
The file was modifiedllvm/test/Transforms/EarlyCSE/invariant-loads.ll
The file was modifiedllvm/test/Transforms/Util/assume-builder.ll
Commit 5a9b792d7251e19f69f96c9619cde49497c79a07 by maskray
[gcov] Temporarily unsupport host-byteorder-big-endian

llvm-cov gcov does not support host-byteorder-big-endian yet.
The file was modifiedcompiler-rt/test/profile/instrprof-gcov-switch.test
The file was modifiedcompiler-rt/test/profile/Posix/instrprof-gcov-execvp.test
The file was modifiedcompiler-rt/test/profile/instrprof-gcov-two-objects.test
The file was modifiedcompiler-rt/test/profile/Posix/instrprof-gcov-parallel.test
The file was modifiedcompiler-rt/test/profile/instrprof-gcov-multiple-bbs-single-line.test
The file was modifiedcompiler-rt/test/profile/Posix/instrprof-gcov-fork.test
The file was modifiedcompiler-rt/test/profile/instrprof-gcov-exceptions.test
The file was modifiedcompiler-rt/test/profile/instrprof-gcov-one-line-function.test
The file was modifiedcompiler-rt/test/profile/Posix/instrprof-gcov-execlp.test
The file was modifiedcompiler-rt/test/profile/instrprof-gcov-__gcov_flush-multiple.test
The file was modifiedcompiler-rt/test/profile/instrprof-gcov-__gcov_flush-terminate.test
Commit 415c689dd224d3b08a75364453e66a19f9995859 by maskray
[compiler-rt][test] Add feature host-byteorder-big-endian

This is needed to make 5a9b792d7251e19f69f96c9619cde49497c79a07 "[gcov] Temporarily unsupport host-byteorder-big-endian"
work.
The file was modifiedcompiler-rt/test/lit.common.cfg.py
Commit 93d5ae3af18f3e5d4232510274d59c1b4e5b8e77 by maskray
[gcov] Temporarily unsupport host-byteorder-big-endian
The file was modifiedcompiler-rt/test/profile/Posix/instrprof-shared-gcov-flush.test
The file was modifiedcompiler-rt/test/profile/Posix/instrprof-dlopen-dlclose-gcov.test