platform/upstream/llvm.git
3 years agoRevert "PDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI."
Raphael Isemann [Thu, 6 Aug 2020 13:15:36 +0000 (15:15 +0200)]
Revert "PDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI."

This reverts commit 87c5437afd273e909e0fed3389de7531d5452ea5.

The commit includes several headers in the middle of a function, which
breaks pretty much everything.

3 years ago[mlir][Vector] NFC - Use matchAndRewrite in ContractionOp lowering patterns
Nicolas Vasilache [Thu, 6 Aug 2020 13:01:57 +0000 (09:01 -0400)]
[mlir][Vector] NFC - Use matchAndRewrite in ContractionOp lowering patterns

Replace the use of separate match and rewrite which unnecessarily duplicates logic.

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

3 years ago[DOCS] Add more detail to stack protector documentation
Peter Smith [Wed, 5 Aug 2020 11:47:54 +0000 (12:47 +0100)]
[DOCS] Add more detail to stack protector documentation

The Clang -fstack-protector documentation mentions what functions are considered
vulnerable but does not mention the details of the implementation such as the use
of a global variable for the guard value. This brings the documentation more in
line with the GCC documentation at:
https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html
and gives someone using the option more idea about what is protected.

This partly addresses https://bugs.llvm.org/show_bug.cgi?id=42764

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

3 years ago[DWARFYAML][debug_info] Make the 'Values' field optional.
Xing GUO [Thu, 6 Aug 2020 12:41:12 +0000 (20:41 +0800)]
[DWARFYAML][debug_info] Make the 'Values' field optional.

This patch makes the 'Values' field optional. This is useful when we
handcraft the terminating entry of DIEs.

```
debug_info:
  - Version:  4
    ...
    Entries:
      - AbbrCode: 1
        Values:
          - Value: 0x1234
      - AbbrCode: 0 ## Termination
```

Reviewed By: jhenderson, grimar

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

3 years ago[obj2yaml] Test dumping an empty .debug_aranges section.
Xing GUO [Thu, 6 Aug 2020 12:39:34 +0000 (20:39 +0800)]
[obj2yaml] Test dumping an empty .debug_aranges section.

This patch adds one test case that tests dumping an empty .debug_aranges
section.

Reviewed By: jhenderson, grimar

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

3 years ago[lldb][AArch64] Correct compile options for Neon corefile
David Spickett [Mon, 3 Aug 2020 14:09:48 +0000 (15:09 +0100)]
[lldb][AArch64] Correct compile options for Neon corefile

SVE is not required, it has its own test. Note that
there is no "+neon" so "+simd" is used instead.

Also rename the file to match the name of the corefile
it produces.

Reviewed By: omjavaid

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

3 years ago[LLDB] Skip test_launch_simple from TestTargetAPI.py on Arm/AArch64 Linux
Muhammad Omair Javaid [Thu, 6 Aug 2020 12:33:26 +0000 (17:33 +0500)]
[LLDB] Skip test_launch_simple from TestTargetAPI.py on Arm/AArch64 Linux

Recently added TestTargetAPI.py test "test_launch_simple" is failing on
Arm/AArch64 Linux targets. Putting them to skip until fixed.

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

3 years ago[GlobalISel][InlineAsm] Fix matching input constraint to physreg
Petar Avramovic [Thu, 6 Aug 2020 12:26:10 +0000 (14:26 +0200)]
[GlobalISel][InlineAsm] Fix matching input constraint to physreg

Add given input and mark it as tied.
Doesn't create additional copy compared to
matching input constraint to virtual register.

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

3 years ago[ABI][NFC] Fix the confusion of ByVal and ByRef argument names
Anatoly Trosinenko [Thu, 6 Aug 2020 11:34:10 +0000 (14:34 +0300)]
[ABI][NFC] Fix the confusion of ByVal and ByRef argument names

The second argument of getNaturalAlignIndirect() was `bool ByRef`, but
the implementation was just delegating to getIndirect() with `ByRef`
passed unchanged to `bool ByVal` parameter of getIndirect().

Fix a couple of /*ByRef=*/ comments as well.

Reviewed By: rjmccall

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

3 years agoBitstreamRemarkParser.h - remove unnecessary includes. NFCI.
Simon Pilgrim [Thu, 6 Aug 2020 12:17:36 +0000 (13:17 +0100)]
BitstreamRemarkParser.h - remove unnecessary includes. NFCI.

Remove unused includes, moving to the lib header or cpp file as necessary.

3 years agoRevert "[ELF] Allow sections after a non-SHF_ALLOC section to be covered by PT_LOAD"
Muhammad Omair Javaid [Thu, 6 Aug 2020 11:30:05 +0000 (16:30 +0500)]
Revert "[ELF] Allow sections after a non-SHF_ALLOC section to be covered by PT_LOAD"

This reverts commit 030ddc0a0bb9e2b25319eb681d520a9cee32b761.

This breaks http://lab.llvm.org:8011/builders/lldb-arm-ubuntu
and http://lab.llvm.org:8011/builders/lldb-aarch64-ubuntu

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

3 years agoFix include sorting order. NFC
Simon Pilgrim [Thu, 6 Aug 2020 10:46:53 +0000 (11:46 +0100)]
Fix include sorting order. NFC

3 years ago[X86] getX86MaskVec - replace mask limit from NumElts < 8 with NumElts <= 4
Simon Pilgrim [Thu, 6 Aug 2020 10:46:19 +0000 (11:46 +0100)]
[X86] getX86MaskVec - replace mask limit from NumElts < 8 with NumElts <= 4

As noted on PR46885, the number of mask elements should always be a power of 2, so to fix the static analyzer warning we are better off replacing the condition to <= 4, and I've added a pow2 assertion as well.

3 years agoPDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI.
Simon Pilgrim [Thu, 6 Aug 2020 10:28:29 +0000 (11:28 +0100)]
PDBExtras.h - remove unnecessary raw_ostream forward declaration. NFCI.

We already need to include raw_ostream.h, also add missing StringRef.h and cstdint implicit dependencies.

Remove unnecessary includes from PDBExtras.cpp

3 years ago[X86][SSE] Expose all memory offsets in expand load tests
Simon Pilgrim [Wed, 5 Aug 2020 19:14:48 +0000 (20:14 +0100)]
[X86][SSE] Expose all memory offsets in expand load tests

