Amaury Sechet [Sat, 2 Mar 2019 20:12:25 +0000 (20:12 +0000)]
Add test case for add to sub transformation. NFC
llvm-svn: 355277
Pavel Labath [Sat, 2 Mar 2019 19:58:10 +0000 (19:58 +0000)]
Reinstate UNSUPPORTED: linux on stop-hook-threads.test
This stanza was removed in r355213, but it seems that patch did not
fully fix the problem, as the test still fails sporadically
(particularly under heavy load) on linux.
llvm-svn: 355276
Nico Weber [Sat, 2 Mar 2019 18:29:56 +0000 (18:29 +0000)]
gn build: Add a cfi/sources target.
This build target is currently unused, but after r355144 the sync script
started complaining about cfi.cpp not being listed, and this makes the
script happy again.
llvm-svn: 355275
Michal Gorny [Sat, 2 Mar 2019 16:48:44 +0000 (16:48 +0000)]
[lldb] [lit] Pass -pthread on NetBSD as well
llvm-svn: 355274
Michal Gorny [Sat, 2 Mar 2019 16:46:29 +0000 (16:46 +0000)]
[lldb] [lldbtest] Fix getBuildFlags() not to use libstdc++ on NetBSD
Remove the code forcing -stdlib=libstdc++ on NetBSD in getBuildFlags()
method. NetBSD uses libc++ everywhere else, and using libstdc++ here
causes lang/cpp/dynamic-value to fail to build.
Differential Revision: https://reviews.llvm.org/D58871
llvm-svn: 355273
Sanjay Patel [Sat, 2 Mar 2019 16:45:10 +0000 (16:45 +0000)]
[InstCombine] move add after smin/smax
Follow-up to rL355221.
This isn't specifically called for within PR14613,
but we'll get there eventually if it's not already
requested in some other bug report.
https://rise4fun.com/Alive/5b0
Name: smax
Pre: WillNotOverflowSignedSub(C1,C0)
%a = add nsw i8 %x, C0
%cond = icmp sgt i8 %a, C1
%r = select i1 %cond, i8 %a, i8 C1
=>
%c2 = icmp sgt i8 %x, C1-C0
%u2 = select i1 %c2, i8 %x, i8 C1-C0
%r = add nsw i8 %u2, C0
Name: smin
Pre: WillNotOverflowSignedSub(C1,C0)
%a = add nsw i32 %x, C0
%cond = icmp slt i32 %a, C1
%r = select i1 %cond, i32 %a, i32 C1
=>
%c2 = icmp slt i32 %x, C1-C0
%u2 = select i1 %c2, i32 %x, i32 C1-C0
%r = add nsw i32 %u2, C0
llvm-svn: 355272
Sanjay Patel [Sat, 2 Mar 2019 16:45:05 +0000 (16:45 +0000)]
[InstCombine] add tests for add+smin/smax; NFC
llvm-svn: 355271
Pavel Labath [Sat, 2 Mar 2019 16:23:07 +0000 (16:23 +0000)]
Fix gcc build for r355249
automatic move should not fire when returning type T in a function with
result type Expected<T>. Some compilers seem to allow that nonetheless.
llvm-svn: 355270
Amaury Sechet [Sat, 2 Mar 2019 14:28:59 +0000 (14:28 +0000)]
Add test case for add to sub transformation. NFC
llvm-svn: 355269
Simon Pilgrim [Sat, 2 Mar 2019 11:14:01 +0000 (11:14 +0000)]
Fix update_mir_test_checks.py to run on python3
Split off from D58817
Differential Revision: https://reviews.llvm.org/D58820
llvm-svn: 355268
Simon Pilgrim [Sat, 2 Mar 2019 11:11:22 +0000 (11:11 +0000)]
Use SDValue::getConstantOperandAPInt helper where possible. NFCI.
llvm-svn: 355267
Paul Hoad [Sat, 2 Mar 2019 09:08:51 +0000 (09:08 +0000)]
[clang-format] clang-format off/on not respected when using C Style comments
Summary:
If the clang-format on/off is in a /* comment */ then the sorting of headers is not ignored
PR40901 - https://bugs.llvm.org/show_bug.cgi?id=40901
Reviewers: djasper, klimek, JonasToth, krasimir, alexfh
Reviewed By: alexfh
Subscribers: alexfh, cfe-commits, llvm-commits
Tags: #clang, #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D58819
llvm-svn: 355266
Xing GUO [Sat, 2 Mar 2019 08:32:32 +0000 (08:32 +0000)]
[Transforms] fix typo in test case. NFC.
llvm-svn: 355265
Xing GUO [Sat, 2 Mar 2019 08:03:59 +0000 (08:03 +0000)]
[Codegen] fix typos in test case
llvm-svn: 355264
Sam Clegg [Sat, 2 Mar 2019 04:55:02 +0000 (04:55 +0000)]
[WebAssembly] Fix crash when __wasm_call_ctor is GCd in programs containing static init/fini
Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58864
llvm-svn: 355263
Xing GUO [Sat, 2 Mar 2019 04:20:28 +0000 (04:20 +0000)]
[llvm-objdump] Should print unknown d_tag in hex format
Summary:
Currently, `llvm-objdump` prints "unknown" instead of d_tag value in hex format. Because getDynamicTagAsString returns "unknown" rather than empty
string.
Reviewers: grimar, jhenderson
Reviewed By: jhenderson
Subscribers: rupprecht, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58763
llvm-svn: 355262
Thomas Lively [Sat, 2 Mar 2019 03:32:25 +0000 (03:32 +0000)]
[WebAssembly] Expand operations not supported by SIMD
Summary:
This prevents crashes in instruction selection when these operations
are used. The tests check that the scalar version of the instruction
is used where applicable, although some expansions do not use the
scalar version.
Reviewers: aheejin
Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58859
llvm-svn: 355261
Amaury Sechet [Sat, 2 Mar 2019 02:44:16 +0000 (02:44 +0000)]
[X86] Improve use of SHLD/SHRD
Summary:
This extends the variety of pattern that can generate a SHLD instead of using two shifts.
This fixes a regression that would be introduced by D57367 or D33587
Reviewers: RKSimon, craig.topper
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D57389
llvm-svn: 355260
Florian Hahn [Sat, 2 Mar 2019 02:31:44 +0000 (02:31 +0000)]
[SCEV] Handle case where MaxBECount is less precise than ExactBECount for OR.
In some cases, MaxBECount can be less precise than ExactBECount for AND
and OR (the AND case was PR26207). In the OR test case, both ExactBECounts are
undef, but MaxBECount are different, so we hit the assertion below. This
patch uses the same solution the AND case already uses.
Assertion failed:
((isa<SCEVCouldNotCompute>(ExactNotTaken) || !isa<SCEVCouldNotCompute>(MaxNotTaken))
&& "Exact is not allowed to be less precise than Max"), function ExitLimit
This patch also consolidates test cases for both AND and OR in a single
test case.
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=13245
Reviewers: sanjoy, efriedma, mkazantsev
Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D58853
llvm-svn: 355259
Amaury Sechet [Sat, 2 Mar 2019 02:24:36 +0000 (02:24 +0000)]
Add test case for truncate funnel shifts. NFC
llvm-svn: 355258
Florian Hahn [Sat, 2 Mar 2019 01:57:28 +0000 (01:57 +0000)]
[SCEV] Remove undef check for SCEVConstant (NFC)
The value stored in SCEVConstant is of type ConstantInt*, which can
never be UndefValue. So we should never hit that code.
Reviewers: mkazantsev, sanjoy
Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D58851
llvm-svn: 355257
Evgeniy Stepanov [Sat, 2 Mar 2019 01:33:52 +0000 (01:33 +0000)]
Revert "[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors."
Breaks TSan on Mac, which does
return REAL(func)(...
in COMMON_INTERCEPTOR_ENTER, which is not OK when REAL(func) has return
type of void.
llvm-svn: 355256
Vlad Tsyrklevich [Sat, 2 Mar 2019 01:10:00 +0000 (01:10 +0000)]
Revert "[DWARFFormValue] Cleanup DWARFFormValue interface. (2/2) (NFC)"
This reverts commit r355233, it was causing UBSan failures.
llvm-svn: 355255
Thomas Lively [Sat, 2 Mar 2019 00:55:16 +0000 (00:55 +0000)]
Revert "[WebAssembly][WIP] Expand operations not supported by SIMD"
This was accidentally committed without tests or review.
llvm-svn: 355254
Tom Stellard [Sat, 2 Mar 2019 00:50:13 +0000 (00:50 +0000)]
lib/Header: Simplify CMakeLists.txt
Summary:
Replace cut and pasted code with cmake macros and reduce the number of
install commands. This fixes an issue where the headers were being
installed twice.
This clean up should also make future modifications easier, like
adding a cmake option to install header files into a custom resource
directory.
Reviewers: chandlerc, smeenai, mgorny, beanz, phosek
Reviewed By: smeenai
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58537
llvm-svn: 355253
Mandeep Singh Grang [Sat, 2 Mar 2019 00:47:43 +0000 (00:47 +0000)]
[ProfileData] Sort FuncData before iteration to remove non-determinism
Reviewers: rsmith, bogner, dblaikie
Reviewed By: dblaikie
Subscribers: Hahnfeld, jdoerfert, vsk, dblaikie, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D57986
llvm-svn: 355252
Vlad Tsyrklevich [Sat, 2 Mar 2019 00:46:54 +0000 (00:46 +0000)]
Revert "Revert "[sanitizers] Don't use Windows Trace Logging on MinGW""
This reverts my orignal revert in r355250, I misread the buildbot logs.
Volodymyr's commit in r355244 fixed the build.
llvm-svn: 355251
Vlad Tsyrklevich [Sat, 2 Mar 2019 00:39:36 +0000 (00:39 +0000)]
Revert "[sanitizers] Don't use Windows Trace Logging on MinGW"
This reverts commits r355236 and r355244, they broke the Linux sanitizer
build.
llvm-svn: 355250
Jonas Devlieghere [Sat, 2 Mar 2019 00:20:26 +0000 (00:20 +0000)]
[Reproducers] Capture and replay interpreter commands.
This patch adds the necessary logic to capture and replay commands
entered into the command interpreter. A DataRecorder shadows the input
and writes its data to a know file. During replay this file is used as
the command interpreter's input.
It's possible to the command interpreter more than once, with a
different input source. We support this scenario by using multiple
buffers. The synchronization for this takes place at the SB layer, where
we create a new recorder every time the debugger input is changed.
During replay we use the corresponding buffer as input.
Differential revision: https://reviews.llvm.org/D58564
llvm-svn: 355249
Thomas Lively [Sat, 2 Mar 2019 00:18:09 +0000 (00:18 +0000)]
[WebAssembly] Temporarily disable bulk-memory with -pthread
Summary:
To prevent the instability of bulk-memory in the wasm backend from
blocking separate pthread testing, temporarily remove the logic that
adds -mbulk-memory in the presence of -pthread. Since browsers will
ship bulk memory before or alongside threads, this change will be
reverted as soon as bulk memory has stabilized in the backend.
Reviewers: sbc100
Subscribers: dschuff, jgravelle-google, aheejin, sunfish, jfb, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58854
llvm-svn: 355248
Thomas Lively [Sat, 2 Mar 2019 00:18:07 +0000 (00:18 +0000)]
[WebAssembly][WIP] Expand operations not supported by SIMD
llvm-svn: 355247
Mandeep Singh Grang [Sat, 2 Mar 2019 00:14:10 +0000 (00:14 +0000)]
[llvm] Fix typo: 's/analsyis/analysis/' [NFC]
llvm-svn: 355246
Daniel Sanders [Sat, 2 Mar 2019 00:12:57 +0000 (00:12 +0000)]
[tblgen] Track CodeInit origins when possible
Summary:
Add an SMLoc to CodeInit that records the source line it originated from.
This allows tablegen to point precisely at portions of code when reporting
errors within the CodeInit. For example, in the upcoming GlobalISel
combiner, it can report undefined expansions and point at the instance of
the expansion. This is achieved using something like:
SMLoc::getFromPointer(SMLoc::getPointer() +
(StringRef - CodeInit::getValue()))
The location is lost when producing a CodeInit by string concatenation so
a fallback SMLoc is required (e.g. the Record::getLoc()) but that's pretty
rare for CodeInits.
There's a reasonable case for extending tracking of a couple other Init
objects, for example StringInit's are often parsed and it would be good to
point inside the string when reporting errors about that. However, location
tracking also harms de-duplication. This is fine for CodeInit where there's
only a few hundred of them (~160 for X86) and it may be worth it for
StringInit (~86k up to ~1.9M for roughly 15MB increase for X86).
However the origin tracking would be a _terrible_ idea for IntInit, BitInit,
and UnsetInit. I haven't measured either of those three but BitInit would
most likely be on the order of increasing the current 2 BitInit values up
to billions.
Reviewers: volkan, aditya_nandakumar, bogner, paquette, aemerson
Reviewed By: paquette
Subscribers: javed.absar, kristof.beyls, dexonsmith, llvm-commits, kristina
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58141
llvm-svn: 355245
Volodymyr Sapsai [Sat, 2 Mar 2019 00:05:04 +0000 (00:05 +0000)]
[sanitizers] Fix build on macOS with LogFullErrorReport redefinition error.
macOS has implementation of LogFullErrorReport and
INLINE void LogFullErrorReport(const char *buffer) {}
was causing
> compiler-rt/lib/sanitizer_common/sanitizer_mac.cc:658:6: error: redefinition of 'LogFullErrorReport'
Fixup for r355236.
rdar://problem/
48526020
llvm-svn: 355244
Caroline Tice [Fri, 1 Mar 2019 23:51:54 +0000 (23:51 +0000)]
llvm-dwarfdump: Add new variable, parameter and inlining statistics; also function source location statistics.
Add statistics for abstract origins, function, variable and parameter
locations; break the 'variable' counts down into variables and
parameters. Also update call site counting to check for
DW_AT_call_{file,line} in addition to DW_TAG_call_site.
Differential revision: https://reviews.llvm.org/D58849
llvm-svn: 355243
Julian Lettner [Fri, 1 Mar 2019 23:50:47 +0000 (23:50 +0000)]
[NFC][Sanitizer] Replace last uses of old Unwind API
Replace remaining uses of old Unwind API in unit tests.
Allows us to remove the old API and WillUseFastUnwind can be made
private.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D58754
llvm-svn: 355242
Louis Dionne [Fri, 1 Mar 2019 22:55:15 +0000 (22:55 +0000)]
[libc++abi] Specify unwind lib before other system libraries when linking
This matters on OSX because static linking orders is also the order dyld
uses to search for libs (the default - Two-level namespace). If system
libs (including unwind lib) are specified before local unwind lib, local
unwind lib would never be picked up by dyld.
Before:
$ otool -L lib/libc++abi.dylib
@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
@rpath/libunwind.1.dylib (compatibility version 1.0.0, current version 1.0.0)
After:
$ otool -L lib/libc++abi.dylib
@rpath/libc++abi.1.dylib (compatibility version 1.0.0, current version 1.0.0)
@rpath/libunwind.1.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.200.5)
Thanks to Yuanfang Chen for the patch.
Differential Revision: https://reviews.llvm.org/D57496
llvm-svn: 355241
Sam Clegg [Fri, 1 Mar 2019 22:35:47 +0000 (22:35 +0000)]
[WebAssebmly] Allow __wasm_call_ctors to be GC'ed
Differential Revision: https://reviews.llvm.org/D58806
llvm-svn: 355240
Julian Lettner [Fri, 1 Mar 2019 22:35:40 +0000 (22:35 +0000)]
[NFC][Sanitizer] Test unexpectedly passes on ppc64be bot
llvm-svn: 355239
Adrian Prantl [Fri, 1 Mar 2019 22:30:31 +0000 (22:30 +0000)]
Delete commented-out code.
llvm-svn: 355238
Martin Storsjo [Fri, 1 Mar 2019 22:30:17 +0000 (22:30 +0000)]
[CMake] Don't use llvm_replace_compiler_option
Building compiler-rt standalone outside of the main llvm
tree is supported, and in this case, the llvm cmake modules
are unavailable. (And even if they are available, it requires
including LLVMProcessSources.cmake, which currently isn't
included.)
This fixes building compiler-rt standalone with MSVC/clang-cl.
Differential Revision: https://reviews.llvm.org/D58767
llvm-svn: 355237
Martin Storsjo [Fri, 1 Mar 2019 22:30:14 +0000 (22:30 +0000)]
[sanitizers] Don't use Windows Trace Logging on MinGW
mingw-w64 currently is lacking the headers for this feature.
Make the include lowercase at the same time. We consistently
use lowercase for windows header includes, as windows itself is
case insensitive, the SDK headers (in general, not necessarily
considering this particular header) aren't consistent among themselves
about what the proper canonical capitalization for headers are,
and MinGW uses all lowercase names for the headers (as it is often
used on case sensitive filesystems).
In case mingw-w64 later gets this header, we can revert this
(but keep the include lowercased).
Differential Revision: https://reviews.llvm.org/D58765
llvm-svn: 355236
Paul Robinson [Fri, 1 Mar 2019 22:28:13 +0000 (22:28 +0000)]
Try to fix Windows bots after r355226.
Windows has two path separator characters.
llvm-svn: 355235
Julian Lettner [Fri, 1 Mar 2019 22:26:45 +0000 (22:26 +0000)]
[NFC][Sanitizer][Windows] Fix refactoring oversight
Fix mistake in previous commit:
9fe3b4906f351292691cd594b30fe6cf7230b94d
llvm-svn: 355234
Jonas Devlieghere [Fri, 1 Mar 2019 22:14:24 +0000 (22:14 +0000)]
[DWARFFormValue] Cleanup DWARFFormValue interface. (2/2) (NFC)
Continues the work started in r354941. Changes (all but one) uses of the
extractValue to static createFromData.
llvm-svn: 355233
Julian Lettner [Fri, 1 Mar 2019 22:10:49 +0000 (22:10 +0000)]
[NFC][Sanitizer] Make GetStackTrace a private method of BufferedStackTrace
GetStackTrace is a implementation detail of BufferedStackTrace. Make it
a private method.
Reviewed By: vitalybuka
Differential-Revision: https://reviews.llvm.org/D58753
llvm-svn: 355232
Evgeniy Stepanov [Fri, 1 Mar 2019 21:59:18 +0000 (21:59 +0000)]
[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.
llvm-svn: 355231
Evgeniy Stepanov [Fri, 1 Mar 2019 21:49:40 +0000 (21:49 +0000)]
Revert "[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors."
This change is incomplete.
llvm-svn: 355230
Stefan Pintilie [Fri, 1 Mar 2019 21:16:45 +0000 (21:16 +0000)]
[OPENMP] Deal with additional store inserted by Clang under -fno-PIC for PowerPC.
Changing the default from -fPIC to -fno-PIC on PowerPC exposed an issue in
OpenMP for PowerPC.
The issue is reported here:
https://bugs.llvm.org/show_bug.cgi?id=40082
This is a fix for that issue.
Also removed the XFAIL from the two tests that were failing under -fno-PIC.
Differential Revision: https://reviews.llvm.org/D56286
llvm-svn: 355229
Craig Topper [Fri, 1 Mar 2019 21:02:40 +0000 (21:02 +0000)]
[X86] Remove IntrArgMemOnly from target specific gather/scatter intrinsics
IntrArgMemOnly implies that only memory pointed to by pointer typed arguments will be accessed. But these intrinsics allow you to pass null to the pointer argument and put the full address into the index argument. Other passes won't be able to understand this.
A colleague found that ISPC was creating gathers like this and then dead store elimination removed some stores because it didn't understand what the gather was doing since the pointer argument was null.
Differential Revision: https://reviews.llvm.org/D58805
llvm-svn: 355228
Craig Topper [Fri, 1 Mar 2019 21:02:34 +0000 (21:02 +0000)]
[X86] Add test case for D58805. NFC
This demonstrates dead store elimination removing a store that may alias a gather that uses null as its base.
llvm-svn: 355227
Paul Robinson [Fri, 1 Mar 2019 20:58:04 +0000 (20:58 +0000)]
[DWARF] Make -g with empty assembler source work better.
This was sometimes causing clang or llvm-mc to crash, and in other
cases could emit a bogus DWARF line-table header. I did an interim
patch in r352541; this patch should be a cleaner and more complete
fix, and retains the test.
Addresses PR40538.
Differential Revision: https://reviews.llvm.org/D58750
llvm-svn: 355226
Evgeniy Stepanov [Fri, 1 Mar 2019 20:54:16 +0000 (20:54 +0000)]
[sanitizer] Fix return type of __bzero and __aeabi_mem* interceptors.
They return void, unlike memset/memcpy/memmove.
llvm-svn: 355225
Craig Topper [Fri, 1 Mar 2019 20:18:38 +0000 (20:18 +0000)]
[TableGen][SelectionDAG][X86] Add specific isel matchers for immAllZerosV/immAllOnesV. Remove bitcasts from X86 patterns that are no longer necessary.
Previously we had build_vector PatFrags that called ISD::isBuildVectorAllZeros/Ones. Internally the ISD::isBuildVectorAllZeros/Ones look through bitcasts, but we aren't able to take advantage of that in isel. Instead of we have to canonicalize the types of the all zeros/ones build_vectors and insert bitcasts. Then we have to pattern match those exact bitcasts.
By emitting specific matchers for these 2 nodes, we can make isel look through any bitcasts without needing to explicitly match them. We should also be able to remove the canonicalization to vXi32 from lowering, but I've left that for a follow up.
This removes something like 40,000 bytes from the X86 isel table.
Differential Revision: https://reviews.llvm.org/D58595
llvm-svn: 355224
Nikita Popov [Fri, 1 Mar 2019 20:07:04 +0000 (20:07 +0000)]
[ValueTracking] Known bits support for unsigned saturating add/sub
We have two sources of known bits:
1. For adds leading ones of either operand are preserved. For sub
leading zeros of LHS and leading ones of RHS become leading zeros in
the result.
2. The saturating math is a select between add/sub and an all-ones/
zero value. As such we can carry out the add/sub known bits
calculation, and only preseve the known one/zero bits respectively.
Differential Revision: https://reviews.llvm.org/D58329
llvm-svn: 355223
Philip Reames [Fri, 1 Mar 2019 19:50:36 +0000 (19:50 +0000)]
[InstCombine] Extend saturating idempotent atomicrmw transform to FP
I'm assuming that the nan propogation logic for InstructonSimplify's handling of fadd and fsub is correct, and applying the same to atomicrmw.
Differential Revision: https://reviews.llvm.org/D58836
llvm-svn: 355222
Sanjay Patel [Fri, 1 Mar 2019 19:42:40 +0000 (19:42 +0000)]
[InstCombine] move add after umin/umax
In the motivating cases from PR14613:
https://bugs.llvm.org/show_bug.cgi?id=14613
...moving the add enables us to narrow the
min/max which eliminates zext/trunc which
enables signficantly better vectorization.
But that bug is still not completely fixed.
https://rise4fun.com/Alive/5KQ
Name: umax
Pre: C1 u>= C0
%a = add nuw i8 %x, C0
%cond = icmp ugt i8 %a, C1
%r = select i1 %cond, i8 %a, i8 C1
=>
%c2 = icmp ugt i8 %x, C1-C0
%u2 = select i1 %c2, i8 %x, i8 C1-C0
%r = add nuw i8 %u2, C0
Name: umin
Pre: C1 u>= C0
%a = add nuw i32 %x, C0
%cond = icmp ult i32 %a, C1
%r = select i1 %cond, i32 %a, i32 C1
=>
%c2 = icmp ult i32 %x, C1-C0
%u2 = select i1 %c2, i32 %x, i32 C1-C0
%r = add nuw i32 %u2, C0
llvm-svn: 355221
Sanjay Patel [Fri, 1 Mar 2019 19:42:34 +0000 (19:42 +0000)]
[InstCombine] add tests for umin/umax narrowing (PR14613); NFC
llvm-svn: 355220
Vlad Tsyrklevich [Fri, 1 Mar 2019 18:58:22 +0000 (18:58 +0000)]
Revert "[MIPS GlobalISel] Fix mul operands"
This reverts commit r355178, it is causing ASan failures on the
sanitizer bots.
llvm-svn: 355219
Peter Collingbourne [Fri, 1 Mar 2019 18:53:41 +0000 (18:53 +0000)]
ELF: Change FileSize back to a uint64_t.
This lets us detect file size overflows when creating a 64-bit binary on
a 32-bit machine.
Differential Revision: https://reviews.llvm.org/D58840
llvm-svn: 355218
Philip Reames [Fri, 1 Mar 2019 18:45:05 +0000 (18:45 +0000)]
[LICM] Infer proper alignment from loads during scalar promotion
This patch fixes an issue where we would compute an unnecessarily small alignment during scalar promotion when no store is not to be guaranteed to execute, but we've proven load speculation safety. Since speculating a load requires proving the existing alignment is valid at the new location (see Loads.cpp), we can use the alignment fact from the load.
For non-atomics, this is a performance problem. For atomics, this is a correctness issue, though an *incredibly* rare one to see in practice. For atomics, we might not be able to lower an improperly aligned load or store (i.e. i32 align 1). If such an instruction makes it all the way to codegen, we *may* fail to codegen the operation, or we may simply generate a slow call to a library function. The part that makes this super hard to see in practice is that the memory location actually *is* well aligned, and instcombine knows that. So, to see a failure, you have to have a) hit the bug in LICM, b) somehow hit a depth limit in InstCombine/ValueTracking to avoid fixing the alignment, and c) then have generated an instruction which fails codegen rather than simply emitting a slow libcall. All around, pretty hard to hit.
Differential Revision: https://reviews.llvm.org/D58809
llvm-svn: 355217
Rong Xu [Fri, 1 Mar 2019 18:36:24 +0000 (18:36 +0000)]
[PGO] Remove the default parameter in ProfileSummary API. NFC
Remove the default parameter in setProfileSummary() and getSummary().
This is a follow-up of r355131.
llvm-svn: 355216
Philip Reames [Fri, 1 Mar 2019 18:24:05 +0000 (18:24 +0000)]
[Tests] More missing atomicrmw combines
llvm-svn: 355215
Evgeniy Stepanov [Fri, 1 Mar 2019 18:22:44 +0000 (18:22 +0000)]
[msan] Add an interceptor for ttyname().
llvm-svn: 355214
Jim Ingham [Fri, 1 Mar 2019 18:13:38 +0000 (18:13 +0000)]
Resubmit r354706 with a fix for process launch.
When the debugger is run in sync mode, you need to
be able to tell whether a hijacked resume is for some
special purpose (like waiting for the SIGSTOP on attach)
or just to perform a synchronous resume. Target::Launch was doing
that wrong, and that caused stop-hooks on process launch
in source files to behave incorrectly.
<rdar://problem/
48115661>
Differential Revision: https://reviews.llvm.org/D58727
llvm-svn: 355213
Philip Reames [Fri, 1 Mar 2019 18:10:37 +0000 (18:10 +0000)]
[Tests] Add tests for missed optimizations of saturating and idempotent FP atomicrmws
llvm-svn: 355212
Matt Davis [Fri, 1 Mar 2019 18:01:41 +0000 (18:01 +0000)]
[lld][test] Fix tests. llvm-readobj now emits symbol section names.
This is the result of patch
99e9c4cad08164b9c0ca565ab9ad48ce132e98e5
See the related patch https://reviews.llvm.org/D58796
llvm-svn: 355211
Philip Reames [Fri, 1 Mar 2019 18:00:07 +0000 (18:00 +0000)]
[InstCombine] Extend "idempotent" atomicrmw optimizations to floating point
An idempotent atomicrmw is one that does not change memory in the process of execution. We have already added handling for the various integer operations; this patch extends the same handling to floating point operations which were recently added to IR.
Note: At the moment, we canonicalize idempotent fsub to fadd when ordering requirements prevent us from using a load. As discussed in the review, I will be replacing this with canonicalizing both floating point ops to integer ops in the near future.
Differential Revision: https://reviews.llvm.org/D58251
llvm-svn: 355210
Rong Xu [Fri, 1 Mar 2019 17:50:20 +0000 (17:50 +0000)]
[PGO] Use the explicit parameter in ProfileSummary API. NFC
Use the explicit parameter in setProfileSummary() and getSummary().
This is a follow-up of r355131.
llvm-svn: 355209
Thomas Lively [Fri, 1 Mar 2019 17:43:55 +0000 (17:43 +0000)]
Revert "[WebAssembly] Lower SIMD shifts since they are fixed in V8"
They weren't fixed in V8. Oops.
llvm-svn: 355208
Matt Davis [Fri, 1 Mar 2019 17:31:32 +0000 (17:31 +0000)]
[llvm-readobj] Display section names for STT_SECTION symbols.
Summary:
This patch will obtain the section name for symbols that refer to a section. Prior to this patch the Name field for STT_SECTIONs was blank, now it is populated.
Before:
```
Symbol table '.symtab' contains 6 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1:
0000000000000000 0 SECTION LOCAL DEFAULT 1
2:
0000000000000000 0 SECTION LOCAL DEFAULT 3
3:
0000000000000000 0 SECTION LOCAL DEFAULT 4
4:
0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _GLOBAL_OFFSET_TABLE_
5:
0000000000000000 0 TLS GLOBAL DEFAULT UND sym
```
With this patch:
```
Symbol table '.symtab' contains 6 entries:
Num: Value Size Type Bind Vis Ndx Name
0:
0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1:
0000000000000000 0 SECTION LOCAL DEFAULT 1 .text
2:
0000000000000000 0 SECTION LOCAL DEFAULT 3 .data
3:
0000000000000000 0 SECTION LOCAL DEFAULT 4 .bss
4:
0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _GLOBAL_OFFSET_TABLE_
5:
0000000000000000 0 TLS GLOBAL DEFAULT UND sym
```
This fixes PR40788
Reviewers: jhenderson, rupprecht, espindola
Reviewed By: rupprecht
Subscribers: emaste, javed.absar, arichardson, MaskRay, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58796
llvm-svn: 355207
Sanjay Patel [Fri, 1 Mar 2019 17:29:10 +0000 (17:29 +0000)]
[InstCombine] add tests for add+umin/umax canonicalization; NFC
Fixing this should solve the biggest part of the vector problems seen in:
https://bugs.llvm.org/show_bug.cgi?id=14613
llvm-svn: 355206
Jonas Hahnfeld [Fri, 1 Mar 2019 17:15:21 +0000 (17:15 +0000)]
Hide two unused debugging methods, NFCI.
GCC correctly moans that PlainCFGBuilder::isExternalDef(llvm::Value*) and
StackSafetyDataFlowAnalysis::verifyFixedPoint() are defined but not used
in Release builds. Hide them behind 'ifndef NDEBUG'.
llvm-svn: 355205
Clement Courbet [Fri, 1 Mar 2019 16:42:08 +0000 (16:42 +0000)]
Reland "[compiler-rt] Intercept the bcmp() function."
Fix test issues on darwin: The REQUIRES for the test should be the same as the
guard for whether we intercept bcmp.
llvm-svn: 355204
Kostya Kortchinsky [Fri, 1 Mar 2019 15:46:23 +0000 (15:46 +0000)]
[scudo][standalone] Fix tests makefile
Summary:
A missing `STATIC` entailed some annoying to debug failures wrt 32 vs 64
binaries. Additionally I noticed I was using the wrong variable (the Scudo
one as opposed to the Scudo Standalone one).
See https://reviews.llvm.org/D58184#1412417 and below for discussion.
Reviewers: vitalybuka, eugenis, brzycki
Reviewed By: vitalybuka, brzycki
Subscribers: mgorny, delcypher, #sanitizers, llvm-commits
Tags: #llvm, #sanitizers
Differential Revision: https://reviews.llvm.org/D58794
llvm-svn: 355203
Manman Ren [Fri, 1 Mar 2019 15:25:24 +0000 (15:25 +0000)]
Try to fix NetBSD buildbot breakage introduced in D57463.
By including the header file in the source.
llvm-svn: 355202
Oliver Stannard [Fri, 1 Mar 2019 14:20:28 +0000 (14:20 +0000)]
[ARM] Fix FP16 stack loads/stores for Thumb2 with frame pointer
The new addressing mode added for the v8.2A FP16 instructions uses bit 8 of the
immediate to encode the sign of the offset, like the other FP loads/stores, so
need to be treated the same way.
Differential revision: https://reviews.llvm.org/D58816
llvm-svn: 355201
Eric Liu [Fri, 1 Mar 2019 14:17:55 +0000 (14:17 +0000)]
[clangd] Enable SuggestMissingIncludes by default.
Summary: This seems to work stably now. Turn on by default.
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D58772
llvm-svn: 355200
Oliver Stannard [Fri, 1 Mar 2019 13:58:25 +0000 (13:58 +0000)]
[ARM] Consider undefined-on-NaN conditions in checkVSELConstraints
This function was not checking for the condition code variants which are
undefined if either input is NaN, so we were missing selection of the VSEL
instruction in some cases when using -fno-honor-nans or -ffast-math.
Differential revision: https://reviews.llvm.org/D58812
llvm-svn: 355199
Simon Pilgrim [Fri, 1 Mar 2019 13:13:40 +0000 (13:13 +0000)]
[X86] Regenerate legalize test files
Noticed while getting update_mir_test_checks.py to work on python3
llvm-svn: 355198
Simon Pilgrim [Fri, 1 Mar 2019 12:08:50 +0000 (12:08 +0000)]
[Thumb] Add some integer abs testcases for different typesizes.
Committed on behalf of @ikulagin (Ivan Kulagin)
Differential Revision: https://reviews.llvm.org/D52138
llvm-svn: 355197
George Rimar [Fri, 1 Mar 2019 10:58:45 +0000 (10:58 +0000)]
[LLD][ELF] - Convert 3 testcases to use yaml instead of binaries.
This change makes 3 tests to use yaml instead of binaries.
Differential revision: https://reviews.llvm.org/D58780
llvm-svn: 355196
Peter Smith [Fri, 1 Mar 2019 10:52:25 +0000 (10:52 +0000)]
[ELF][ARM] Fix clang-armv7-linux-build-cache builds of LLD [NFC]
r355153 introduced a build failure on a build bot that uses clang natively
on an armv7-a machine. This a temporary fix to use size_t rather than
uint64_t.
llvm-svn: 355195
George Rimar [Fri, 1 Mar 2019 10:37:51 +0000 (10:37 +0000)]
[LLD][ELF] - Convert invalid/undefined-local-symbol-in-dso.test to use YAML
This removes a binary from the inputs and reduces the test case.
Differential revision: https://reviews.llvm.org/D58783
llvm-svn: 355194
George Rimar [Fri, 1 Mar 2019 10:18:16 +0000 (10:18 +0000)]
[yaml2obj] - Allow setting custom sh_info for RawContentSection sections.
This is for tweaking SHT_SYMTAB sections.
Their sh_info contains the (number of symbols + 1) usually.
But for creating invalid inputs for test cases it would be convenient
to allow explicitly override this field from YAML.
Differential revision: https://reviews.llvm.org/D58779
llvm-svn: 355193
Alexey Lapshin [Fri, 1 Mar 2019 10:15:18 +0000 (10:15 +0000)]
Attempt to fix buildbot after r354972 [#2]. NFCI.
llvm-svn: 355192
Diana Picus [Fri, 1 Mar 2019 10:12:28 +0000 (10:12 +0000)]
[ARM GlobalISel] Support G_CTLZ for Thumb2
Same as ARM mode but with different opcode.
llvm-svn: 355191
Pierre Gousseau [Fri, 1 Mar 2019 10:05:15 +0000 (10:05 +0000)]
[Driver] Allow enum SanitizerOrdinal to represent more than 64 different sanitizer checks, NFC.
enum SanitizerOrdinal has reached maximum capacity, this change extends the capacity to 128 sanitizer checks.
This can eventually allow us to add gcc 8's options "-fsanitize=pointer-substract" and "-fsanitize=pointer-compare".
This is a recommit of r354873 but with a fix for unqualified lookup error in lldb cmake build bot.
Fixes: https://llvm.org/PR39425
Differential Revision: https://reviews.llvm.org/D57914
llvm-svn: 355190
Diana Picus [Fri, 1 Mar 2019 10:01:22 +0000 (10:01 +0000)]
[ARM GlobalISel] Check target flags in test. NFCI
There was a time when we couldn't dump target-specific flags such as
arm-sbrel etc, so the tests didn't check for them. We can now be more
specific in our tests.
llvm-svn: 355189
Fangrui Song [Fri, 1 Mar 2019 09:52:53 +0000 (09:52 +0000)]
Fix file headers. NFC
llvm-svn: 355188
Nicola Zaghen [Fri, 1 Mar 2019 09:46:29 +0000 (09:46 +0000)]
[Tablegen] Add support for the !mul operator.
This is a small addition to arithmetic operations that improves
expressiveness of the language.
Differential Revision: https://reviews.llvm.org/D58775
llvm-svn: 355187
Oliver Stannard [Fri, 1 Mar 2019 09:26:21 +0000 (09:26 +0000)]
[ARM] Add armv8a triple to test check updaters
llvm-svn: 355186
Igor Kudrin [Fri, 1 Mar 2019 09:22:42 +0000 (09:22 +0000)]
[CommandLine] Allow grouping options which can have values.
This patch allows all forms of values for options to be used at the end
of a group. With the fix, it is possible to follow the way GNU binutils
tools handle grouping options better. For example, the -j option can be
used with objdump in any of the following ways:
$ objdump -d -j .text a.o
$ objdump -d -j.text a.o
$ objdump -dj .text a.o
$ objdump -dj.text a.o
Differential Revision: https://reviews.llvm.org/D58711
llvm-svn: 355185
Igor Kudrin [Fri, 1 Mar 2019 09:20:56 +0000 (09:20 +0000)]
[CommandLine] Do not crash if an option has both ValueRequired and Grouping.
If an option, which requires a value, has a `cl::Grouping` formatting
modifier, it works well as far as it is used at the end of a group,
or as a separate argument. However, if the option appears accidentally
in the middle of a group, the program just crashes. This patch prints
an error message instead.
Differential Revision: https://reviews.llvm.org/D58499
llvm-svn: 355184
James Henderson [Fri, 1 Mar 2019 09:12:38 +0000 (09:12 +0000)]
[llvm-readobj]Add test showing behaviour of thin archive member path printing
This was a test requested in https://reviews.llvm.org/D58677.
Reviewed by: rupprecht, grimar, Higuoxing
Differential Revision: https://reviews.llvm.org/D5877
llvm-svn: 355183
Paul Hoad [Fri, 1 Mar 2019 09:09:54 +0000 (09:09 +0000)]
[clang-format] [NFC] clang-format the Format library
Previously revisions commited non-clang-formatted changes to the Format library, this means submitting any revision e.g. {D55170} can cause additional whitespace changes to potentially be included in a revision.
Commit a non functional change using latest build Windows clang-format r351376 with no other changes, to remove these differences
All FormatTests
pass [==========] 652 tests from 20 test cases ran.
llvm-svn: 355182
Alexander Potapenko [Fri, 1 Mar 2019 09:00:41 +0000 (09:00 +0000)]
CodeGen: Fix PR40605 by splitting constant struct initializers
When emitting initializers for local structures for code built with
-ftrivial-auto-var-init, replace constant structures with sequences of
stores.
This appears to greatly help removing dead initialization stores to those
locals that are later overwritten by other data.
This also removes a lot of .rodata constants (see PR40605), replacing most
of them with immediate values (for Linux kernel the .rodata size is
reduced by ~1.9%)
llvm-svn: 355181
Martin Storsjo [Fri, 1 Mar 2019 08:08:11 +0000 (08:08 +0000)]
[sanitizers] Explicitly use GetModuleFileNameW with wchar_t
Alternatively we could define the string as TCHAR.
Differential Revision: https://reviews.llvm.org/D58766
llvm-svn: 355180
Stanislav Mekhanoshin [Fri, 1 Mar 2019 07:59:17 +0000 (07:59 +0000)]
[AMDGPU] Mark ds instructions as meybeAtomic
These were not recognized as potential atomics by memory legalizer.
The test was working not because legalizer did a right thing, but
because it has skipped all these instructions. When I have fixed
DS desciption test started to fail because region address has
changed from 4 to 2 a while ago.
Differential Revision: https://reviews.llvm.org/D58802
llvm-svn: 355179
Petar Avramovic [Fri, 1 Mar 2019 07:35:57 +0000 (07:35 +0000)]
[MIPS GlobalISel] Fix mul operands
Unsigned mul high for MIPS32 is selected into two PseudoInstructions:
PseudoMULTu and PseudoMFHI that use accumulator register class ACC64 for
some of its operands. Registers in this class have appropriate hi and lo
register as subregisters: $lo0 and $hi0 are subregisters of $ac0 etc.
mul instruction implicit-defs $lo0 and $hi0 according to MipsInstrInfo.td.
In functions where mul and PseudoMULTu are present fastRegisterAllocator
will "run out of registers during register allocation" because
'calcSpillCost' for $ac0 will return spillImpossible because subregisters
$lo0 and $hi0 of $ac0 are reserved by mul instruction above. A solution is
to mark implicit-defs of $lo0 and $hi0 as dead in mul instruction.
Differential Revision: https://reviews.llvm.org/D58715
llvm-svn: 355178