Kerry McLaughlin [Wed, 26 Feb 2020 09:49:50 +0000 (09:49 +0000)]
[AArch64][SVE] Add SVE2 intrinsics for bit permutation & table lookup
Summary:
Implements the following intrinsics:
- @llvm.aarch64.sve.bdep.x
- @llvm.aarch64.sve.bext.x
- @llvm.aarch64.sve.bgrp.x
- @llvm.aarch64.sve.tbl2
- @llvm.aarch64.sve.tbx
The SelectTableSVE2 function in this patch is used to select the TBL2
intrinsic & ensures that the vector registers allocated are consecutive.
Reviewers: sdesmalen, andwar, dancgr, cameron.mcinally, efriedma, rengolin
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74912
Sam Parker [Wed, 26 Feb 2020 11:14:54 +0000 (11:14 +0000)]
[ARM][RDA] add getUniqueReachingMIDef
Add getUniqueReachingMIDef to RDA which performs a global search for
a machine instruction that produces a unique definition of a given
register at a given point. Also add two helper functions
(getMIOperand) that wrap around this functionality to get the
incoming definition uses of a given instruction. These now replace
the uses of getReachingMIDef in ARMLowOverheadLoops. getReachingMIDef
has been renamed to getReachingLocalMIDef and has been made private
along with getInstFromId.
Differential Revision: https://reviews.llvm.org/D74605
Florian Hahn [Wed, 26 Feb 2020 11:05:59 +0000 (11:05 +0000)]
[AArch64] Flip default for register renaming in the ld/st optimizier.
Turn on register renaming again after disabling it for the 10.0 release,
to help flushing out any issues.
James Henderson [Wed, 26 Feb 2020 10:36:08 +0000 (10:36 +0000)]
[docs][llvm-objcopy][llvm-strip] Move --wildcard description earlier
This moves it above the response file description, which should be at
the end.
James Henderson [Wed, 26 Feb 2020 10:29:47 +0000 (10:29 +0000)]
[docs][llvm-symbolizer] Fix indentation of inline option examples
The examples for different options were inconsistently indented in
the HTML display. As they are tied to the options, this change
normalises to indent them the same as the option description body.
James Henderson [Wed, 26 Feb 2020 10:24:50 +0000 (10:24 +0000)]
[docs][llvm-symbolizer] Fix --functions description
"--functions none" and "--functions=none" are not the same. One is the
option "--functions" with its default value of "linkage", followed by an
input address of "none", and the other is "--functions" with the value
"none". This patch fixes the doc to match the actual behaviour by adding
an extra '=' sign in the allowed values description.
Jay Foad [Wed, 26 Feb 2020 09:41:41 +0000 (09:41 +0000)]
AMDGPU: Fix some incorrect FUNC-LABEL checks
serge-sans-paille [Wed, 26 Feb 2020 09:37:04 +0000 (10:37 +0100)]
Fix typo in clang lit config
Typo introduced in
e058667a2e017d3225a9bb067dbac7f2159576f7
serge-sans-paille [Mon, 17 Feb 2020 12:42:00 +0000 (13:42 +0100)]
Support -fuse-ld=lld for riscv
Add a configure feature test to filter out tests that explicitly depend on platform linker.
Differential Revision: https://reviews.llvm.org/D74704
Pavel Labath [Thu, 13 Feb 2020 13:30:04 +0000 (14:30 +0100)]
[lldb/gdb-remote] Add support for the qOffsets packet
Summary:
This packet is necessary to make lldb work with the remote-gdb stub in
user mode qemu when running position-independent binaries. It reports
the relative position (load bias) of the loaded executable wrt. the
addresses in the file itself.
Lldb needs to know this information in order to correctly set the load
address of the executable. Normally, lldb would be able to find this out
on its own by following the breadcrumbs in the process auxiliary vector,
but we can't do this here because qemu does not support the
qXfer:auxv:read packet.
This patch does not implement full scope of the qOffsets packet (it only
supports packets with identical code, data and bss offsets), because it
is not fully clear how should the different offsets be handled and I am
not aware of a producer which would make use of this feature (qemu will
always
<https://github.com/qemu/qemu/blob/master/linux-user/elfload.c#L2436>
return the same value for code and data offsets). In fact, even gdb
ignores the offset for the bss sections, and uses the "data" offset
instead. So, until the we need more of this packet, I think it's best
to stick to the simplest solution possible. This patch simply rejects
replies with non-uniform offsets.
Reviewers: clayborg, jasonmolenda
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D74598
Haojian Wu [Wed, 26 Feb 2020 09:12:49 +0000 (10:12 +0100)]
Fix the clangd-fuzzer build error.
Haojian Wu [Wed, 19 Feb 2020 14:37:36 +0000 (15:37 +0100)]
[clangd] Expose the rename LimitFiles option to the C++ API, NFC.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74834
Kadir Cetinkaya [Wed, 26 Feb 2020 08:03:03 +0000 (09:03 +0100)]
Strip preceeding -Xclang when stripping -fcolor-diagnostics or -fdiagnostics-color
Summary: Fixes https://github.com/clangd/clangd/issues/279. We were removing the color options but not the preceeding -Xclang which causes errors since the -Xclang would now apply to the next option in the list of options. Now, when removing a color option, we check if there was a preceeding -Xclang and remove it as well.
Patch By @DaanDeMeyer !
Reviewers: sammccall, kadircet
Reviewed By: sammccall
Subscribers: ilya-biryukov, usaxena95
Differential Revision: https://reviews.llvm.org/D75019
serge-sans-paille [Wed, 26 Feb 2020 07:26:53 +0000 (08:26 +0100)]
Remove no un-necessary require for load_extension.ll
Local testing on OSX no longer exhibit the linking error mentioned in
https://reviews.llvm.org/D71959#1860286
Michael Liao [Wed, 26 Feb 2020 06:58:12 +0000 (01:58 -0500)]
Add missing dependency to fix shared library build.
Juneyoung Lee [Wed, 26 Feb 2020 06:33:02 +0000 (15:33 +0900)]
[SimpleLoopUnswitch] Canonicalize variable names
Jim Lin [Tue, 25 Feb 2020 08:12:22 +0000 (16:12 +0800)]
[ARC][NFC] Remove trailing space
Greg Clayton [Thu, 20 Feb 2020 01:31:27 +0000 (17:31 -0800)]
Add a llvm-gsymutil tool that can convert object files to GSYM and perform lookups.
Summary:
This patch creates the llvm-gsymutil binary that can convert object files to GSYM using the --convert <path> option. It can also dump and lookup addresses within GSYM files that have been saved to disk.
To dump a file:
llvm-gsymutil /path/to/a.gsym
To perform address lookups, like with atos, on GSYM files:
llvm-gsymutil --address 0x1000 --address 0x1100 /path/to/a.gsym
To convert a mach-o or ELF file, including any DWARF debug info contained within the object files:
llvm-gsymutil --convert /path/to/a.out --out-file /path/to/a.out.gsym
Conversion highlights:
- convert DWARF debug info in mach-o or ELF files to GSYM
- convert symbols in symbol table to GSYM and don't convert symbols that overlap with DWARF debug info
- extract UUID from object files
- extract .text (read + execute) section address ranges and filter out any DWARF or symbols that don't fall in those ranges.
- if .text sections are extracted, and if the last gsym::FunctionInfo object has no size, cap the size to the end of the section the function was contained in
Dumping GSYM files will dump all sections of the GSYM file in textual format.
Reviewers: labath, aadsm, serhiy.redko, jankratochvil, xiaobai, wallace, aprantl, JDevlieghere, jdoerfert
Subscribers: mgorny, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74883
Juneyoung Lee [Wed, 26 Feb 2020 02:33:34 +0000 (11:33 +0900)]
[SimpleLoopUnswitch] Fix introduction of UB when hoisted condition may be undef or poison
Summary:
Loop unswitch hoists branches on loop-invariant conditions. However, if this
condition is poison/undef and the branch wasn't originally reachable, loop
unswitch introduces UB (since the optimized code will branch on poison/undef and
the original one didn't)).
We fix this problem by freezing the condition to ensure we don't introduce UB.
We will now transform the following:
while (...) {
if (C) { A }
else { B }
}
Into:
C' = freeze(C)
if (C') {
while (...) { A }
} else {
while (...) { B }
}
This patch fixes the root cause of the following bug reports (which use the old loop unswitch, but can be reproduced with minor changes in the code and -enable-nontrivial-unswitch):
- https://llvm.org/bugs/show_bug.cgi?id=27506
- https://llvm.org/bugs/show_bug.cgi?id=31652
Reviewers: reames, majnemer, chenli, sanjoy, hfinkel
Reviewed By: reames
Subscribers: hiraditya, jvesely, nhaehnle, filcab, regehr, trentxintong, nlopes, llvm-commits, mzolotukhin
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D29015
Kang Zhang [Wed, 26 Feb 2020 02:59:03 +0000 (02:59 +0000)]
[PowerPC] Fix the unexpected modification caused by D62993 in LowerSELECT_CC for power9
Summary:
The patch D62993 : `[PowerPC] Emit scalar min/max instructions with unsafe fp math`
has modified the functionality when `Subtarget.hasP9Vector() && (!HasNoInfs || !HasNoNaNs)`,
this modification is not expected.
Reviewed By: nemanjai
Differential Revision: https://reviews.llvm.org/D74701
Fangrui Song [Tue, 25 Feb 2020 02:09:27 +0000 (18:09 -0800)]
[MC] Default MCContext::UseNamesOnTempLabels to false and only set it to true for MCAsmStreamer
Only MCAsmStreamer (assembly output) needs to keep names of temporary labels created by
MCContext::createTempSymbol().
This change made the rL236642 optimization available for cc2as and
probably some other users.
This eliminates a behavior difference between llvm-mc -filetype=obj and cc1as, which caused
https://reviews.llvm.org/D74006#1890487
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D75097
Fangrui Song [Tue, 25 Feb 2020 01:54:39 +0000 (17:54 -0800)]
[MC][ARM] Don't create multiple .ARM.exidx associated to one .text
Fixed an issue exposed by D74006.
In clang cc1as, MCContext::UseNamesOnTempLabels is true.
When parsing a .fnstart directive, FnStart gets redefined to a temporary symbol of a different name (.Ltmp0, .Ltmp1, ...).
MCContext::getELFSection() called by SwitchToEHSection() will create a different .ARM.exidx each time.
llvm-mc uses `Ctx.setUseNamesOnTempLabels(false);` and FnStart is unnamed.
MCContext::getELFSection() called by SwitchToEHSection() will reuse the same .ARM.exidx .
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D75095
Fangrui Song [Wed, 26 Feb 2020 02:03:47 +0000 (18:03 -0800)]
[Analysis] Fix -Wrange-loop-analysis after D69876
Nathan James [Wed, 26 Feb 2020 01:56:21 +0000 (01:56 +0000)]
[docs] dump-ast-matchers removes const from Matcher args and handles template functions slightly better
Reviewers: aaron.ballman, gribozavr2, joerg
Reviewed By: aaron.ballman
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D75113
Reid Kleckner [Thu, 20 Feb 2020 01:05:42 +0000 (17:05 -0800)]
Remove namespace lld { namespace coff { from COFF LLD cpp files
Instead, use `using namespace lld(::coff)`, and fully qualify the names
of free functions where they are defined in cpp files.
This effectively reverts
d79c3be618 to follow the new style guide added
in
236fcbc21a7a8872.
Reviewed By: MaskRay
Differential Revision: https://reviews.llvm.org/D74882
Max Moroz [Wed, 26 Feb 2020 01:10:16 +0000 (17:10 -0800)]
[compiler-rt] Fix a typo in a comment in FuzzedDataProvider.h.
Craig Topper [Wed, 26 Feb 2020 00:57:42 +0000 (16:57 -0800)]
[SelectionDAG][PowerPC][AArch64][X86][ARM] Add chain input and output the ISD::FLT_ROUNDS_
This node reads the rounding control which means it needs to be ordered properly with operations that change the rounding control. So it needs to be chained to maintain order.
This patch adds a chain input and output to the node and connects it to the chain in SelectionDAGBuilder. I've update all in-tree targets to connect their chain through their lowering code.
Differential Revision: https://reviews.llvm.org/D75132
zoecarver [Wed, 26 Feb 2020 00:50:57 +0000 (16:50 -0800)]
Remove std::shared_ptr::allocate_shared
std::shared_ptr::allocate_shared isn't in the standard. This commit removes it from libc++. It updates std::allocate_shared to use __create_with_cntrl_block.
Differential Revision: https://reviews.llvm.org/D66178
Lang Hames [Wed, 26 Feb 2020 00:04:41 +0000 (16:04 -0800)]
[ORC] Remove the JITDylib::SymbolTableEntry::isInMaterializingState() method.
It was being used inconsistently. Uses have been replaced with direct checks
on the symbol state.
Adrian Prantl [Wed, 26 Feb 2020 00:42:53 +0000 (16:42 -0800)]
Fix a null dereference in the LLDB data formatters.
Nico Weber [Wed, 26 Feb 2020 00:21:52 +0000 (19:21 -0500)]
Revert "[libTooling] Add function to determine associated text of a declaration."
This reverts commit
9c54f6154f748e707ad2385ddf6d66e812890c6a.
Breaks two tests on Windows, see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/14505/steps/stage%201%20check/logs/stdio
Quentin Colombet [Tue, 25 Feb 2020 22:03:21 +0000 (14:03 -0800)]
[GISel][KnownBits] Update a comment regarding the effect of cache on PHIs
Unlike what I claimed in my previous commit. The caching is
actually not NFC on PHIs.
When we put a big enough max depth, we end up simulating loops.
The cache is effectively cutting the simulation short and we
get less information as a result.
E.g.,
```
v0 = G_CONSTANT i8 0xC0
jump
v1 = G_PHI i8 v0, v2
v2 = G_LSHR i8 v1, 1
```
Let say we want the known bits of v1.
- With cache:
Set v1 cache to we know nothing
v1 is v0 & v2
v0 gives us 0xC0
v2 gives us known bits of v1 >> 1
v1 is in the cache
=> v1 is 0, thus v2 is 0x80
Finally v1 is v0 & v2 => 0x80
- Without cache and enough depth to do two iteration of the loop:
v1 is v0 & v2
v0 gives us 0xC0
v2 gives us known bits of v1 >> 1
v1 is v0 & v2
v0 is 0xC0
v2 is v1 >> 1
Reach the max depth for v1...
unwinding
v1 is know nothing
v2 is 0x80
v0 is 0xC0
v1 is 0x80
v2 is 0xC0
v0 is 0xC0
v1 is 0xC0
Thus now v1 is 0xC0 instead of 0x80.
I've added a unittest demonstrating that.
NFC
aartbik [Tue, 25 Feb 2020 22:57:35 +0000 (14:57 -0800)]
[mlir] [VectorOps] Add vector.print to EDSC
Summary: This prepares using the operation in model builder runner.
Reviewers: nicolasvasilache, andydavis1
Reviewed By: nicolasvasilache
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, liufengdb, Joonsoo, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75147
Louis Dionne [Tue, 25 Feb 2020 23:15:56 +0000 (18:15 -0500)]
[NFC][libc++] Refactor some future tests to reduce code duplication
The same test was being repeated over and over again.
That's what functions are for.
River Riddle [Tue, 25 Feb 2020 22:56:24 +0000 (14:56 -0800)]
[mlir][DenseElementsAttr] Fix storage size for bfloat16 when parsing from hex.
Summary: bfloat16 is stored internally as a double, so we can't direct use Type::getIntOrFloatBitWidth.
Differential Revision: https://reviews.llvm.org/D75133
Jason Molenda [Tue, 25 Feb 2020 22:55:47 +0000 (14:55 -0800)]
Re-land Unwind past an interrupt handler correctly on arm or at pc==0
Updated the patch to only fetch $pc on a Return Address-using
target only if we're in a trap frame *and* if there is a saved
location for $pc in the trap frame's unwind rules. If not,
we fall back to fetching the Return Address register (eg $lr).
Original commit msg:
Unwind past an interrupt handler correctly on arm or at pc==0
Fix RegisterContextLLDB::InitializeNonZerothFrame so that it
will fetch a FullUnwindPlan instead of falling back to the
architectural default unwind plan -- GetFullUnwindPlan knows
how to spot a jmp 0x0 that results in a fault, which may be
the case when we see a trap handler on the stack.
Fix RegisterContextLLDB::SavedLocationForRegister so that when
the pc value is requested from a trap handler frame, where we
have a complete register context available to us, don't provide
the Return Address register (lr) instead of the pc. We have
an actual pc value here, and it's pointing to the instruction
that faulted.
Differential revision: https://reviews.llvm.org/D75007
<rdar://problem/
59416588>
Louis Dionne [Tue, 25 Feb 2020 22:52:34 +0000 (17:52 -0500)]
[libc++] Avoid including <semaphore.h> on Apple
It turns out that <semaphore.h> is not well-behaved, as it transitively
includes <sys/param.h>, and that one defines several non-reserved macros
that clash with some downstream projects in modular builds. For the time
being, using <sys/semaphore.h> instead gives us the declarations we need
without the macros.
rdar://
59744472
Vedant Kumar [Tue, 25 Feb 2020 22:37:59 +0000 (14:37 -0800)]
Revert "[X86MCTargetDesc.h] Speculative fix for macro collision with sys/param.h"
This reverts commit
eee22ec3c3712a1089cbdbe66ccf36dd89be507a.
This is not the correct fix, the root cause seems to be a bug in the
stage1 host clang compiler. See https://reviews.llvm.org/D75091 for more
discussion.
Roman Lebedev [Tue, 25 Feb 2020 22:37:17 +0000 (01:37 +0300)]
[clang] Annotating C++'s `operator new` with more attributes
Summary:
Right now we annotate C++'s `operator new` with `noalias` attribute,
which very much is healthy for optimizations.
However as per [[ http://eel.is/c++draft/basic.stc.dynamic.allocation | `[basic.stc.dynamic.allocation]` ]],
there are more promises on global `operator new`, namely:
* non-`std::nothrow_t` `operator new` *never* returns `nullptr`
* If `std::align_val_t align` parameter is taken, the pointer will also be `align`-aligned
* ~~global `operator new`-returned pointer is `__STDCPP_DEFAULT_NEW_ALIGNMENT__`-aligned ~~ It's more caveated than that.
Supplying this information may not cause immediate landslide effects
on any specific benchmarks, but it for sure will be healthy for optimizer
in the sense that the IR will better reflect the guarantees provided in the source code.
The caveat is `-fno-assume-sane-operator-new`, which currently prevents emitting `noalias`
attribute, and is automatically passed by Sanitizers ([[ https://bugs.llvm.org/show_bug.cgi?id=16386 | PR16386 ]]) - should it also cover these attributes?
The problem is that the flag is back-end-specific, as seen in `test/Modules/explicit-build-flags.cpp`.
But while it is okay to add `noalias` metadata in backend, we really should be adding at least
the alignment metadata to the AST, since that allows us to perform sema checks on it.
Reviewers: erichkeane, rjmccall, jdoerfert, eugenis, rsmith
Reviewed By: rsmith
Subscribers: xbolva00, jrtc27, atanasyan, nlopes, cfe-commits
Tags: #llvm, #clang
Differential Revision: https://reviews.llvm.org/D73380
Roman Lebedev [Tue, 25 Feb 2020 22:36:44 +0000 (01:36 +0300)]
[Sema] Perform call checking when building CXXNewExpr
Summary:
There was even a TODO for this.
The main motivation is to make use of call-site based
`__attribute__((alloc_align(param_idx)))` validation (D72996).
Reviewers: rsmith, erichkeane, aaron.ballman, jdoerfert
Reviewed By: rsmith
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73020
Cyndy Ishida [Fri, 14 Feb 2020 22:05:59 +0000 (14:05 -0800)]
[llvm][TextAPI] rename test vars, NFC
* Conforms to clang tidy
Johannes Doerfert [Thu, 20 Feb 2020 20:17:43 +0000 (14:17 -0600)]
[OpenMP][Opt] Combine `struct ident_t*` during deduplication
If we deduplicate OpenMP runtime calls we have multiple `ident_t*` that
represent information like source location. So far, we simply kept the
one used by the replacement call. However, as exposed by PR44893, that
can cause problems if we have stack allocated `ident_t` objects. While
we need to revisit the use of these as well, it is clear that we
eventually want to merge source location information in some way. With
this patch we add the infrastructure to do so but without doing the
actual merge. Instead we pick a global `ident_t` from the replaced
calls, if possible, or create a new one with an unknown location
instead.
Reviewed By: JonChesterfield
Differential Revision: https://reviews.llvm.org/D74925
Thomas Lively [Sat, 22 Feb 2020 01:54:47 +0000 (17:54 -0800)]
[WebAssembly] Simplify extract_vector lowering
Summary:
Removes patterns that were not doing useful work, changes the
default extract instructions to be the unsigned versions now that
they are enabled by default, fixes PR44988, and adds tests for
sext_inreg lowering.
Reviewers: aheejin
Reviewed By: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75005
Yitzhak Mandelbaum [Fri, 3 Jan 2020 14:57:33 +0000 (09:57 -0500)]
[libTooling] Add function to determine associated text of a declaration.
Summary:
This patch adds `getAssociatedRange` which, for a given decl, computes preceding
and trailing text that would conceptually be associated with the decl by the
reader. This includes comments, whitespace, and separators like ';'.
Reviewers: gribozavr
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D72153
Akira Hatanaka [Tue, 25 Feb 2020 20:20:07 +0000 (12:20 -0800)]
[ObjC][ARC] Don't move a retain call living outside a loop into the loop
body
We started seeing cases where ARC optimizer would move retain calls into
loop bodies, causing imbalance in the number of retain and release
calls, after changes were made to delete inert ARC calls since the inert
calls that used to block code motion are gone.
Fix the bug by setting the CFG hazard flag when visiting a loop header.
rdar://problem/
56908836
Alexey Bataev [Wed, 19 Feb 2020 14:41:50 +0000 (09:41 -0500)]
[LIBOMPTARGET]Fix PR44933: fix crash because of the too early deinitialization of libomptarget.
Summary:
Instead of using global variables with unpredicted time of
deinitialization, use dynamically allocated variables with functions
explicitly marked as global constructor/destructor and priority. This
allows to prevent the crash because of the incorrect order of dynamic
libraries deinitialization.
Reviewers: grokos, hfinkel
Subscribers: caomhin, kkwli0, openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D74837
Craig Topper [Tue, 25 Feb 2020 20:22:38 +0000 (12:22 -0800)]
[X86] Add test to show incorrect ordering of flt.rounds intrinsic relative to calls to fesetround.
We don't order flt.rounds intrinsics relative to side effecting
operations in SelectionDAG. And we CSE multiple calls because of
this.
zoecarver [Tue, 25 Feb 2020 20:42:49 +0000 (12:42 -0800)]
Check args passed to __builtin_frame_address and __builtin_return_address.
Verifies that an argument passed to __builtin_frame_address or __builtin_return_address is within the range [0, 0xFFFF]
Differential revision: https://reviews.llvm.org/D66839
Re-committed after fixed:
c93112dc4f745b0455addb54bfe1c2f79b827c6d
Bill Wendling [Tue, 25 Feb 2020 20:31:20 +0000 (12:31 -0800)]
Use "nop" to avoid size warnings.
Roman Lebedev [Tue, 25 Feb 2020 18:53:12 +0000 (21:53 +0300)]
[SCEV][IndVars] Always provide insertion point to the SCEVExpander::isHighCostExpansion()
Summary: This addresses the `llvm/test/Transforms/IndVarSimplify/elim-extend.ll` `@nestedIV` regression from D73728
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73777
Roman Lebedev [Tue, 25 Feb 2020 18:53:00 +0000 (21:53 +0300)]
[SCEV] rewriteLoopExitValues(): even if have hard uses, still rewrite if cheap (PR44668)
Summary:
Replacing uses of IV outside of the loop is likely generally useful,
but `rewriteLoopExitValues()` is cautious, and if it isn't told to always
perform the replacement, and there are hard uses of IV in loop,
it doesn't replace.
In [[ https://bugs.llvm.org/show_bug.cgi?id=44668 | PR44668 ]],
that prevents `-indvars` from replacing uses of induction variable
after the loop, which might be one of the optimization failures
preventing that code from being vectorized.
Instead, now that the cost model is fixed, i believe we should be
a little bit more optimistic, and also perform replacement
if we believe it is within our budget.
Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=44668 | PR44668 ]].
Reviewers: reames, mkazantsev, asbirlea, fhahn, skatkov
Reviewed By: mkazantsev
Subscribers: nikic, hiraditya, zzheng, javed.absar, dmgreen, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73501
Roman Lebedev [Tue, 25 Feb 2020 18:52:46 +0000 (21:52 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model min/max (PR44668)
Summary:
Previosly we simply always said that `SCEVMinMaxExpr` is too costly to expand.
But this isn't really true, it expands into just a comparison+swap pair.
And again much like with add/mul, there will be one less such pair
than the number of operands. And we need to count the cost of operands themselves.
This does change a number of testcases, and as far as i can tell,
all of these changes are improvements, in the sense that
we fixed up more latches to do the [in]equality comparison.
This concludes cost-modelling changes, no other SCEV expressions exist as of now.
This is a part of addressing [[ https://bugs.llvm.org/show_bug.cgi?id=44668 | PR44668 ]].
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73744
Roman Lebedev [Tue, 25 Feb 2020 18:52:32 +0000 (21:52 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model polynomial recurrence
Summary:
So, i wouldn't call this *obviously* correct,
but i think i got it right this time :)
Roughly, we have
```
Op0*x^0 + Op1*x^1 + Op2*x^2 ...
```
where `Op_{n} * x^{n}` is called term, and `n` the degree of term.
Due to the way they are stored internally in `SCEVAddRecExpr`,
i believe we can have `Op_{n}` to be `0`, so we should not charge for those.
I think it is most straight-forward to count the cost in 4 steps:
1. First, count it the same way we counted `scAddExpr`, but be sure to skip terms with zero constants.
Much like with `add` expr we will have one less addition than number of terms.
2. Each non-constant term (term degree >= 1) requires a multiplication between the `Op_{n}` and `x^{n}`.
But again, only charge for it if it is required - `Op_{n}` must not be 0 (no term) or 1 (no multiplication needed),
and obviously don't charge constant terms (`x^0 == 1`).
3. We must charge for all the `x^0`..`x^{poly_degree}` themselves.
Since `x^{poly_degree}` is `x * x * ... * x`, i.e. `poly_degree` `x`'es multiplied,
for final `poly_degree` term we again require `poly_degree-1` multiplications.
Note that all the `x^{0}`..`x^{poly_degree-1}` will be computed for the free along the way there.
4. And finally, the operands themselves.
Here, much like with add/mul exprs, we really don't look for preexisting instructions..
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73741
Roman Lebedev [Tue, 25 Feb 2020 18:52:19 +0000 (21:52 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model add/mul
Summary:
While this resolves the regression from D73722 in `llvm/test/Transforms/IndVarSimplify/exit_value_test2.ll`,
this now regresses `llvm/test/Transforms/IndVarSimplify/elim-extend.ll` `@nestedIV` test,
we no longer can perform that expansion within default budget of `4`, but require budget of `6`.
That regression is being addressed by D73777.
The basic idea here is simple.
```
Op0, Op1, Op2 ...
| | |
\--+--/ |
| |
\---+---/
```
I.e. given N operands, we will have N-1 operations,
so we have to add cost of an add (mul) for **every** Op processed,
**except** the first one, plus we need to recurse into *every* Op.
I'm guessing there's already canonicalization that ensures we won't
have `1` operand in `scMulExpr`, and no `0` in `scAddExpr`/`scMulExpr`.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73728
Roman Lebedev [Tue, 25 Feb 2020 18:52:07 +0000 (21:52 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model plain UDiv
Summary:
If we don't believe this UDiv is actually a LShr in disguise, things are much worse.
First, we try to see if this UDiv actually originates from user code,
by looking for `S + 1`, and if found considering this UDiv to be free.
But otherwise, we always considered this UDiv to be high-cost.
However that is no longer the case with TTI-driven cost model:
our default budget is 4, which matches the default cost of UDiv,
so now we allow a single UDiv to not be counted as high-cost.
While that is the case, it is evident this is actually a regression
due to the fact that cost-modelling is incomplete - we did not account
for the `add`, `mul` costs yet. That is being addressed in D73728.
Cost-modelling for UDiv also seems pretty straight-forward:
subtract cost of the UDiv itself, and recurse into both the LHS and RHS.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73722
Roman Lebedev [Tue, 25 Feb 2020 19:16:29 +0000 (22:16 +0300)]
[NFC][IndVarSimplify] Adjust value names in IndVarSimplify/exit_value_test2.ll
%tmp prefix confuses auto-update scripts
Roman Lebedev [Tue, 25 Feb 2020 18:51:22 +0000 (21:51 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): cost-model UDiv by power-of-two as LShr
Summary:
Like with casts, we need to subtract the cost of `lshr` instruction
from budget, and recurse into LHS operand.
Seems "pretty obviously correct" to me?
To be noted, there is a number of other shortcuts we //could// cost-model:
* `... + (-1 * ...)` -> `... - ...` <- likely very frequent case
* `x - (rem x, power-of-2)`, which is currently `(x udiv power-of-2) * power-of-2` -> `x & -log2(power-of-2)`
* `rem x, power-of-2`, which is currently `x - ((x udiv power-of-2) * power-of-2)` -> `x & log2(power-of-2)-1`
* `... * power-of-2` -> `... << log2(power-of-2)` <- likely not very beneficial
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73718
Roman Lebedev [Tue, 25 Feb 2020 18:51:16 +0000 (21:51 +0300)]
[SCEV] SCEVExpander::isHighCostExpansionHelper(): begin cost modelling - model cast cost
Summary:
This is not a NFC, although it does not change any of the existing tests.
I'm not really sure if we should have specific tests for the cost modelling itself.
This is the first patch that actually makes `SCEVExpander::isHighCostExpansionHelper()`
account for the cost of the SCEV expression, and consider the budget available,
by modelling cast expressions.
I believe the logic itself is "pretty obviously correct" - from budget,
we need to subtract the cost of the cast expression from inner type `Op->getType()`
to the `S->getType()` type, and recurse into the expression we are casting.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: xbolva00, hiraditya, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73716
Roman Lebedev [Tue, 25 Feb 2020 18:51:12 +0000 (21:51 +0300)]
[SCEV] SCEVExpander::isHighCostExpansion(): assert if TTI is not provided
Summary:
Currently, as per `check-llvm`, we never call `SCEVExpander::isHighCostExpansion()` with null TTI,
so this appears to be a safe restriction.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: javed.absar, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73712
Roman Lebedev [Tue, 25 Feb 2020 18:51:06 +0000 (21:51 +0300)]
[NFC][SCEV] SCEVExpander::isHighCostExpansionHelper(): check that we processed expression first
Summary:
As far as i can tell this is still NFC.
Initially in rL146438 it was added at the top of the function,
later rL238507 dethroned it, and rL244474 did it again.
I'm not sure if we have already checked the cost of this expansion, we should be doing that again.
Reviewers: reames, mkazantsev, wmi, sanjoy, atrick, igor-laevsky
Reviewed By: mkazantsev
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73706
Roman Lebedev [Tue, 25 Feb 2020 18:51:02 +0000 (21:51 +0300)]
[NFC][SCEV] Piping to pass new SCEVCheapExpansionBudget option into SCEVExpander::isHighCostExpansionHelper()
Summary:
In future patches`SCEVExpander::isHighCostExpansionHelper()` will respect the budget allocated by performing TTI cost modelling.
This is a fully NFC patch to make things reviewable.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, zzheng, javed.absar, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73705
Roman Lebedev [Tue, 25 Feb 2020 18:50:55 +0000 (21:50 +0300)]
[NFC][SCEV] Piping to pass TTI into SCEVExpander::isHighCostExpansionHelper()
Summary:
Future patches will make use of TTI to perform cost-model-driven `SCEVExpander::isHighCostExpansionHelper()`
This is a fully NFC patch to make things reviewable.
Reviewers: reames, mkazantsev, wmi, sanjoy
Reviewed By: mkazantsev
Subscribers: hiraditya, zzheng, javed.absar, dmgreen, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73704
Bill Wendling [Tue, 25 Feb 2020 19:45:56 +0000 (11:45 -0800)]
Add 'l' constraint to goto label reference
A goto label uses the 'l' constraint, skipping it can cause unexpected
warnings.
Martin Storsjö [Tue, 25 Feb 2020 07:36:24 +0000 (09:36 +0200)]
[libcxx] Fix building for windows after
54fa9ecd3088508
Move the implementation of __libcpp_thread_poll_with_backoff
and __libcpp_timed_backoff_policy::operator() out of the
_LIBCPP_HAS_THREAD_API_PTHREAD block. None of the code in these
methods is pthreads specific.
Also add "inline _LIBCPP_INLINE_VISIBILITY" to
__libcpp_timed_backoff_policy::operator(), to avoid errors due to
multiple definitions of the operator. Contrary to
__libcpp_thread_poll_with_backoff (which is a template function),
this is a normal non-templated method.
Differential Revision: https://reviews.llvm.org/D75102
Sanjay Patel [Tue, 25 Feb 2020 19:23:03 +0000 (14:23 -0500)]
[PhaseOrdering] add tests for missed CSE; NFC
Also add a RUN line for the new pass manager.
Jim Ingham [Sat, 22 Feb 2020 00:45:29 +0000 (16:45 -0800)]
Fix a race between lldb's packet timeout and the profile thread's usleep.
The debugserver profile thread used to suspend itself between samples with
a usleep. When you detach or kill, MachProcess::Clear would delay replying
to the incoming packet until pthread_join of the profile thread returned.
If you are unlucky or the suspend delay is long, it could take longer than
the packet timeout for pthread_join to return. Then you would get an error
about detach not succeeding from lldb - even though in fact the detach was
successful...
I replaced the usleep with PThreadEvents entity. Then we just call a timed
WaitForEventBits, and when debugserver wants to stop the profile thread, it
can set the event bit, and the sleep will exit immediately.
Differential Revision: https://reviews.llvm.org/D75004
Scott Linder [Fri, 8 Nov 2019 20:07:54 +0000 (15:07 -0500)]
[AMDGPU] Implement wave64 DWARF register mapping
Summary:
Implement the DWARF register mapping described in
llvm/docs/AMDGPUUsage.rst
This is currently limited to wave64 VGPRs/AGPRs.
This also includes some minor changes in AMDGPUInstPrinter,
AMDGPUMCTargetDesc, and AMDGPUAsmParser to make generating CFI assembly
text and ELF sections possible to ease testing, although complete CFI
support is not yet implemented.
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D74915
Scott Linder [Tue, 25 Feb 2020 14:03:11 +0000 (09:03 -0500)]
Support emitting .cfi_undefined in CodeGen
This will be used by AMDGPU.
Differential Revision: https://reviews.llvm.org/D74914
Scott Linder [Tue, 25 Feb 2020 14:01:26 +0000 (09:01 -0500)]
Emit register names in cfi assembly directives
Update .cfi_undefined, .cfi_register, and .cfi_return_column to
print symbolic register arguments.
Differential Revision: https://reviews.llvm.org/D74914
Yaxun (Sam) Liu [Fri, 21 Feb 2020 00:02:53 +0000 (19:02 -0500)]
Make __builtin_amdgcn_dispatch_ptr dereferenceable and align at 4
Differential Revision: https://reviews.llvm.org/D75028
Vedant Kumar [Tue, 25 Feb 2020 18:49:53 +0000 (10:49 -0800)]
[X86MCTargetDesc.h] Speculative fix for macro collision with sys/param.h
See discussion on https://reviews.llvm.org/D75091 for information about
the build failure and alternatives considered.
Quentin Colombet [Tue, 25 Feb 2020 01:30:58 +0000 (17:30 -0800)]
[MachineInstr] Add a dumpr method
Add a dump method that recursively prints an instruction and all
the instructions defining its operands and so on.
This is helpful when looking at combiner issue.
NFC
Differential Revision: https://reviews.llvm.org/D75094
Sean Fertile [Tue, 25 Feb 2020 17:41:31 +0000 (12:41 -0500)]
[PowerPC][NFC] Remove comments mentioning Darwin and VRSAVE from lit test.
Roman Lebedev [Tue, 25 Feb 2020 17:08:58 +0000 (20:08 +0300)]
[Codegen] Revert rL354676/rL354677 and followups - introduced PR43446 miscompile
This reverts https://reviews.llvm.org/D58468
(rL354676,
44037d7a6377ec8e5542cced73583283334b516b),
and all and any follow-ups to that code block.
https://bugs.llvm.org/show_bug.cgi?id=43446
Roman Lebedev [Tue, 25 Feb 2020 17:07:15 +0000 (20:07 +0300)]
[NFC][Codegen] Add miscompile test for constant store merging from PR43446
This miscompile was introduced by rL354676 / https://reviews.llvm.org/D58468
https://bugs.llvm.org/show_bug.cgi?id=43446
Louis Dionne [Tue, 25 Feb 2020 17:10:28 +0000 (12:10 -0500)]
[libc++] Remove incorrect XFAIL in modules test
Apparently, the test still works on single-threaded systems.
Philip Reames [Tue, 25 Feb 2020 16:56:53 +0000 (08:56 -0800)]
Revert "[LICM] Support hosting of dynamic allocas out of loops"
This reverts commit
8d22100f66c4170510c6ff028c60672acfe1cff9.
There was a functional regression reported (https://bugs.llvm.org/show_bug.cgi?id=44996). I'm not actually sure the patch is wrong, but I don't have time to investigate currently, and this line of work isn't something I'm likely to get back to quickly.
Pavel Labath [Tue, 25 Feb 2020 16:57:36 +0000 (17:57 +0100)]
Revert "[DWARFDebugLine] Avoid dumping prologue members we did not parse"
The changed test started failing on the windows bots. Reverting while I
investigate.
This reverts commit
deb116ee0a5b80f61bc341ed68606dc5ad093569.
Jay Foad [Tue, 25 Feb 2020 16:45:14 +0000 (16:45 +0000)]
AMDGPU/GlobalISel: Un-XFAIL a test
This was missed in
12fe9b26ec88bb2dd40d574a644edca302e804b2
Louis Dionne [Tue, 25 Feb 2020 16:42:08 +0000 (11:42 -0500)]
[libc++] Revert
03dd205c151 "Adjust max_align_t handling"
That commit was made without approval from a libc++ reviewer, and it
also broke the build in C++03 mode.
Louis Dionne [Mon, 24 Feb 2020 23:12:44 +0000 (18:12 -0500)]
[libc++] Proper fix for libc++'s modulemap after D68480
Summary:
In libc++, we normally #ifdef out header content instead of #erroring
out when the Standard in use is insufficient for the requirements of
the header.
Reviewers: EricWF
Subscribers: jkorous, dexonsmith, libcxx-commits, teemperor
Tags: #libc
Differential Revision: https://reviews.llvm.org/D75074
Matt Arsenault [Tue, 18 Feb 2020 03:10:27 +0000 (22:10 -0500)]
AMDGPU/GlobalISel: Use packed for G_ADD/G_SUB/G_MUL v2s16
Rong Xu [Tue, 25 Feb 2020 16:04:01 +0000 (08:04 -0800)]
[remark][diagnostics] [codegen] Fix PR44896
This patch fixes PR44896. For IR input files, option fdiscard-value-names
should be ignored as we need named values in loadModule().
Commit
60d3947922 sets this option after loadModule() where valued names
already created. This creates an inconsistent state in setNameImpl()
that leads to a seg fault.
This patch forces fdiscard-value-names to be false for IR input files.
This patch also emits a warning of "ignoring -fdiscard-value-names" if
option fdiscard-value-names is explictly enabled in the commandline for
IR input files.
Differential Revision: https://reviews.llvm.org/D74878
Anastasia Stulova [Tue, 25 Feb 2020 14:49:59 +0000 (14:49 +0000)]
[Sema][C++] Propagate conversion kind to specialize the diagnostics
Compute and propagate conversion kind to diagnostics helper in C++
to provide more specific diagnostics about incorrect implicit
conversions in assignments, initializations, params, etc...
Duplicated some diagnostics as errors because C++ is more strict.
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74116
Haojian Wu [Tue, 25 Feb 2020 16:02:08 +0000 (17:02 +0100)]
Make builtbot happy.
Disable the failing rename test, it should not be failed, needs further
investigation.
Jay Foad [Tue, 25 Feb 2020 10:31:37 +0000 (10:31 +0000)]
AMDGPU/GlobalISel: Legalize s64 min/max by lowering
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, rovka, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75108
Fangrui Song [Tue, 25 Feb 2020 05:52:47 +0000 (21:52 -0800)]
[ELF] Support archive:file syntax in input section descriptions
Fixes https://bugs.llvm.org/show_bug.cgi?id=44450
https://sourceware.org/binutils/docs/ld/Input-Section-Basics.html#Input-Section-Basics
The following two rules are not implemented.
* `archive:` matches every file in the archive.
* `:file` matches a file not in an archive.
Reviewed By: grimar, ruiu
Differential Revision: https://reviews.llvm.org/D75100
Haojian Wu [Tue, 25 Feb 2020 15:32:22 +0000 (16:32 +0100)]
[clang-rename] Add the USR of incomplete decl to the USRSet.
Summary:
This fixes a clangd rename issue, which is missing the reference of
an incomplete specialization.
Unfortunately, I didn't reproduce this issue in clang-rename, I guess
the input `FoundDecl` of AdditionalUSRFinder is different in clangd vs
clang-rename, clang-rename uses the underlying CXXRecordDecl of the
ClassTemplateDecl, which is fixed in https://github.com/llvm/llvm-project/commit/
5d862c042b52ae2aad37471d0b83b6c678a520e3;
while clangd-rename uses the ClassTemplateDecl.
Reviewers: kbobyrev
Reviewed By: kbobyrev
Subscribers: ilya-biryukov, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74829
Artem Dergachev [Mon, 17 Feb 2020 18:42:50 +0000 (21:42 +0300)]
[analyzer] Add support for CXXInheritedCtorInitExpr.
So far we've been dropping coverage every time we've encountered
a CXXInheritedCtorInitExpr. This patch attempts to add some
initial support for it.
Constructors for arguments of a CXXInheritedCtorInitExpr are still
not fully supported.
Differential Revision: https://reviews.llvm.org/D74735
Pavel Labath [Mon, 24 Feb 2020 12:32:31 +0000 (13:32 +0100)]
[DWARFDebugLine] Avoid dumping prologue members we did not parse
Summary:
This patch if motivated by D74560, specifically the subthread about what
to print upon encountering reserved initial length values.
If the debug_line prologue has an unsupported version, we skip parsing
the rest of the data. If we encounter an reserved initial length field,
we don't even parse the version. However, we still print out all members
(with value 0) in the dump function.
This patch introduces early exits in the Prologue::dump function so that
we print only the fields that were parsed successfully. In case of an
unsupported version, we skip printing all subsequent prologue fields --
because we don't even know if this version has those fields. In case of a
reserved unit length, we don't print anything -- if the very first field
of the prologue is invalid, it's hard to say if we even have a prologue
to begin with.
Note that the user will still be able to see the invalid/reserved
initial length value in the error message. I've modified (reordered)
debug_line_invalid.test to show that the error message comes straight
after the debug_line offset. I've also added some flush() calls to the
dumping code to ensure this is the case in all situations (without that,
the warnings could get out of sync if the output was not a terminal -- I
guess this is why std::iostreams have the tie() function).
Reviewers: jhenderson, ikudrin, dblaikie
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D75043
Ayke van Laethem [Tue, 4 Feb 2020 15:29:01 +0000 (16:29 +0100)]
[LLDB] Let DataExtractor deal with two-byte addresses
AVR usually uses two byte addresses. By making DataExtractor deal with
this, it is possible to load AVR binaries that don't have debug info
associated with them.
Differential Revision: https://reviews.llvm.org/D73969
Roman Lebedev [Tue, 25 Feb 2020 14:24:27 +0000 (17:24 +0300)]
[InstCombine] foldShiftIntoShiftInAnotherHandOfAndInICmp(): fix miscompile (PR44802)
Much like with reassociateShiftAmtsOfTwoSameDirectionShifts(),
as input, we have the following pattern:
icmp eq/ne (and ((x shift Q), (y oppositeshift K))), 0
We want to rewrite that as:
icmp eq/ne (and (x shift (Q+K)), y), 0 iff (Q+K) u< bitwidth(x)
While we know that originally (Q+K) would not overflow
(because 2 * (N-1) u<= iN -1), we may have looked past extensions of
shift amounts. so it may now overflow in smaller bitwidth.
To ensure that does not happen, we need to ensure that the total maximal
shift amount is still representable in that smaller bitwidth.
If the overflow would happen, (Q+K) u< bitwidth(x) check would be bogus.
https://bugs.llvm.org/show_bug.cgi?id=44802
Roman Lebedev [Tue, 25 Feb 2020 14:14:43 +0000 (17:14 +0300)]
[NFC][InstCombine] Add shift amount reassociation in bittest miscompile example from PR44802
https://bugs.llvm.org/show_bug.cgi?id=44802
Roman Lebedev [Tue, 25 Feb 2020 13:48:36 +0000 (16:48 +0300)]
[InstCombine] reassociateShiftAmtsOfTwoSameDirectionShifts(): fix miscompile (PR44802)
As input, we have the following pattern:
Sh0 (Sh1 X, Q), K
We want to rewrite that as:
Sh x, (Q+K) iff (Q+K) u< bitwidth(x)
While we know that originally (Q+K) would not overflow
(because 2 * (N-1) u<= iN -1), we may have looked past extensions of
shift amounts. so it may now overflow in smaller bitwidth.
To ensure that does not happen, we need to ensure that the total maximal
shift amount is still representable in that smaller bitwidth.
If the overflow would happen, (Q+K) u< bitwidth(x) check would be bogus.
https://bugs.llvm.org/show_bug.cgi?id=44802
Roman Lebedev [Tue, 25 Feb 2020 13:06:13 +0000 (16:06 +0300)]
[NFC][InstCombine] Add shift amount reassociation miscompile example from PR44802
https://bugs.llvm.org/show_bug.cgi?id=44802
Benjamin Kramer [Tue, 25 Feb 2020 15:03:06 +0000 (16:03 +0100)]
Make test not write to the source directory
Jay Foad [Tue, 25 Feb 2020 14:38:57 +0000 (14:38 +0000)]
[AMDGPU] Precommit some test updates for D68338 "Remove dubious logic in bidirectional list scheduler"
Nico Weber [Mon, 24 Feb 2020 21:07:16 +0000 (16:07 -0500)]
clang-cl: Add a `/showIncludes:user` flag.
This flag is like /showIncludes, but it only includes user headers and
omits system headers (similar to MD and MMD). The motivation is that
projects that already track system includes though other means can use
this flag to get consistent behavior on Windows and non-Windows, and it
saves tools that output /showIncludes output (e.g. ninja) some work.
implementation-wise, this makes `HeaderIncludesCallback` honor the
existing `IncludeSystemHeaders` bit, and changes the three clients of
`HeaderIncludesCallback` (`/showIncludes`, `-H`, `CC_PRINT_HEADERS=1`)
to pass `-sys-header-deps` to set that bit -- except for
`/showIncludes:user`, which doesn't pass it.
Differential Revision: https://reviews.llvm.org/D75093
Kristóf Umann [Fri, 20 Sep 2019 09:01:45 +0000 (11:01 +0200)]
[analyzer][MallocChecker][NFC] Change the use of IdentifierInfo* to CallDescription
Exactly what it says on the tin! I decided not to merge this with the patch that
changes all these to a CallDescriptionMap object, so the patch is that much more
trivial.
Differential Revision: https://reviews.llvm.org/D68163
Kadir Cetinkaya [Wed, 19 Feb 2020 18:11:01 +0000 (19:11 +0100)]
[clangd] Migrate Lexer usages in TypeHierarchy to TokenBuffers
Summary:
Also fixes a bug, resulting from directly using ND.getEndLoc() for end
location of the range. As ND.getEndLoc() points to the begining of the last
token, whereas it should point one past the end, since LSP ranges are half open
(exclusive on the end).
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74850