Since we're messing with individual element loads we need to expose this to show whats going on.

Part of the work to fix the masked_expandload.ll regressions in D66004

3 years ago[SVE] Lower scalable vector mul operations.
Paul Walker [Wed, 5 Aug 2020 16:19:54 +0000 (17:19 +0100)]
[SVE] Lower scalable vector mul operations.

This allows us to remove extra patterns from AArch64SVEInstrInfo.td
because we can reuse those required for fixed length vectors.

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

3 years ago[mlir][Linalg] Introduce canonicalization to remove dead LinalgOps
Nicolas Vasilache [Thu, 6 Aug 2020 09:13:33 +0000 (05:13 -0400)]
[mlir][Linalg] Introduce canonicalization to remove dead LinalgOps

When any of the memrefs in a structured linalg op has a zero dimension, it becomes dead.
This is consistent with the fact that linalg ops deduce their loop bounds from their operands.

Note however that this is not the case for the `tensor<0xelt_type>` which is a special convention
that must be lowered away into either `memref<elt_type>` or just `elt_type` before this
canonicalization can kick in.

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

3 years ago[SVE] Implement lowering for fixed length vector multiplication.
Paul Walker [Thu, 6 Aug 2020 10:01:39 +0000 (11:01 +0100)]
[SVE] Implement lowering for fixed length vector multiplication.

NOTE: Also uses SVE code generation for NEON size vectors, instead
of expanding i64 based vector multiplications.

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

3 years ago[MLIR] Change GpuLaunchFuncToGpuRuntimeCallsPass to wrap a RewritePattern with the...
Christian Sigg [Sat, 1 Aug 2020 13:06:25 +0000 (15:06 +0200)]
[MLIR] Change GpuLaunchFuncToGpuRuntimeCallsPass to wrap a RewritePattern with the same functionality.

The RewritePattern will become one of several, and will be part of the LLVM conversion pass (instead of a separate pass following LLVM conversion).

Reviewed By: herhut

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

3 years ago[analyzer][tests] Understand when diagnostics change between builds
Valeriy Savchenko [Wed, 5 Aug 2020 14:32:24 +0000 (17:32 +0300)]
[analyzer][tests] Understand when diagnostics change between builds

Before the patch `SATest compare`, produced quite obscure results
when something about the diagnostic have changed (i.e. its description
or the name of the corresponding checker) because it was simply two
lists of warnings, ADDED and REMOVED.  It was up to the developer
to match those warnings, understand that they are essentially the
same, and figure out what caused the difference.

This patch introduces another category of results: MODIFIED.
It tries to match new warnings against the old ones and prints out
clues on what is different between two builds.

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

3 years ago[dsymutil] Disable dsymutil/X86/reproducer.test on windows.
Alexey Lapshin [Tue, 4 Aug 2020 16:46:33 +0000 (19:46 +0300)]
[dsymutil] Disable dsymutil/X86/reproducer.test on windows.

The dsymutil/X86/reproducer.test test could create paths
longer than MAX_PATH:

C:\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win
\build\test\tools\dsymutil\X86\Output\reproducer.test.tmp.repro
\ps4-buildslave2\llvm-clang-x86_64-expensive-checks-win\build
\test\tools\dsymutil\X86\Output\reproducer.test.tmp\Inputs\
basic1.macho.x86_64.o

Disable this test on windows.

Reviewed By: JDevlieghere

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

3 years ago[mlir] Lower DimOp to LLVM for unranked memrefs.
Alexander Belyaev [Thu, 6 Aug 2020 08:33:48 +0000 (10:33 +0200)]
[mlir] Lower DimOp to LLVM for unranked memrefs.

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

3 years ago[flang] Add parser support for OpenMP allocate clause
Irina Dobrescu [Wed, 5 Aug 2020 14:58:13 +0000 (15:58 +0100)]
[flang] Add parser support for OpenMP allocate clause

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

3 years ago[InstCombine] Fold freeze(undef) into a proper constant
Juneyoung Lee [Thu, 30 Jul 2020 14:15:26 +0000 (23:15 +0900)]
[InstCombine] Fold freeze(undef) into a proper constant

This is a simple patch that folds freeze(undef) into a proper constant after inspecting its uses.

Reviewed By: nikic

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

3 years ago[InstCombine] Add tests for D84948; NFC
Juneyoung Lee [Thu, 6 Aug 2020 05:32:42 +0000 (14:32 +0900)]
[InstCombine] Add tests for D84948; NFC

3 years ago[LoopVectorizer] Inloop vector reductions
David Green [Thu, 6 Aug 2020 09:10:50 +0000 (10:10 +0100)]
[LoopVectorizer] Inloop vector reductions

Arm MVE has multiple instructions such as VMLAVA.s8, which (in this
case) can take two 128bit vectors, sign extend the inputs to i32,
multiplying them together and sum the result into a 32bit general
purpose register. So taking 16 i8's as inputs, they can multiply and
accumulate the result into a single i32 without any rounding/truncating
along the way. There are also reduction instructions for plain integer
add and min/max, and operations that sum into a pair of 32bit registers
together treated as a 64bit integer (even though MVE does not have a
plain 64bit addition instruction). So giving the vectorizer the ability
to use these instructions both enables us to vectorize at higher
bitwidths, and to vectorize things we previously could not.

In order to do that we need a way to represent that the reduction
operation, specified with a llvm.experimental.vector.reduce when
vectorizing for Arm, occurs inside the loop not after it like most
reductions. This patch attempts to do that, teaching the vectorizer
about in-loop reductions. It does this through a vplan recipe
representing the reductions that the original chain of reduction
operations is replaced by. Cost modelling is currently just done through
a prefersInloopReduction TTI hook (which follows in a later patch).

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

3 years ago[mlir] take MLIRContext instead of LLVMDialect in getters of LLVMType's
Alex Zinenko [Wed, 5 Aug 2020 22:52:20 +0000 (00:52 +0200)]
[mlir] take MLIRContext instead of LLVMDialect in getters of LLVMType's

Historical modeling of the LLVM dialect types had been wrapping LLVM IR types
and therefore needed access to the instance of LLVMContext stored in the
LLVMDialect. The new modeling does not rely on that and only needs the
MLIRContext that is used for uniquing, similarly to other MLIR types. Change
LLVMType::get<Kind>Ty functions to take `MLIRContext *` instead of
`LLVMDialect *` as first argument. This brings the code base closer to
completely removing the dependence on LLVMContext from the LLVMDialect,
together with additional support for thread-safety of its use.

