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


  1. [libTooling] In Transformer, generalize `applyFirst` to admit rules with (details)
  2. [pstl] Allow customizing whether per-TU insulation is provided (details)
  3. [InstCombine] foldXorOfICmps(): don't give up on non-single-use ICmp's (details)
  4. [InstCombine][NFC] Rename IsFreeToInvert() -> isFreeToInvert() for (details)
  5. [InstCombine] Non-canonical clamp-like pattern handling (details)
  6. [lldb] Reland "Refactor guard variable checks in IRForTarget" (details)
  7. [analyzer][NFC] Refactoring BugReporter.cpp P1.: Store interesting (details)
Commit 42b957aad7b293eef34ed5c2da7ebde4fab997c9 by yitzhakm
[libTooling] In Transformer, generalize `applyFirst` to admit rules with
incompatible matchers.
Summary: This patch removes an (artificial) limitation of `applyFirst`,
which requires that all of the rules' matchers can be grouped together
in a single `anyOf()`. This change generalizes the code to group the
matchers into separate `anyOf`s based on compatibility. Correspondingly,
`buildMatcher` is changed to
`buildMatchers`, to allow for returning a set of matchers rather than
just one.
Reviewers: gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision:
llvm-svn: 368681
The file was modifiedclang/lib/Tooling/Refactoring/Transformer.cpp
The file was modifiedclang/unittests/Tooling/TransformerTest.cpp
The file was modifiedclang/include/clang/Tooling/Refactoring/Transformer.h
Commit 1b6d6e595b5e27566579c03923667aaab58bd3cd by Louis Dionne
[pstl] Allow customizing whether per-TU insulation is provided
Like we do in libc++, PSTL needs the ability to constrain ABI-unstable
symbols to each translation unit. This is OFF by default (like for
libc++), because most people don't care about this and there is a cost
associated to enabling the option (code bloat because templates are not
deduped across TUs).
I'm using '#pragma clang attribute push' to avoid marking each
declaration with an attribute, which quickly becomes difficult to
llvm-svn: 368684
The file was modifiedpstl/include/pstl/internal/memory_impl.h
The file was modifiedpstl/include/pstl/internal/parallel_backend_utils.h
The file was modifiedpstl/include/pstl/internal/glue_memory_impl.h
The file was modifiedpstl/include/pstl/internal/glue_numeric_impl.h
The file was modifiedpstl/include/pstl/internal/parallel_impl.h
The file was modifiedpstl/include/pstl/internal/glue_algorithm_defs.h
The file was modifiedpstl/include/pstl/internal/execution_impl.h
The file was modifiedpstl/include/pstl/internal/numeric_fwd.h
The file was modifiedpstl/include/pstl/internal/algorithm_impl.h
The file was modifiedpstl/include/pstl/internal/execution_defs.h
The file was modifiedpstl/include/pstl/internal/glue_algorithm_impl.h
The file was modifiedpstl/include/pstl/internal/parallel_backend_tbb.h
The file was modifiedpstl/include/pstl/internal/parallel_backend_serial.h
The file was modifiedpstl/CMakeLists.txt
The file was modifiedpstl/include/pstl/internal/algorithm_fwd.h
The file was modifiedpstl/include/pstl/internal/unseq_backend_simd.h
The file was modifiedpstl/include/pstl/internal/glue_memory_defs.h
The file was modifiedpstl/include/pstl/internal/glue_numeric_defs.h
The file was modifiedpstl/include/pstl/internal/pstl_config.h
The file was modifiedpstl/include/
The file was modifiedpstl/include/pstl/internal/numeric_impl.h
The file was modifiedpstl/include/pstl/internal/utils.h
Commit 2635c324daa6dd01402ee959ed7c74ef7942f2d7 by lebedev.ri
[InstCombine] foldXorOfICmps(): don't give up on non-single-use ICmp's
if all users are freely invertible
Summary: This is rather unconventional..
As the comment there says, we don't have much folds for xor-of-icmps, we
try to turn them into an and-of-icmps, for which we have plenty of
folds. But if the ICmp we need to invert is not single-use - we give up.
As discussed in, we may have a
non-canonical CLAMP pattern, with bit match and select-of-threshold that
we'll potentially clamp. As it can be seen in
`canonicalize-clamp-with-select-of-constant-threshold-pattern.ll`, out
of all 8 variations of the pattern, only two are **not** canonicalized
into the variant with and+icmp instead of bit math. The reason is
because the ICmp we need to invert is not single-use - we give up.
We indeed can't perform this fold at will, the general rule is that we
should not increase instruction count in InstCombine,
But we wouldn't end up increasing instruction count if we can adapt
every other user to the inverted value. This way the `not` we create
**will** get folded, and in the end the instruction count did not
For that, of course, we need to look at the users of a Value, which is
again rather unconventional for InstCombine :S
Thus i'm proposing to be a little bit more insistive in
`foldXorOfICmps()`. The alternatives would be to not create that `not`,
but add duplicate code to manually invert all users; or to add some even
less general combine to handle some more specific pattern[s].
Reviewers: spatel, nikic, RKSimon, craig.topper
Reviewed By: spatel
Subscribers: hiraditya, jdoerfert, dmgreen, llvm-commits
Tags: #llvm
Differential Revision:
llvm-svn: 368685
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-clamp-with-select-of-constant-threshold-pattern.ll
The file was modifiedllvm/test/Transforms/InstCombine/xor-of-icmps-with-extra-uses.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineInternal.h
Commit 0410489a34be7f82775b3ff5bbc00df29bdf5864 by lebedev.ri
[InstCombine][NFC] Rename IsFreeToInvert() -> isFreeToInvert() for
As per
llvm-svn: 368686
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineInternal.h
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
Commit 73f702ff192475b27039325a7428ce037771a5de by lebedev.ri
[InstCombine] Non-canonical clamp-like pattern handling
Summary: Given a pattern like:
%old_cmp1 = icmp slt i32 %x, C2
%old_replacement = select i1 %old_cmp1, i32 %target_low, i32
%old_x_offseted = add i32 %x, C1
%old_cmp0 = icmp ult i32 %old_x_offseted, C0
%r = select i1 %old_cmp0, i32 %x, i32 %old_replacement
``` it can be rewritten as more canonical pattern:
%new_cmp1 = icmp slt i32 %x, -C1
%new_cmp2 = icmp sge i32 %x, C0-C1
%new_clamped_low = select i1 %new_cmp1, i32 %target_low, i32 %x
%r = select i1 %new_cmp2, i32 %target_high, i32 %new_clamped_low
``` Iff `-C1 s<= C2 s<= C0-C1` Also, `ULT` predicate can also be `UGE`;
or `UGT` iff `C0 != -1` (+invert result) Also, `SLT` predicate can also
be `SGE`; or `SGT` iff `C2 != INT_MAX` (+invert result)
If `C1 == 0`, then all 3 instructions must be one-use; else at most
either `%old_cmp1` or `%old_x_offseted` can have extra uses. NOTE: if we
could reuse `%old_cmp1` as one of the comparisons we'll have to build,
this could be less limiting.
So there are two icmp's, each one with 3 predicate variants, so there
are 9 fold variants:
|     | ULT                            | UGE                           
| UGT                             |
| SLT | |
|  |
| SGE | |
| |
| SGT | |
| |
This fold was brought up in by
@dmgreen, and is needed to unblock that patch. This patch requires
Reviewers: spatel, nikic, xbolva00, dmgreen
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits, dmgreen
Tags: #llvm
Differential Revision:
llvm-svn: 368687
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-clamp-with-select-of-constant-threshold-pattern.ll
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-negative-and-positive-thresholds.ll
The file was modifiedllvm/test/Transforms/InstCombine/canonicalize-clamp-like-pattern-between-zero-and-positive-threshold.ll
The file was modifiedllvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
Commit 7f7b2966f7be82a33543808ae33269199798429b by Raphael Isemann
[lldb] Reland "Refactor guard variable checks in IRForTarget"
It seems the broken guard variable check for Windows was a feature(TM)
and not a bug, so let's keep add a flag to the guard check that keeps
the old behavior in the places where we ignored guard variables before.
llvm-svn: 368688
The file was modifiedlldb/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp
Commit b9bd6ebe1dca7978b86f27c583e5b471b447108b by dkszelethus
[analyzer][NFC] Refactoring BugReporter.cpp P1.: Store interesting
symbols/regions in a simple set
The goal of this refactoring effort was to better understand how
interestingness was propagated in BugReporter.cpp, which eventually
turned out to be a dead end, but with such a twist, I wouldn't even want
to spoil it ahead of time. However, I did get to learn a lot about how
things are working in there.
In these series of patches, as well as cleaning up the code big time, I
invite you to study how BugReporter.cpp operates, and discuss how we
could design this file to reduce the horrible mess that it is.
This patch reverts a great part of rC162028, which holds the title
"Allow multiple PathDiagnosticConsumers to be used with a BugReporter at
the same time.". This, however doesn't imply that there's any need for
multiple "layers" or stacks of interesting symbols and regions, quite
the contrary, I would argue that we would like to generate the same
amount of information for all output types, and only process them
Differential Revision:
llvm-svn: 368689
The file was modifiedclang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
The file was modifiedclang/lib/StaticAnalyzer/Core/BugReporter.cpp