Depends On D85371

Reviewed By: rriddle

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

3 years ago[mlir] Remove most uses of LLVMDialect::getModule
Alex Zinenko [Wed, 5 Aug 2020 22:52:10 +0000 (00:52 +0200)]
[mlir] Remove most uses of LLVMDialect::getModule

This prepares for the removal of llvm::Module and LLVMContext from the
mlir::LLVMDialect.

Reviewed By: rriddle

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

3 years ago[lldb] Fix LLDB compilation with ncurses 6.2 due to wattr_set/get being a macro
Raphael Isemann [Thu, 6 Aug 2020 08:51:37 +0000 (10:51 +0200)]
[lldb] Fix LLDB compilation with ncurses 6.2 due to wattr_set/get being a macro

My ncurses 6.2 arch defines those two functions as macros, so the scope operator
doesn't work here.

3 years ago[NFC][InstCombine] Refactor '(-NSW x) pred x' fold
Roman Lebedev [Thu, 6 Aug 2020 08:34:03 +0000 (11:34 +0300)]
[NFC][InstCombine] Refactor '(-NSW x) pred x' fold

3 years ago[InstCombine] (-NSW x) u<= x --> x s<=0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 08:28:54 +0000 (11:28 +0300)]
[InstCombine] (-NSW x) u<= x  --> x s<=0  (PR39480)

Name: (-x) u<= x  -->  x s<= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp ule i8 %neg_x, %x
  =>
%r = icmp sle i8 %x, 0

https://rise4fun.com/Alive/V22

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

3 years ago[InstCombine] (-NSW x) u< x --> x s< 0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 08:26:48 +0000 (11:26 +0300)]
[InstCombine] (-NSW x) u< x  --> x s< 0  (PR39480)

Name: (-x) u< x  -->  x s< 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp ult i8 %neg_x, %x
  =>
%r = icmp slt i8 %x, 0

https://rise4fun.com/Alive/zSuf

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

3 years ago[InstCombine] (-NSW x) u>= x --> x s>= 0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 08:23:59 +0000 (11:23 +0300)]
[InstCombine] (-NSW x) u>= x  --> x s>= 0  (PR39480)

Name: (-x) u>= x  -->  x s>= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp uge i8 %neg_x, %x
  =>
%r = icmp sge i8 %x, 0

https://rise4fun.com/Alive/LLHd

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

3 years ago[InstCombine] (-NSW x) u> x --> x s> 0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 08:20:04 +0000 (11:20 +0300)]
[InstCombine] (-NSW x) u> x  --> x s> 0  (PR39480)

Name: (-x) u> x  -->  x s> 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp ugt i8 %neg_x, %x
  =>
%r = icmp sgt i8 %x, 0

https://rise4fun.com/Alive/Raea

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

3 years ago[InstCombine] (-NSW x) s<= x --> x s>= 0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 08:14:28 +0000 (11:14 +0300)]
[InstCombine] (-NSW x) s<= x  --> x s>= 0  (PR39480)

Name: (-x) s<= x  -->  x >= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp sle i8 %neg_x, %x
  =>
%r = icmp sge i8 %x, 0

https://rise4fun.com/Alive/91k

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

3 years ago[InstCombine] (-NSW x) s< x --> x s> 0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 08:10:38 +0000 (11:10 +0300)]
[InstCombine] (-NSW x) s< x  --> x s> 0  (PR39480)

Name: (-x) s< x  -->  x > 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp slt i8 %neg_x, %x
  =>
%r = icmp sgt i8 %x, 0

https://rise4fun.com/Alive/3IXb

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

3 years ago[InstCombine] (-NSW x) s>= x --> x s<= 0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 08:07:17 +0000 (11:07 +0300)]
[InstCombine] (-NSW x) s>= x  --> x s<= 0  (PR39480)

Name: (-x) s>= x  -->  x s<= 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp sge i8 %neg_x, %x
  =>
%r = icmp sle i8 %x, 0

https://rise4fun.com/Alive/Hdip

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

3 years ago[InstCombine] (-NSW x) ==/!= x --> x ==/!= 0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 08:02:29 +0000 (11:02 +0300)]
[InstCombine] (-NSW x) ==/!= x  --> x ==/!= 0  (PR39480)

Name: (-x) == x  -->  x == 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp eq i8 %neg_x, %x
  =>
%r = icmp eq i8 %x, 0

Name: (-x) != x  -->  x != 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp ne i8 %neg_x, %x
  =>
%r = icmp ne i8 %x, 0

https://rise4fun.com/Alive/4slH

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

3 years ago[InstCombine] (-NSW x) s> x --> x s< 0 (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 07:45:32 +0000 (10:45 +0300)]
[InstCombine] (-NSW x) s> x  --> x s< 0  (PR39480)

Name: (-x) s> x  -->  x s< 0
%neg_x = sub nsw i8 0, %x ; %x must not be INT_MIN
%r = icmp sgt i8 %neg_x, %x
  =>
%r = icmp slt i8 %x, 0

https://rise4fun.com/Alive/ZslD

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

3 years ago[NFC][InstCombine] Add tests for comparisons between x and negation of x (PR39480)
Roman Lebedev [Thu, 6 Aug 2020 07:27:03 +0000 (10:27 +0300)]
[NFC][InstCombine] Add tests for comparisons between x and negation of x (PR39480)

3 years ago[clang][Driver] Don't hardcode --as-needed/--no-as-needed on Illumos
Rainer Orth [Thu, 6 Aug 2020 08:47:16 +0000 (10:47 +0200)]
[clang][Driver] Don't hardcode --as-needed/--no-as-needed on Illumos

`ninja check-all` currently fails on Illumos:

  [84/716] Generating default/Asan-i386-inline-Test
  FAILED: projects/compiler-rt/lib/asan/tests/default/Asan-i386-inline-Test
  cd /var/llvm/dist-amd64-release/projects/compiler-rt/lib/asan/tests && /var/llvm/dist-amd64-release/./bin/clang ASAN_INST_TEST_OBJECTS.gtest-all.cc.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_globals_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_interface_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_internal_interface_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_oob_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_mem_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_str_test.cpp.i386-inline.o ASAN_INST_TEST_OBJECTS.asan_test_main.cpp.i386-inline.o -o /var/llvm/dist-amd64-release/projects/compiler-rt/lib/asan/tests/default/./Asan-i386-inline-Test -g --driver-mode=g++ -fsanitize=address -m32
  ld: fatal: unrecognized option '--no-as-needed'
  ld: fatal: use the -z help option for usage information
  clang-11: error: linker command failed with exit code 1 (use -v to see invocation)

`clang` unconditionally passes `--as-needed`/`--no-as-needed` to the
linker.  This works on Solaris 11.[34] which added a couple of option
aliases to the native linker to improve compatibility with GNU `ld`.
Illumos `ld` didn't do this, so one needs to use the corresponding
native options `-z ignore`/`-z record` instead.

Because this works on both Solaris and Illumos, the current patch always
passes the native options on Solaris.  This isn't fully correct, however:
when using GNU `ld` on Solaris (not yet supported; I'm working on that),
one still needs `--as-needed` instead.

I'm hardcoding this decision because a generic detection via a `cmake` test
is hard: many systems have their own implementation of `getDefaultLinker`
and `cmake` would have to duplicate the information encoded there.
Besides, it would still break when `-fuse-ld` is used.

Tested on `amd64-pc-solaris2.11` (Solaris 11.4 and OpenIndiana 2020.04),
`sparcv9-sun-solaris2.11`, and `x86_64-pc-linux-gnu`.

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

3 years ago[DWARFYAML][debug_info] Pull out dwarf::FormParams from DWARFYAML::Unit.
Xing GUO [Thu, 6 Aug 2020 08:37:52 +0000 (16:37 +0800)]
[DWARFYAML][debug_info] Pull out dwarf::FormParams from DWARFYAML::Unit.

Unit.Format, Unit.Version and Unit.AddrSize are replaced with
dwarf::FormParams in D84496 to get rid of unnecessary functions
getOffsetSize() and getRefSize(). However, that change makes it
difficult to make AddrSize optional (Optional<uint8_t>). This change
pulls out dwarf::FormParams from DWARFYAML::Unit and use it as a helper
struct in DWARFYAML::emitDebugInfo().

Reviewed By: jhenderson, MaskRay

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

3 years ago[compiler-rt] Fix build of Sanitizer-Test_Nolibc after D80648
Alex Richardson [Thu, 6 Aug 2020 07:56:46 +0000 (08:56 +0100)]
[compiler-rt] Fix build of Sanitizer-Test_Nolibc after D80648

Running ninja check-sanitizer fails for after that patch (commit
058f5f6fd813d1ee1480497394d6fd44e65ec62b) with the following error:

libRTSanitizerCommon.test.nolibc.x86_64.a(sanitizer_posix.cpp.o): In
function `__sanitizer::GetNamedMappingFd(char const*, unsigned long,
int*)':
..../llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_posix.cpp:358:
undefined reference to `fcntl'
clang-12: error: linker command failed with exit code 1 (use -v to see
invocation)

This patch works around the problem by only calling fcntl if O_CLOEXEC
is not defined.

Reviewed By: plopresti

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

3 years ago[lit] Remove ANSI control characters from xunit output
Alex Richardson [Thu, 6 Aug 2020 07:53:47 +0000 (08:53 +0100)]
[lit] Remove ANSI control characters from xunit output

Failing test output sometimes contains control characters like \x1b (e.g.
if there was some -fcolor-diagnostics output) which are not allowed inside
XML files. This causes problems with CI systems: for example, the Jenkins
JUnit XML will throw an exception when ecountering those characters and
similar problems also occur with GitLab CI.

Reviewed By: yln, jdenny

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

3 years agoFix qsort() interceptor for FreeBSD
Alex Richardson [Thu, 6 Aug 2020 07:53:04 +0000 (08:53 +0100)]
Fix qsort() interceptor for FreeBSD

When the FreeBSD qsort() implementation recurses, it does so using an
interposable function call, so we end up calling the interceptor again
and set the saved comparator to wrapped_qsort_compar. This results in an
infinite loop and a eventually a stack overflow since wrapped_qsort_compar
ends up calling itself. This means that ASAN is completely broken on
FreeBSD for programs that call qsort(). I found this while running
check-all on a FreeBSD system a ASAN-instrumented LLVM.

Fix this by checking whether we are recursing inside qsort before writing
to qsort_compar. The same bug exists in the qsort_r interceptor, so use the
same approach there. I did not test the latter since the qsort_r function
signature does not match and therefore it's not intercepted on FreeBSD/macOS.

Fixes https://llvm.org/PR46832

Reviewed By: eugenis

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

3 years ago[update_cc_test_checks.py] Add test for D84511
Alex Richardson [Thu, 6 Aug 2020 07:25:10 +0000 (08:25 +0100)]
[update_cc_test_checks.py] Add test for D84511

Reviewed By: MaskRay

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

3 years ago[clang-tidy] Fix bugprone-bad-signal-to-kill-thread crash when `SIGTERM` is not a...
Aleksandr Platonov [Thu, 6 Aug 2020 07:30:43 +0000 (10:30 +0300)]
[clang-tidy] Fix bugprone-bad-signal-to-kill-thread crash when `SIGTERM` is not a literal.

If `SIGTERM` is not a literal (e.g. `#define SIGTERM ((unsigned)15)`) bugprone-bad-signal-to-kill-thread check crashes.
Stack dump:
```
 #0 0x000000000217d15a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x217d15a)
 #1 0x000000000217b17c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x217b17c)
 #2 0x000000000217b2e3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x217b2e3)
 #3 0x00007f6a7efb1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x000000000212ac9b llvm::StringRef::getAsInteger(unsigned int, llvm::APInt&) const (/llvm-project/build/bin/clang-tidy+0x212ac9b)
 #5 0x0000000000593501 clang::tidy::bugprone::BadSignalToKillThreadCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x593501)
```

Reviewed By: hokein

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

3 years ago[clang-tidy] Fix bugprone-bad-signal-to-kill-thread crash when `SIGTERM` was undefine...
Aleksandr Platonov [Thu, 6 Aug 2020 07:27:38 +0000 (10:27 +0300)]
[clang-tidy] Fix bugprone-bad-signal-to-kill-thread crash when `SIGTERM` was undefined after definition.

`PP->getMacroInfo()` returns nullptr for undefined macro, which leads to null-dereference at `MI->tockens().back()`.
Stack dump:
```
 #0 0x000000000217d15a llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/llvm-project/build/bin/clang-tidy+0x217d15a)
 #1 0x000000000217b17c llvm::sys::RunSignalHandlers() (/llvm-project/build/bin/clang-tidy+0x217b17c)
 #2 0x000000000217b2e3 SignalHandler(int) (/llvm-project/build/bin/clang-tidy+0x217b2e3)
 #3 0x00007f39be5b1390 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
 #4 0x0000000000593532 clang::tidy::bugprone::BadSignalToKillThreadCheck::check(clang::ast_matchers::MatchFinder::MatchResult const&) (/llvm-project/build/bin/clang-tidy+0x593532)
```

Reviewed By: hokein

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

3 years ago[X86] Rename X86::getImpliedFeatures to X86::updateImpliedFeatures and pass clang...
Craig Topper [Thu, 6 Aug 2020 07:13:40 +0000 (00:13 -0700)]
[X86] Rename X86::getImpliedFeatures to X86::updateImpliedFeatures and pass clang's StringMap directly to it.

No point in building a vector of StringRefs for clang to apply to the
StringMap. Just pass the StringMap and modify it directly.

3 years ago[lldb][gui] use names for color pairs, instead of magic numbers
Luboš Luňák [Wed, 5 Aug 2020 08:57:02 +0000 (10:57 +0200)]
[lldb][gui] use names for color pairs, instead of magic numbers

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

3 years ago[lldb][gui] use syntax highlighting also in gui mode
Luboš Luňák [Tue, 4 Aug 2020 09:58:51 +0000 (11:58 +0200)]
[lldb][gui] use syntax highlighting also in gui mode

Use the same functionality as the non-gui mode, the colors just
need translating to curses colors.

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

3 years ago[lldb][gui] truncate long lines/names if needed
Luboš Luňák [Mon, 3 Aug 2020 11:44:47 +0000 (13:44 +0200)]
[lldb][gui] truncate long lines/names if needed

Without this, sources with long lines or variable names may overwrite
panel frames, or even overrun to the following line. There's currently
no way to scroll left/right in the views, so that should be added
to handle these cases.
This commit includes fixing constness of some Window functions,
and also makes PutCStringTruncated() consistent with the added
printf-like variant to take the padding as the first argument (can't
add it after the format to the printf-like function).

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

3 years ago[AArch64] [Windows] Error out on unsupported symbol locations
Martin Storsjö [Tue, 4 Aug 2020 11:41:48 +0000 (14:41 +0300)]
[AArch64] [Windows] Error out on unsupported symbol locations

These might occur in seemingly generic assembly. Previously when
targeting COFF, they were silently ignored, which certainly won't
give the right result. Instead clearly error out, to make it clear
that the assembly needs to be adjusted for this target.

Also change a preexisting report_fatal_error into a proper error
message, pointing out the offending source instruction. This isn't
strictly an internal error, as it can be triggered by user input.

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

3 years ago[ARM, AArch64] Fix a comment typo. NFC.
Martin Storsjö [Tue, 4 Aug 2020 11:26:16 +0000 (14:26 +0300)]
[ARM, AArch64] Fix a comment typo. NFC.

3 years ago[Coroutines] Use to collect lifetime marker of in CoroFrame Differential Revision...
Chuanqi Xu [Thu, 6 Aug 2020 06:21:55 +0000 (14:21 +0800)]
[Coroutines] Use  to collect lifetime marker of  in CoroFrame Differential Revision: https://reviews.llvm.org/D85279

3 years ago[X86] Remove incomplete custom handling of i128 sdivrem/udivrem on Windows.
Craig Topper [Thu, 6 Aug 2020 05:12:41 +0000 (22:12 -0700)]
[X86] Remove incomplete custom handling of i128 sdivrem/udivrem on Windows.

We need to have special handling of i128 div/rem on Windows due
to a weird calling convention needed for the libcall. There was
also some code that made it look like we do the same for sdivrem/udiv,
but the code didn't account for multiple return values of those
functions so couldn't possibly work. I think this code never
triggers because we don't have libcall names defined for those
functions by default so DAGCombine never creates DIVREM nodes.

3 years agoFix typo in test. Thanks to Andrew Ng for spotting this!
Douglas Yung [Thu, 6 Aug 2020 05:54:59 +0000 (22:54 -0700)]
Fix typo in test. Thanks to Andrew Ng for spotting this!

3 years ago[lldb] Remove pointless assign to found_suffix (NFC)
Jonas Devlieghere [Thu, 6 Aug 2020 05:53:19 +0000 (22:53 -0700)]
[lldb] Remove pointless assign to found_suffix (NFC)

3 years ago[JITLink][MachO][AArch64] More PAGEOFF12 relocation fixes.
Lang Hames [Thu, 6 Aug 2020 04:07:45 +0000 (21:07 -0700)]
[JITLink][MachO][AArch64] More PAGEOFF12 relocation fixes.

Correctly sign extend the addend, and fix implicit shift operand decoding
(it incorrectly returned 0 for some cases), and check that the initial
encoded immediate is 0.

3 years ago[lldb] Fix bug in skipIfRosetta decorator
Jonas Devlieghere [Thu, 6 Aug 2020 03:49:29 +0000 (20:49 -0700)]
[lldb] Fix bug in skipIfRosetta decorator

Currently, the skipIfRosetta decorator will skip tests with the message
"not on macOS" on all platforms that are not `darwin` or `macosx`.
Instead, it should only check the platform and architecture when running
on these platforms.

This triggers for example when running the test suite on device.

Differential revision: https://reviews.llvm.org/D85388

3 years ago[CMake] Print the autodetected host linker version
Petr Hosek [Wed, 5 Aug 2020 21:03:12 +0000 (14:03 -0700)]
[CMake] Print the autodetected host linker version

There's no easy way to find out what the autodetected version is, but
sometimes it may be useful to confirm that the right version is being
used. Print it as CMake status message.

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

3 years agoGetPath() returns a std::string temporary. You can't reference just the c_str.
Jim Ingham [Thu, 6 Aug 2020 02:12:15 +0000 (19:12 -0700)]
GetPath() returns a std::string temporary.  You can't reference just the c_str.

Found by the static analyzer.

3 years ago"|" used when "||" was meant in SBTarget::FindFunctions
Jim Ingham [Thu, 6 Aug 2020 02:01:17 +0000 (19:01 -0700)]
"|" used when "||" was meant in SBTarget::FindFunctions

3 years agoAMDGPU: Remove ATOMIC_PK_FADD
Matt Arsenault [Wed, 5 Aug 2020 23:26:07 +0000 (19:26 -0400)]
AMDGPU: Remove ATOMIC_PK_FADD

The f32 and v2f16 cases should be handled the same way.

3 years ago[NewPM][opt] Add more codegen passes
Arthur Eubanks [Wed, 29 Jul 2020 23:43:57 +0000 (16:43 -0700)]
[NewPM][opt] Add more codegen passes

Reduces number of failures by 92.

Reviewed By: ychen

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

3 years ago[AMDGPU] add buffer_atomic_swap for float
Ruiling Song [Tue, 4 Aug 2020 01:54:36 +0000 (09:54 +0800)]
[AMDGPU] add buffer_atomic_swap for float

The functionality is used when calling imageAtomicExhange() on float
type imageBuffer in Graphics shaders.

Reviewed By: arsenm

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

3 years ago[lldb] Make UBSan tests remote ready
Jonas Devlieghere [Thu, 6 Aug 2020 01:31:20 +0000 (18:31 -0700)]
[lldb] Make UBSan tests remote ready

Add missing call to registerSanitizerLibrariesWithTarget.

3 years ago[flang] Fix compilation warning in check-directive-structure.h
Tim Keith [Thu, 6 Aug 2020 01:03:40 +0000 (18:03 -0700)]
[flang] Fix compilation warning in check-directive-structure.h

Clang 9 gets the following warning after revision `D85104`.
```
../../flang/lib/Semantics/check-directive-structure.h:36:7: error: 'Fortran::semantics::DirectiveStructureChecker<llvm::omp::Directive, llvm::omp::Clause, Fortran::parser::OmpClause, 77>' has virtual functions but non-virtual destructor [-Werror,-Wnon-virtual-dtor]
```

The fix is the make the destructor virtual. Neither it nor the
constructor need to be public, so make them protected.

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

3 years ago[JumpThreading] Allow duplicating a basic block into preds when its branch condition...
Juneyoung Lee [Fri, 31 Jul 2020 14:25:56 +0000 (23:25 +0900)]
[JumpThreading] Allow duplicating a basic block into preds when its branch condition is freeze(phi)

This is the last JumpThreading patch for getting the performance numbers shown at
https://reviews.llvm.org/D84940#2184653 .

This patch makes ProcessBlock call ProcessBranchOnPHI when the branch condition
is freeze(phi) as well (originally it calls the function when the condition is
phi only).

Since what ProcessBranchOnPHI does is to duplicate the basic block into
predecessors if profitable, it is still valid when the condition is freeze(phi)
too.

```
    p = phi [a, pred1] [b, pred2]
    p.fr = freeze p
    br p.fr, ...
=>
  pred1:
    p.fr = freeze a
    br p.fr, ...
  pred2:
    p.fr2 = freeze b
    br p.fr2, ...
```

Reviewed By: efriedma

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

3 years ago[JumpThreading] Add a test that duplicates insts of a basic block with cond br to...
Juneyoung Lee [Fri, 31 Jul 2020 14:05:44 +0000 (23:05 +0900)]
[JumpThreading] Add a test that duplicates insts of a basic block with cond br to preds; NFC

3 years ago[ELF][test] Add another -triple=x86_64 to linkorder-mixed.s
Fangrui Song [Thu, 6 Aug 2020 00:00:16 +0000 (17:00 -0700)]
[ELF][test] Add another -triple=x86_64 to linkorder-mixed.s

Fixes an error on macOS:
error: mach-o section specifier uses an unknown section type

3 years ago[lld-macho] Fix errant search and replace. NFC
Shoaib Meenai [Wed, 5 Aug 2020 23:59:53 +0000 (16:59 -0700)]
[lld-macho] Fix errant search and replace. NFC

3 years ago[MSSA] Update test with more detailed and resilient checks. [NFC]
Alina Sbirlea [Wed, 5 Aug 2020 23:12:09 +0000 (16:12 -0700)]
[MSSA] Update test with more detailed and resilient checks. [NFC]

3 years ago[mlir] [VectorOps] Add masked load/store operations to Vector dialect
aartbik [Wed, 5 Aug 2020 20:43:16 +0000 (13:43 -0700)]
[mlir] [VectorOps] Add masked load/store operations to Vector dialect

The intrinsics were already supported and vector.transfer_read/write lowered
direclty into these operations. By providing them as individual ops, however,
clients can used them directly, and it opens up progressively lowering transfer
operations at higher levels (rather than direct lowering to LLVM IR as done now).

Reviewed By: bkramer

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

3 years ago[gn build] Port 820e8d8656e
LLVM GN Syncbot [Wed, 5 Aug 2020 23:35:59 +0000 (23:35 +0000)]
[gn build] Port 820e8d8656e

3 years ago[ELF] Fix type of ciesWithLSDA after D84610
Fangrui Song [Wed, 5 Aug 2020 23:33:54 +0000 (16:33 -0700)]
[ELF] Fix type of ciesWithLSDA after D84610

3 years ago[ELF][test] Add REQUIES: x86 and -triple=x86_64 to linkorder-mixed.s
Fangrui Song [Wed, 5 Aug 2020 23:28:44 +0000 (16:28 -0700)]
[ELF][test] Add REQUIES: x86 and -triple=x86_64 to linkorder-mixed.s

3 years ago[Analyzer][WebKit] UncountedLambdaCaptureChecker
Jan Korous [Tue, 30 Jun 2020 04:34:44 +0000 (21:34 -0700)]
[Analyzer][WebKit] UncountedLambdaCaptureChecker

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

3 years ago[ELF] Allow SHF_LINK_ORDER sections to have sh_link=0
Fangrui Song [Wed, 5 Aug 2020 23:09:41 +0000 (16:09 -0700)]
[ELF] Allow SHF_LINK_ORDER sections to have sh_link=0

Part of https://bugs.llvm.org/show_bug.cgi?id=41734

The semantics of SHF_LINK_ORDER have been extended to represent metadata
sections associated with some other sections (usually text).

The associated text section may be discarded (e.g. LTO) and we want the
metadata section to have sh_link=0 (D72899, D76802).

Normally the metadata section is only referenced by the associated text
section. sh_link=0 means the associated text section is discarded, and
the metadata section will be garbage collected. If there is another
section (.gc_root) referencing the metadata section, the metadata
section will be retained. It's the .gc_root consumer's job to validate
the metadata sections.

  # This creates a SHF_LINK_ORDER .meta with sh_link=0
  .section .meta,"awo",@progbits,0
  1:
  .section .meta,"awo",@progbits,foo
  2:

  .section .gc_root,"a",@progbits
  .quad 1b
  .quad 2b

Reviewed By: pcc, jhenderson

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

3 years ago[CMake] Simplify CMake handling for zlib
Petr Hosek [Thu, 30 Apr 2020 20:07:13 +0000 (13:07 -0700)]
[CMake] Simplify CMake handling for zlib

Rather than handling zlib handling manually, use find_package from CMake
to find zlib properly. Use this to normalize the LLVM_ENABLE_ZLIB,
HAVE_ZLIB, HAVE_ZLIB_H. Furthermore, require zlib if LLVM_ENABLE_ZLIB is
set to YES, which requires the distributor to explicitly select whether
zlib is enabled or not. This simplifies the CMake handling and usage in
the rest of the tooling.

This is a reland of abb0075 with all followup changes and fixes that
should address issues that were reported in PR44780.

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

3 years ago[X86] Rename mod128.ll to divmod128.ll and add test cases for sdiv/udiv/urem.
Craig Topper [Wed, 5 Aug 2020 22:53:49 +0000 (15:53 -0700)]
[X86] Rename mod128.ll to divmod128.ll and add test cases for sdiv/udiv/urem.

This improves code coverage on the switch in LowerWin64_i128OP.

3 years ago[MSSA][NewPM] Handle tests with -print-memoryssa
Arthur Eubanks [Wed, 5 Aug 2020 18:12:29 +0000 (11:12 -0700)]
[MSSA][NewPM] Handle tests with -print-memoryssa

-print-memoryssa in legacy PM is print<memoryssa> in NPM.
Pin tests with -print-memoryssa to legacy PM.
Add corresponding tests for NPM where missing.
This fixes "unknown pass name 'print-memoryssa'".

Some tests still fail in Analysis/MemorySSA due to other passes that
haven't been ported.

pr43427.ll and pr43438.ll required adding -aa-pipeline=basic-aa,
-loop-simplify (since it doesn't run on legacy PM by default), and
decrementing some of the MemoryPhi numbers.

Reviewed By: asbirlea

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

3 years ago[X86] Disable copy elision in LowerMemArgument for scalarized vectors when the loc...
Craig Topper [Wed, 5 Aug 2020 22:35:16 +0000 (15:35 -0700)]
[X86] Disable copy elision in LowerMemArgument for scalarized vectors when the loc VT is a different size than the original element.

For example a v4f16 argument is scalarized to 4 i32 values. So
the values are spread out instead of being packed tightly like
in the original vector.

Fixes PR47000.

3 years ago[X86] Add test case for PR47000. NFC
Craig Topper [Wed, 5 Aug 2020 22:17:27 +0000 (15:17 -0700)]
[X86] Add test case for PR47000. NFC

3 years ago[lldb] Skip test_launch_simple on Windows
Jonas Devlieghere [Wed, 5 Aug 2020 22:37:50 +0000 (15:37 -0700)]
[lldb] Skip test_launch_simple on Windows

Because stdio manipulation unsupported on Windows.

3 years ago[mlir] use the new stateful LLVM type translator by default
Alex Zinenko [Wed, 5 Aug 2020 12:44:03 +0000 (14:44 +0200)]
[mlir] use the new stateful LLVM type translator by default

Previous type model in the LLVM dialect did not support identified structure
types properly and therefore could use stateless translations implemented as
free functions. The new model supports identified structs and must keep track
of the identified structure types present in the target context (LLVMContext or
MLIRContext) to avoid creating duplicate structs due to LLVM's type
auto-renaming. Expose the stateful type translation classes and use them during
translation, storing the state as part of ModuleTranslation.

Drop the test type translation mechanism that is no longer necessary and update
the tests to exercise type translation as part of the main translation flow.

Update the code in vector-to-LLVM dialect conversion that relied on stateless
translation to use the new class in a stateless manner.

Reviewed By: rriddle

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

3 years agoAdd verification for DW_AT_decl_file and DW_AT_call_file.
Greg Clayton [Wed, 29 Jul 2020 01:26:24 +0000 (18:26 -0700)]
Add verification for DW_AT_decl_file and DW_AT_call_file.

LTO builds have been creating invalid DWARF and one of the errors was a file index that was out of bounds. "llvm-dwarfdump --verify" will check all file indexes for line tables already, but there are no checks for the validity of file indexes in attributes.

The verification will verify if there is a DW_AT_decl_file/DW_AT_call_file that:
- there is a line table for the compile unit
- the file index is valid
- the encoding is appropriate

Tests are added that test all of the above conditions.

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

3 years ago[lldb] Skip TestProcessConnect when running remotely
Jonas Devlieghere [Wed, 5 Aug 2020 22:21:46 +0000 (15:21 -0700)]
[lldb] Skip TestProcessConnect when running remotely

This test doesn't make much sense when already running remotely.

3 years ago[lldb] Modify the `skipIfRemote` decorator so we can skip all PExpect tests.
Jonas Devlieghere [Wed, 5 Aug 2020 22:20:53 +0000 (15:20 -0700)]
[lldb] Modify the `skipIfRemote` decorator so we can skip all PExpect tests.

This patch modifies the skipIfRemote decorator so it can apply to a
whole class, which allows us to skip all PExpect tests as a whole.

Differential revision: https://reviews.llvm.org/D85365

3 years agoCFG: Destroy temporaries in (a,b) expression in the correct order.
Richard Smith [Wed, 5 Aug 2020 21:52:24 +0000 (14:52 -0700)]
CFG: Destroy temporaries in (a,b) expression in the correct order.

3 years ago[InstCombine] fold icmp with 'mul nsw/nuw' and constant operands
Sanjay Patel [Wed, 5 Aug 2020 21:04:21 +0000 (17:04 -0400)]
[InstCombine] fold icmp with 'mul nsw/nuw' and constant operands

This also removes a more specific fold that only handled icmp with 0.

https://rise4fun.com/Alive/sdM9

  Name: mul nsw with icmp eq
  Pre: (C1 != 0) && (C2 % C1) == 0
  %a = mul nsw i8 %x, C1
  %r = icmp eq i8 %a, C2
    =>
  %r = icmp eq i8 %x, C2 / C1

  Name: mul nuw with icmp eq
  Pre: (C1 != 0) && (C2 %u C1) == 0
  %a = mul nuw i8 %x, C1
  %r = icmp eq i8 %a, C2
    =>
  %r = icmp eq i8 %x, C2 /u C1

  Name: mul nsw with icmp ne
  Pre: (C1 != 0) && (C2 % C1) == 0
  %a = mul nsw i8 %x, C1
  %r = icmp ne i8 %a, C2
    =>
  %r = icmp ne i8 %x, C2 / C1

  Name: mul nuw with icmp ne
  Pre: (C1 != 0) && (C2 %u C1) == 0
  %a = mul nuw i8 %x, C1
  %r = icmp ne i8 %a, C2
    =>
  %r = icmp ne i8 %x, C2 /u C1

3 years ago[InstCombine] add tests for icmp with mul nsw/nuw; NFC
Sanjay Patel [Wed, 5 Aug 2020 20:26:14 +0000 (16:26 -0400)]
[InstCombine] add tests for icmp with mul nsw/nuw; NFC

3 years ago[WebAssembly] Fix types in wasm_simd128.h and add tests
Thomas Lively [Wed, 5 Aug 2020 21:00:01 +0000 (14:00 -0700)]
[WebAssembly] Fix types in wasm_simd128.h and add tests

47f7174ffa changed the types used in the Wasm SIMD builtin functions,
but not all of their uses in wasm_simd128.h were updated. This commit
fixes wasm_simd128.h and adds tests to make sure similar problems do
not pass uncaught in the future.

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

3 years ago[OpenMP] Fix `target data` exit for array extension
Joel E. Denny [Wed, 5 Aug 2020 20:48:04 +0000 (16:48 -0400)]
[OpenMP] Fix `target data` exit for array extension

For example:

```
 #pragma omp target data map(tofrom:arr[0:100])
 {
   #pragma omp target exit data map(delete:arr[0:100])
   #pragma omp target enter data map(alloc:arr[98:2])
 }
```

Without this patch, the transfer at the end of the target data region
is broken and fails depending on the target device.  According to my
read of the spec, the transfer shouldn't even be attempted because
`arr[0:100]` isn't (fully) present there.  To fix that, this patch
makes `DeviceTy::getTgtPtrBegin` return null for this case.

Reviewed By: grokos

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

3 years ago[OpenMP] Fix `present` diagnostic for array extension
Joel E. Denny [Wed, 5 Aug 2020 20:47:29 +0000 (16:47 -0400)]
[OpenMP] Fix `present` diagnostic for array extension

For example, without this patch, the following fails as expected with
or without the `present` modifier, but the `present` modifier doesn't
produce its usual diagnostic:

```
 #pragma omp target data map(alloc: arr[0:2])
 {
   #pragma omp target map(present, tofrom: arr[0:100]) // not fully present
   ;
 }
```

Reviewed By: grokos, vzakhari

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

3 years ago[libc] Add strspn implementation and std::bitset
cgyurgyik [Wed, 5 Aug 2020 20:36:52 +0000 (16:36 -0400)]
[libc] Add strspn implementation and std::bitset

Reviewed By: sivachandra, abrachet

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

3 years ago[libomptarget][NFC] Replace `%ld` with PRId64 for data of type int64_t.
George Rokos [Wed, 5 Aug 2020 20:06:27 +0000 (13:06 -0700)]
[libomptarget][NFC] Replace `%ld` with PRId64 for data of type int64_t.

The standard way of printing `int64_t` data is via the PRId64 macro, `ld`
is for `long int` and int64_t is not guaranteed to be typedef'ed as `long int`
on all platforms. E.g. on Windows we get mismatch warnings.

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

3 years ago[AMDGPU] Scavenge temp reg for AGPR spill
Stanislav Mekhanoshin [Tue, 4 Aug 2020 21:33:52 +0000 (14:33 -0700)]
[AMDGPU] Scavenge temp reg for AGPR spill

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

3 years ago[Propeller]: Use a descriptive temporary symbol name for the end of the basic block.
Rahman Lavaee [Wed, 5 Aug 2020 19:31:24 +0000 (12:31 -0700)]
[Propeller]: Use a descriptive temporary symbol name for the end of the basic block.

This patch changes the functionality of AsmPrinter to name the basic block end labels as LBB_END${i}_${j}, with ${i} being the identifier for the function and ${j} being the identifier for the basic block. The new naming scheme is consistent with how basic block labels are named (.LBB${i}_{j}), and how function end symbol are named (.Lfunc_end${i}) and helps to write stronger tests for the upcoming patch for BB-Info section (as proposed in https://lists.llvm.org/pipermail/llvm-dev/2020-July/143512.html). The end label is used with basicblock-labels (BB-Info section in future) and basicblock-sections to compute the size of basic blocks and basic block sections, respectively. For BB sections, the section containing the entry basic block will not have a BB end label since it already gets the function end-label.
This label is cached for every basic block (CachedEndMCSymbol) like the label for the basic block (CachedMCSymbol).

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

3 years ago[lldb/test] Support git commit version ids for clang.
Jordan Rupprecht [Wed, 5 Aug 2020 20:16:01 +0000 (13:16 -0700)]
[lldb/test] Support git commit version ids for clang.

`getCompilerVersion` assumes that `clang --version` prints out a string like `version [0-9\.]+`.
If clang is built from trunk, the version line might look like `clang version trunk (123abc)`.

Since there isn't any way of knowing by the commit id alone whether one commit is newer or older than another git commit (or clang version), assume that clang with a version id like this is very close to trunk. For example, any tests with `@skipIf(compiler="clang", compiler_version=['<', '8'])` should be run.

Reviewed By: MaskRay

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