platform/upstream/llvm.git
4 years ago[X86][XOP] Add XOP target vselect-pcmp tests
Simon Pilgrim [Mon, 6 Jul 2020 12:01:30 +0000 (13:01 +0100)]
[X86][XOP] Add XOP target vselect-pcmp tests

Noticed in the D83181 that XOP can probably do a lot more than other targets due to its vector shifts and vpcmov instructions

4 years agoRegenerate subreg liverange tests. NFC.
Simon Pilgrim [Mon, 6 Jul 2020 11:50:17 +0000 (12:50 +0100)]
Regenerate subreg liverange tests. NFC.

To simplify the diffs in a patch in development.

4 years agoRegenerate neon copy tests. NFC.
Simon Pilgrim [Mon, 6 Jul 2020 11:49:21 +0000 (12:49 +0100)]
Regenerate neon copy tests. NFC.

To simplify the diffs in a patch in development.

4 years ago[analyzer][NFC] Don't allow dependency checkers to emit diagnostics
Kirstóf Umann [Wed, 27 May 2020 10:27:32 +0000 (12:27 +0200)]
[analyzer][NFC] Don't allow dependency checkers to emit diagnostics

The thrilling conclusion to the barrage of patches I uploaded lately! This is a
big milestone towards the goal set out in http://lists.llvm.org/pipermail/cfe-dev/2019-August/063070.html.
I hope to accompany this with a patch where the a coreModeling package is added,
from which package diagnostics aren't allowed either, is an implicit dependency
of all checkers, and the core package for the first time can be safely disabled.

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

4 years ago[mlir][Vector] Add custom slt / SCF.if folding to VectorToSCF
Nicolas Vasilache [Mon, 6 Jul 2020 12:16:53 +0000 (08:16 -0400)]
[mlir][Vector] Add custom slt / SCF.if folding to VectorToSCF

scf.if currently lacks folding on true / false conditionals.
Such foldings are a bit more involved than can be addressed immediately.
This revision introduces an eager folding  for lowering vector.transfer operations in the presence of unrolling.

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

4 years ago[mlir][Vector] Add a VectorUnrollInterface and expose UnrollVectorPattern.
Nicolas Vasilache [Mon, 6 Jul 2020 10:28:50 +0000 (06:28 -0400)]
[mlir][Vector] Add a VectorUnrollInterface and expose UnrollVectorPattern.

The UnrollVectorPattern is can be used in a programmable fashion by:
```
OwningRewritePatternList patterns;
    patterns.insert<UnrollVectorPattern<AddFOp>>(ArrayRef<int64_t>{2, 2}, ctx);
    patterns.insert<UnrollVectorPattern<vector::ContractionOp>>(
        ArrayRef<int64_t>{2, 2, 2}, ctx);
    ...
    applyPatternsAndFoldGreedily(getFunction(), patterns);
```

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

4 years ago[PowerPC] Legalize SREM/UREM directly on P9.
Esme-Yi [Mon, 6 Jul 2020 11:47:31 +0000 (11:47 +0000)]
[PowerPC] Legalize SREM/UREM directly on P9.

Summary: As Bugzilla-35090 reported, the rationale for using custom lowering SREM/UREM should no longer be true. At the IR level, the div-rem-pairs pass performs the transformation where the remainder is computed from the result of the division when both a required. We should now be able to lower these directly on P9. And the pass also fixed the problem that divide is in a different block than the remainder. This is a patch to remove redundant code and make SREM/UREM legal directly on P9.

Reviewed By: lkail

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

4 years agoRemoved a RecursiveASTVisitor feature to visit operator kinds with different methods
Dmitri Gribenko [Fri, 3 Jul 2020 15:01:01 +0000 (17:01 +0200)]
Removed a RecursiveASTVisitor feature to visit operator kinds with different methods

Summary:
This feature was only used in two places, but contributed a non-trivial
amount to the complexity of RecursiveASTVisitor, and was buggy (see my
recent patches where I was fixing the bugs that I noticed). I don't
think the convenience benefit of this feature is worth the complexity.

Besides complexity, another issue with the current state of
RecursiveASTVisitor is the non-uniformity in how it handles different
AST nodes. All AST nodes follow a regular pattern, but operators are
special -- and this special behavior not documented. Correct usage of
RecursiveASTVisitor relies on shadowing member functions with specific
names and signatures. Near misses don't cause any compile-time errors,
incorrectly named or typed methods are just silently ignored. Therefore,
predictability of RecursiveASTVisitor API is quite important.

This change reduces the size of the `clang` binary by 38 KB (0.2%) in
release mode, and by 7 MB (0.3%) in debug mode. The `clang-tidy` binary
is reduced by 205 KB (0.3%) in release mode, and by 5 MB (0.4%) in debug
mode. I don't think these code size improvements are significant enough
to justify this change on its own (for me, the primary motivation is
reducing code complexity), but they I think are a nice side-effect.

Reviewers: rsmith, sammccall, ymandel, aaron.ballman

Reviewed By: rsmith, sammccall, ymandel, aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years agoMake RecursiveASTVisitor call WalkUpFrom for operators when the data recursion queue...
Dmitri Gribenko [Fri, 3 Jul 2020 10:39:14 +0000 (12:39 +0200)]
Make RecursiveASTVisitor call WalkUpFrom for operators when the data recursion queue is absent

Reviewers: eduucaldas, ymandel, rsmith

Reviewed By: eduucaldas

Subscribers: gribozavr2, cfe-commits

Tags: #clang

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

4 years agoMake RecursiveASTVisitor call WalkUpFrom for unary and binary operators in post-order...
Dmitri Gribenko [Fri, 3 Jul 2020 10:39:03 +0000 (12:39 +0200)]
Make RecursiveASTVisitor call WalkUpFrom for unary and binary operators in post-order traversal mode

Reviewers: ymandel, eduucaldas, rsmith

Reviewed By: eduucaldas, rsmith

Subscribers: gribozavr2, cfe-commits

Tags: #clang

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

4 years agoRecursiveASTVisitor: don't call WalkUp unnecessarily in post-order traversal
Dmitri Gribenko [Fri, 3 Jul 2020 11:55:01 +0000 (13:55 +0200)]
RecursiveASTVisitor: don't call WalkUp unnecessarily in post-order traversal

Summary:
How does RecursiveASTVisitor call the WalkUp callback for expressions?

* In pre-order traversal mode, RecursiveASTVisitor calls the WalkUp
  callback from the default implementation of Traverse callbacks.

* In post-order traversal mode when we don't have a DataRecursionQueue,
  RecursiveASTVisitor also calls the WalkUp callback from the default
  implementation of Traverse callbacks.

* However, in post-order traversal mode when we have a DataRecursionQueue,
  RecursiveASTVisitor calls the WalkUp callback from PostVisitStmt.

As a result, when the user overrides the Traverse callback, in pre-order
traversal mode they never get the corresponding WalkUp callback. However
in the post-order traversal mode the WalkUp callback is invoked or not
depending on whether the data recursion optimization could be applied.

I had to adjust the implementation of TraverseCXXForRangeStmt in the
syntax tree builder to call the WalkUp method directly, as it was
relying on this behavior. There is an existing test for this
functionality and it prompted me to make this extra fix.

In addition, I had to fix the default implementation implementation of
RecursiveASTVisitor::TraverseSynOrSemInitListExpr to call WalkUpFrom in
the same manner as the implementation generated by the DEF_TRAVERSE_STMT
macro. Without this fix, the InitListExprIsPostOrderNoQueueVisitedTwice
test was failing because WalkUpFromInitListExpr was never called.

Reviewers: eduucaldas, ymandel

Reviewed By: eduucaldas, ymandel

Subscribers: gribozavr2, cfe-commits

Tags: #clang

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

4 years ago[TargetLowering] Improve expansion of FSHL/FSHR by non-zero amount
Jay Foad [Fri, 29 May 2020 09:57:42 +0000 (10:57 +0100)]
[TargetLowering] Improve expansion of FSHL/FSHR by non-zero amount

Use a simpler code sequence when the shift amount is known not to be
zero modulo the bit width.

Nothing much uses this until D77152 changes the translation of fshl and
fshr intrinsics.

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

4 years ago[TargetLowering] Improve expansion of ROTL/ROTR
Jay Foad [Fri, 3 Apr 2020 13:11:56 +0000 (14:11 +0100)]
[TargetLowering] Improve expansion of ROTL/ROTR

Using a negation instead of a subtraction from a constant can save an
instruction on some targets.

Nothing much uses this until D77152 changes the translation of fshl and
fshr intrinsics.

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

4 years ago[analyzer] Force dependency checkers to be hidden
Kirstóf Umann [Fri, 12 Jun 2020 18:54:24 +0000 (20:54 +0200)]
[analyzer] Force dependency checkers to be hidden

Since strong dependencies aren't user-facing (its hardly ever legal to disable
them), lets enforce that they are hidden. Modeling checkers that aren't
dependencies are of course not impacted, but there is only so much you can do
against developers shooting themselves in the foot :^)

I also made some changes to the test files, reversing the "test" package for,
well, testing.

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

4 years ago[Support] fix user_cache_directory on mac
Sam McCall [Mon, 6 Jul 2020 10:54:11 +0000 (12:54 +0200)]
[Support] fix user_cache_directory on mac

4 years ago[SystemZ/ZOS] Implement getMainExecutable() and is_local_impl()
Kai Nacke [Mon, 6 Jul 2020 09:53:29 +0000 (05:53 -0400)]
[SystemZ/ZOS] Implement getMainExecutable() and is_local_impl()

Adds implementation of getMainExecutable() and is_local_impl() to
Support/Unix/Path.inc. Both are needed to compile LLVM for z/OS.

Reviewed By: hubert.reinterpretcast, emaste

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

4 years ago[SystemZ/ZOS] Define Endian constants for z/OS.
Kai Nacke [Mon, 15 Jun 2020 11:16:52 +0000 (13:16 +0200)]
[SystemZ/ZOS] Define Endian constants for z/OS.

This is needed to build LLVM on z/OS, as there is no header file
which provides these constants.

Reviewed By: hubert.reinterpretcast

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

4 years ago[Scalarizer] visit{Insert,Extract}ElementInst(): avoid call arg evaluation order...
Roman Lebedev [Mon, 6 Jul 2020 10:42:11 +0000 (13:42 +0300)]
[Scalarizer] visit{Insert,Extract}ElementInst(): avoid call arg evaluation order deps

Compilers may evaluate call arguments in different order,
which would result in different order of IR, which would break the tests.

Spotted thanks to Dmitri Gribenko!

4 years ago[ARM] Add extra extend and trunc costs for cast instructions
David Green [Mon, 6 Jul 2020 10:00:43 +0000 (11:00 +0100)]
[ARM] Add extra extend and trunc costs for cast instructions

This expands the existing extend costs with a few extras for larger
types than legal, which will usually be split under MVE. It also adds
trunk support for the same thing. These should not have a large effect
on many things, but makes the costs explicit and keeps a certain balance
between the trunks and extends.

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

4 years ago[Support] Add path::user_config_directory for $XDG_CONFIG_HOME etc
Sam McCall [Fri, 3 Jul 2020 13:49:36 +0000 (15:49 +0200)]
[Support] Add path::user_config_directory for $XDG_CONFIG_HOME etc

Reviewers: hokein

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Scalarizer] ExtractElement handling w/ variable insert index (PR46524)
Roman Lebedev [Mon, 6 Jul 2020 09:39:16 +0000 (12:39 +0300)]
[Scalarizer] ExtractElement handling w/ variable insert index (PR46524)

Summary:
Similar to D82961.

Reviewers: bjope, cameron.mcinally, arsenm, jdoerfert

Reviewed By: jdoerfert

Subscribers: arphaman, wdng, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Scalarizer] InsertElement handling w/ variable insert index (PR46524)
Roman Lebedev [Mon, 6 Jul 2020 09:39:16 +0000 (12:39 +0300)]
[Scalarizer] InsertElement handling w/ variable insert index (PR46524)

Summary:
I'm interested in taking the original C++ input,
for which we currently are stuck with an alloca
and producing roughly the lower IR,
with neither an alloca nor a vector ops:
https://godbolt.org/z/cRRWaJ

For that, as intermediate step, i'd to somehow perform scalarization.
As per @arsenmn suggestion, i'm trying to see if scalarizer can help me
avoid writing a bicycle.

I'm not sure if it's really intentional that variable insert is not handled currently.
If it really is, and is supposed to stay that way (?), i guess i could guard it..

See [[ https://bugs.llvm.org/show_bug.cgi?id=46524 | PR46524 ]].

Reviewers: bjope, cameron.mcinally, arsenm, jdoerfert

Reviewed By: jdoerfert

Subscribers: arphaman, uabelho, wdng, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Scalarizer] ExtractElement handling w/ constant extract index
Roman Lebedev [Mon, 6 Jul 2020 09:39:11 +0000 (12:39 +0300)]
[Scalarizer] ExtractElement handling w/ constant extract index

Summary:
It appears to be better IR-wise to aggressively scalarize it,
rather than relying on gathering it, and leaving it as-is.

Reviewers: jdoerfert, bjope, arsenm, cameron.mcinally

Reviewed By: jdoerfert

Subscribers: arphaman, wdng, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[Scalarizer] InsertElement handling w/ constant insert index
Roman Lebedev [Mon, 6 Jul 2020 09:39:06 +0000 (12:39 +0300)]
[Scalarizer] InsertElement handling w/ constant insert index

Summary: As it can be clearly seen from the diff, this results in nicer IR.

Reviewers: jdoerfert, arsenm, bjope, cameron.mcinally

Reviewed By: jdoerfert

Subscribers: arphaman, wdng, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] Lower infinite combine loop detection thresholds
Roman Lebedev [Mon, 6 Jul 2020 09:38:41 +0000 (12:38 +0300)]
[InstCombine] Lower infinite combine loop detection thresholds

Summary:
1000 iteratons is still kinda a lot.
Would it make sense to iteratively lower it, until it becomes `2`,
with some delay inbetween in order to let users actually potentially encounter it?

Reviewers: spatel, nikic, kuhar

Reviewed By: nikic

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoRevert "Revert "Revert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std:...
Stephan Herhut [Mon, 6 Jul 2020 10:18:17 +0000 (12:18 +0200)]
Revert "Revert "Revert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr, and std::weak_ptr"""

This reverts commit f706b01a00676ef0e7aefb253316c6418f022fa2.

4 years ago[ARM] Use BaseT::getMemoryOpCost for getMemoryOpCost
David Green [Mon, 6 Jul 2020 07:59:05 +0000 (08:59 +0100)]
[ARM] Use BaseT::getMemoryOpCost for getMemoryOpCost

This alters getMemoryOpCost to use the Base TargetTransformInfo version
that includes some additional checks for whether extending loads are
legal. This will generally have the effect of making <2 x ..> and some
<4 x ..> loads/stores more expensive, which in turn should help favour
larger vector factors.

Notably it alters the cost of a <4 x half>, which with the current
codegen will be expensive if it is not extended.

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

4 years agoFix indentation in FixedPoint.h. NFC.
Bevin Hansson [Wed, 1 Jul 2020 13:28:48 +0000 (15:28 +0200)]
Fix indentation in FixedPoint.h. NFC.

4 years agoFix off by one error in Bitfields
Guillaume Chatelet [Mon, 6 Jul 2020 08:47:58 +0000 (08:47 +0000)]
Fix off by one error in Bitfields

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

4 years agoFix 46594 - Alignment assertion failure in instcombine
Guillaume Chatelet [Mon, 6 Jul 2020 08:44:49 +0000 (08:44 +0000)]
Fix 46594 - Alignment assertion failure in instcombine

4 years ago[lldb/Utility] Merge Scalar::Get(Value)TypeAsCString
Pavel Labath [Mon, 6 Jul 2020 08:32:55 +0000 (10:32 +0200)]
[lldb/Utility] Merge Scalar::Get(Value)TypeAsCString

4 years ago[VE] Correct stack alignment
Kazushi (Jam) Marukawa [Mon, 6 Jul 2020 07:46:52 +0000 (16:46 +0900)]
[VE] Correct stack alignment

Summary:
Change stack alignment from 64 bits to 128 bits to follow ABI correctly.
And add a regression test for datalayout.

Reviewers: simoll, k-ishizaka

Reviewed By: simoll

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #llvm, #ve, #clang

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

4 years ago[lldb/DWARF] Look for complete array element definitions in other modules
Pavel Labath [Mon, 6 Jul 2020 08:09:13 +0000 (10:09 +0200)]
[lldb/DWARF] Look for complete array element definitions in other modules

This applies the same logic we have for incomplete class bases and
members to array element types.

4 years ago[Coroutines] Warning if return type of coroutine_handle::address is not void*
Chuanqi Xu [Mon, 6 Jul 2020 05:39:29 +0000 (13:39 +0800)]
[Coroutines] Warning if return type of coroutine_handle::address is not void*

User can own a version of coroutine_handle::address() whose return type is not
void* by using template specialization for coroutine_handle<> for some
promise_type.

In this case, the codes may violate the capability with existing async C APIs
that accepted a void* data parameter which was then passed back to the
user-provided callback.

Patch by ChuanqiXu

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

4 years ago[Fuchsia] Set projects and runtimes in the cache file
Petr Hosek [Tue, 9 Jun 2020 22:45:31 +0000 (15:45 -0700)]
[Fuchsia] Set projects and runtimes in the cache file

We make assumptions about what projects and runtimes are enabled
when configuring our toolchain build, so we should enable those in
the cache file as well rather than relying on those being set
externally.

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

4 years ago[OpenMP][Tests] Flag compatibility of OpenMP runtime tests with GCC versions
Joachim Protze [Thu, 2 Jul 2020 19:29:02 +0000 (21:29 +0200)]
[OpenMP][Tests] Flag compatibility of OpenMP runtime tests with GCC versions

If the compilation fails, the test is marked as unsupported.
-> This will never change for a specific version of gcc

If the linking fails, the test is marked as expected to fail.
-> This might change as LLVM/OpenMP implements the missing GOMP interface function

Reviewed by: Hahnfeld

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

4 years ago[OpenMP][OMPT] Fix ifdefs for OMPT code
Joachim Protze [Sun, 5 Jul 2020 06:46:31 +0000 (08:46 +0200)]
[OpenMP][OMPT] Fix ifdefs for OMPT code

Fixes build with LIBOMP_OMPT_SUPPORT=off

Reported by: Jason Edson

Reviewed by: Hahnfeld

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

4 years ago[libomptarget][test] Fix text relocations by adding -fPIC
Fangrui Song [Sun, 5 Jul 2020 19:50:31 +0000 (12:50 -0700)]
[libomptarget][test] Fix text relocations by adding -fPIC

4 years ago[SCCP] Add test for range metadata (NFC)
Nikita Popov [Sun, 5 Jul 2020 19:36:01 +0000 (21:36 +0200)]
[SCCP] Add test for range metadata (NFC)

4 years ago[Driver] Pass -gno-column-info instead of -dwarf-column-info
Fangrui Song [Sun, 5 Jul 2020 18:47:02 +0000 (11:47 -0700)]
[Driver] Pass -gno-column-info instead of -dwarf-column-info

Making -g[no-]column-info opt out reduces the length of a typical CC1 command line.
Additionally, in a non-debug compile, we won't see -dwarf-column-info.

4 years agoRevert "Revert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr...
Vy Nguyen [Sat, 4 Jul 2020 15:41:25 +0000 (11:41 -0400)]
Revert "Revert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr, and std::weak_ptr""

This reverts commit dc13ac02800220a33828ac3da629f382ca7e308d.

Rolling forward + fix typos and unused variables in tests

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

4 years ago[ARM] Remove hasSideEffects from FP converts
David Green [Sun, 5 Jul 2020 13:54:12 +0000 (14:54 +0100)]
[ARM] Remove hasSideEffects from FP converts

Whether an instruction is deemed to have side effects in determined by
whether it has a tblgen pattern that emits a single instruction.
Because of the way a lot of the the vcvt instructions are specified
either in dagtodag code or with patterns that emit multiple
instructions, they don't get marked as not having side effects.

This just marks them as not having side effects manually. It can help
especially with instruction scheduling, to not create artificial
barriers, but one of these tests also managed to produce fewer
instructions.

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

4 years ago[X86][SSE] Add PACKSS/PACKUS style patterns tests
Simon Pilgrim [Sun, 5 Jul 2020 15:17:56 +0000 (16:17 +0100)]
[X86][SSE] Add PACKSS/PACKUS style patterns tests

Similar to the proposed generic code generated by D61129 - there's still some shuffle combining improvements to go before that patch is ready.

4 years ago[clangd] Fix stack-use-after-scope
Benjamin Kramer [Sun, 5 Jul 2020 15:09:08 +0000 (17:09 +0200)]
[clangd] Fix stack-use-after-scope

Found by asan.

4 years ago[llvm] Cast to (void) the unused variable.
Alexander Belyaev [Sun, 5 Jul 2020 10:33:53 +0000 (12:33 +0200)]
[llvm] Cast to (void) the unused variable.

4 years ago[NFC] Clean up braces and anon namespace
Nathan James [Sun, 5 Jul 2020 10:16:40 +0000 (11:16 +0100)]
[NFC] Clean up braces and anon namespace

4 years ago[lldb][NFC] Clarify that spaces can't be in breakpoint names
Raphael Isemann [Sun, 5 Jul 2020 08:54:58 +0000 (10:54 +0200)]
[lldb][NFC] Clarify that spaces can't be in breakpoint names

We already check for spaces but we don't mention it in the error message.

4 years ago[lldb][NFC] Remove an unnecessary cast in SBCommandInterpreter
Raphael Isemann [Sun, 5 Jul 2020 08:54:15 +0000 (10:54 +0200)]
[lldb][NFC] Remove an unnecessary cast in SBCommandInterpreter

4 years ago[OpenMP][Tests] NFC use type macro in printf
Joachim Protze [Sun, 5 Jul 2020 07:16:09 +0000 (09:16 +0200)]
[OpenMP][Tests] NFC use type macro in printf

4 years agoAdd tests for clang -fno-zero-initialized-in-bss and llc -nozero-initialized-in-bss
Fangrui Song [Sun, 5 Jul 2020 06:26:57 +0000 (23:26 -0700)]
Add tests for clang -fno-zero-initialized-in-bss and llc -nozero-initialized-in-bss

And rename the CC1 option.

4 years ago[clang][PowerPC] Enable -fstack-clash-protection option for ppc64
Kai Luo [Sun, 5 Jul 2020 03:40:40 +0000 (03:40 +0000)]
[clang][PowerPC] Enable -fstack-clash-protection option for ppc64

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

4 years ago[llvm-objcopy] Fix crash when removing symbol table at same time as adding a symbol
Georgy Komarov [Wed, 1 Jul 2020 07:15:39 +0000 (10:15 +0300)]
[llvm-objcopy] Fix crash when removing symbol table at same time as adding a symbol

This patch resolves crash that occurs when user wanted to remove all
symbols and add a brand new one using:

```
llvm-objcopy -R .symtab --add-symbol foo=1234 in.o out.o
```

Before these changes the symbol table internally being null when adding
new symbols. For now we will regenerate symtab in this case.

This fixes: https://bugs.llvm.org/show_bug.cgi?id=43930

Reviewed By: jhenderson

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

4 years ago[WebAssembly] Do not assume br_table range checks will be gt_u
Thomas Lively [Sun, 5 Jul 2020 01:11:24 +0000 (18:11 -0700)]
[WebAssembly] Do not assume br_table range checks will be gt_u

OSS-Fuzz and the Emscripten test suite uncovered some edge cases in
which the range check instruction seemed to be an (i32.const 0) or
other unexpected instruction, triggering an assertion. Unfortunately
the reproducers are rather complicated, so they don't make good unit
tests. This commit removes the bad assertion and conservatively
optimizes range checks only when the range check instruction is
i32.gt_u.

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

4 years agoFix two -Wrange-loop-analysis warnings that Xcode 12 beta incorrectly complains about
Nico Weber [Sun, 5 Jul 2020 00:41:27 +0000 (20:41 -0400)]
Fix two -Wrange-loop-analysis warnings that Xcode 12 beta incorrectly complains about

Xcode 12 beta apparently has the Wrange-loop-analysis changes from
half a year ago, but it seems to lack https://reviews.llvm.org/D72212
which made the warning usable again.

4 years ago[gn build] fix link of libclang_rt.asan_osx_dynamic.dylib if command line tools are...
Nico Weber [Sun, 5 Jul 2020 00:26:39 +0000 (20:26 -0400)]
[gn build] fix link of libclang_rt.asan_osx_dynamic.dylib if command line tools are not installed

4 years ago[gn build] make stage2_unix_toolchain set clang_base_path
Nico Weber [Fri, 3 Jul 2020 17:52:18 +0000 (13:52 -0400)]
[gn build] make stage2_unix_toolchain set clang_base_path

This fixes the build of compiler-rt on macOS when _not_ using
clang_base_path in args.gn: Xcode clang knows where to find the
SDK, but regular clang doesn't and needs a -isysroot parameter.
We correctly add that parameter when clang_base_path is set,
but else we omit it. If clang_base_path was not set, we also
didn't add the flag for stage2_unix_toolchain() when we build
compiler-rt with just-built clang.

Make stage2_unix_toolchain() use clang_base_path instead of setting
cc / cxx. It's less code, and it gets things like this right.

4 years ago[llvm-reduce] extractGVsFromModule(): don't crash when deleting instr twice
Roman Lebedev [Sat, 4 Jul 2020 22:01:46 +0000 (01:01 +0300)]
[llvm-reduce] extractGVsFromModule(): don't crash when deleting instr twice

As it can be seen in newly-added (previously-crashing) test-case,
there can be a situation where multiple GV's are used in instr,
and we would schedule the same instruction to be deleted several times,
crashing when trying to delete it the second time.

We could either store WeakVH (done here), or use something set-like.
I think using WeakVH is prevalent in these cases elsewhere.

4 years ago[llvm-reduce] extractArgumentsFromModule(): don't crash when deleting instr twice
Roman Lebedev [Sat, 4 Jul 2020 21:48:05 +0000 (00:48 +0300)]
[llvm-reduce] extractArgumentsFromModule(): don't crash when deleting instr twice

As it can be seen in newly-added (previously-crashing) test-case,
there can be a situation where multiple arguments are used in instr,
and we would schedule the same instruction to be deleted several times,
crashing when trying to delete it the second time.

We could either store WeakVH (done here), or use something set-like.
I think using WeakVH is prevalent in these cases elsewhere.

4 years ago[DAGCombiner] visitSIGN_EXTEND_INREG should fold sext_vector_inreg(undef) to 0 not...
Craig Topper [Sat, 4 Jul 2020 21:35:49 +0000 (14:35 -0700)]
[DAGCombiner] visitSIGN_EXTEND_INREG should fold sext_vector_inreg(undef) to 0 not undef.

We need to ensure that the sign bits of the result all match
so we can't fold to undef.

Similar to PR46585.

Reviewed By: lebedev.ri

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

4 years ago[OpenMPOpt] ICV Tracking
sstefan1 [Mon, 29 Jun 2020 22:08:37 +0000 (00:08 +0200)]
[OpenMPOpt] ICV Tracking

This is the first and most basic ICV Tracking implementation. For this
first version, we only support deduplication within the same BB.

Reviewers: jdoerfert, JonChesterfield, hamax97, jhuber6, uenoku,
baziotis

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

4 years agoRevert "[MLIR] Parallelize affine.for op to 1-D affine.parallel op"
Mehdi Amini [Sat, 4 Jul 2020 20:55:47 +0000 (20:55 +0000)]
Revert "[MLIR] Parallelize affine.for op to 1-D affine.parallel op"

This reverts commit 5f2843857feee6fbf755c12c21698a4987eda5d1.
This broke the build when -DDBUILD_SHARED_LIBS=ON is used.

4 years agoRevert "[AssumeBundles] Use operand bundles to encode alignment assumptions"
Roman Lebedev [Sat, 4 Jul 2020 19:45:41 +0000 (22:45 +0300)]
Revert "[AssumeBundles] Use operand bundles to encode alignment assumptions"

Assume bundle can have more than one entry with the same name,
but at least AlignmentFromAssumptionsPass::extractAlignmentInfo() uses
getOperandBundle("align"), which internally assumes that it isn't the
case, and happily crashes otherwise.

Minimal reduced reproducer: run `opt -alignment-from-assumptions` on

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%0 = type { i64, %1*, i8*, i64, %2, i32, %3*, i8* }
%1 = type opaque
%2 = type { i8, i8, i16 }
%3 = type { i32, i32, i32, i32 }

; Function Attrs: nounwind
define i32 @f(%0* noalias nocapture readonly %arg, %0* noalias %arg1) local_unnamed_addr #0 {
bb:
  call void @llvm.assume(i1 true) [ "align"(%0* %arg, i64 8), "align"(%0* %arg1, i64 8) ]
  ret i32 0
}

; Function Attrs: nounwind willreturn
declare void @llvm.assume(i1) #1

attributes #0 = { nounwind "reciprocal-estimates"="none" }
attributes #1 = { nounwind willreturn }

This is what we'd have with -mllvm -enable-knowledge-retention

This reverts commit c95ffadb2474a4d8c4f598d94d35a9f31d9606cb.

4 years ago[flang] Add fixes and missing stmts to I/O runtime API handlers (ext. I/O part 8)
peter klausler [Sat, 4 Jul 2020 18:06:28 +0000 (11:06 -0700)]
[flang] Add fixes and missing stmts to I/O runtime API handlers (ext. I/O part 8)

Complete the rework of the initial implementation of external I/O
to fix problems found in testing (tests to follow); add handlers
for hitherto unimplemented PAUSE, FLUSH, ENDFILE, BACKSPACE, and
REWIND statements.

Reviewed By: tskeith, sscalpone

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

4 years ago[DAGCombiner] Don't fold zext_vector_inreg/sext_vector_inreg(undef) to undef. Fold...
Craig Topper [Sat, 4 Jul 2020 18:42:00 +0000 (11:42 -0700)]
[DAGCombiner] Don't fold zext_vector_inreg/sext_vector_inreg(undef) to undef. Fold to 0.

zext_vector_inreg needs to produces 0s in the extended bits and
sext_vector_inreg needs to produce upper bits that are all the
same. So we should fold them to a 0 vector instead of undef.

Fixes PR46585.

4 years ago[X86] Add test caes for pr46585. NFC
Craig Topper [Sat, 4 Jul 2020 18:40:40 +0000 (11:40 -0700)]
[X86] Add test caes for pr46585. NFC

4 years ago[Utils] Make -assume-builder/-assume-simplify actually work on Old-PM
Roman Lebedev [Sat, 4 Jul 2020 17:04:28 +0000 (20:04 +0300)]
[Utils] Make -assume-builder/-assume-simplify actually work on Old-PM

clang w/ old-pm currently would simply crash
when -mllvm  -enable-knowledge-retention=true is specified.

Clearly, these two passes had no Old-PM test coverage,
which would have shown the problem - not requiring AssumptionCacheTracker,
but then trying to always get it.

Also, why try to get domtree only if it's cached,
but at the same time marking it as required?

4 years ago[flang] Extend & fix per-I/O-statement state (ext. I/O work part 7)
peter klausler [Sat, 4 Jul 2020 00:57:28 +0000 (17:57 -0700)]
[flang] Extend & fix per-I/O-statement state (ext. I/O work part 7)

The per-I/O-statement state structures need to support missing
external I/O statements, and some bugs found in testing with
formatted input and record advancement are fixed.  The effects
of these changes will not be visible until further patches to
the I/O API handlers are pushed.

Reviewed By: tskeith

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

4 years ago[profile] Mark gcov test as unsupported on Darwin.
Amara Emerson [Sat, 4 Jul 2020 17:41:27 +0000 (10:41 -0700)]
[profile] Mark gcov test as unsupported on Darwin.

4 years ago[X86] Teach lowerShuffleAsBlend to use bit blend for v16i8/v32i8/v16i16 when avx512vl...
Craig Topper [Sat, 4 Jul 2020 17:26:56 +0000 (10:26 -0700)]
[X86] Teach lowerShuffleAsBlend to use bit blend for v16i8/v32i8/v16i16 when avx512vl is enabled but not avx512bw.

Probably not super important since there are no real CPUs with
avx512vl and not avx512bw. But vpternlog should be better than
vblendvb.

I do wonder if we should use vpternlog even with BWI. We
currently use vblendmb or vpblendmw by putting the mask into a GPR
and moving it to a k-register. But I don't think we hoist the
GPR to k-register copy in machine LICM. Using VPTERNLOG would use
a constant pool load, but has the advantage that we're pretty good
at hoisting and rematerializing those.

Reviewed By: RKSimon

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

4 years ago[X86] Disable VPBLENDVB formation in combineLogicBlendIntoPBLENDV if VPTERNLOG is...
Craig Topper [Sat, 4 Jul 2020 16:59:52 +0000 (09:59 -0700)]
[X86] Disable VPBLENDVB formation in combineLogicBlendIntoPBLENDV if VPTERNLOG is supported.

VPBLENDVB is multiple uops while VPTERNLOG is a single uop. So
we should use that instead.

Reviewed By: RKSimon

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

4 years agoRevert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr, and...
Vy Nguyen [Sat, 4 Jul 2020 15:29:08 +0000 (11:29 -0400)]
Revert "[libcxx] Put clang::trivial_abi on std::unique_ptr, std::shared_ptr, and std::weak_ptr"

This reverts commit 5cde3c9633fd071c90e9f9ce54a002e78fdd9df9.

The tests were reported failing on clang10

4 years ago[clang] Fix two tests that are affected by llvm opt change
Roman Lebedev [Sat, 4 Jul 2020 15:26:06 +0000 (18:26 +0300)]
[clang] Fix two tests that are affected by llvm opt change

4 years ago[InstCombine] fix miscompile from umul_with_overflow matching
Sanjay Patel [Sat, 4 Jul 2020 15:09:14 +0000 (11:09 -0400)]
[InstCombine] fix miscompile from umul_with_overflow matching

As noted in PR46561:
https://bugs.llvm.org/show_bug.cgi?id=46561
...it takes something beyond a minimal IR example to trigger
this bug because it relies on matching non-canonical IR.

There are no tests that show the need for matching this
pattern, so I'm just deleting it to fix the miscompile.

4 years ago[InstCombine] Always try to invert non-canonical predicate of an icmp
Roman Lebedev [Sat, 4 Jul 2020 14:39:48 +0000 (17:39 +0300)]
[InstCombine] Always try to invert non-canonical predicate of an icmp

Summary:
The actual transform i was going after was:
https://rise4fun.com/Alive/Tp9H
```
Name: zz
Pre: isPowerOf2(C0) && isPowerOf2(C1) && C1 == C0
%t0 = and i8 %x, C0
%r = icmp eq i8 %t0, C1
  =>
%t = icmp eq i8 %t0, 0
%r = xor i1 %t, -1

Name: zz
Pre: isPowerOf2(C0)
%t0 = and i8 %x, C0
%r = icmp ne i8 %t0, 0
  =>
%t = icmp eq i8 %t0, 0
%r = xor i1 %t, -1
```
but as it can be seen from the current tests, we already canonicalize most of it,
and we are only missing handling multi-use non-canonical icmp predicates.

If we have both `!=0` and `==0`, even though we can CSE them,
we end up being stuck with them. We should canonicalize to the `==0`.

I believe this is one of the cleanup steps i'll need after `-scalarizer`
if i end up proceeding with my WIP alloca promotion helper pass.

Reviewers: spatel, jdoerfert, nikic

Reviewed By: nikic

Subscribers: zzheng, hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[InstCombine] improve debug value names; NFC
Sanjay Patel [Sat, 4 Jul 2020 14:44:27 +0000 (10:44 -0400)]
[InstCombine] improve debug value names; NFC

The use of 'tmp' can trigger warnings from the update_test_checks.py
script. That's evidence of a flaw in the script's logic, but we
can always do better than naming variables 'tmp' in LLVM too.

The phi test file should be updated with auto-generated regex CHECK
lines, so it isn't affected by cosmetic diffs, but I don't have
time to do that right now.

4 years ago[InstCombine] add test for miscompile (PR46561); NFC
Sanjay Patel [Sat, 4 Jul 2020 14:08:44 +0000 (10:08 -0400)]
[InstCombine] add test for miscompile (PR46561); NFC

4 years ago[DAG] matchBinOpReduction - match subvector reduction patterns beyond a matched shuff...
Simon Pilgrim [Sat, 4 Jul 2020 14:27:55 +0000 (15:27 +0100)]
[DAG] matchBinOpReduction - match subvector reduction patterns beyond a matched shufflevector reduction

Currently matchBinOpReduction only handles shufflevector reduction patterns, but in many cases these only occur in the final stages of a reduction, once we're down to legal vector widths.

Before this its likely that we are performing reductions using subvector extractions to repeatedly split the source vector in half and perform the binop on the halves.

Assuming we've found a non-partial reduction, this patch continues looking for subvector reductions as far as it can beyond the last shufflevector.

Fixes PR37890

4 years ago[libcxx testing] Remove ALLOW_RETRIES from another test
David Zarzycki [Sat, 4 Jul 2020 14:13:46 +0000 (10:13 -0400)]
[libcxx testing] Remove ALLOW_RETRIES from another test

4 years ago[X86][SSE] Add add/fadd reduction shuffle+subvector tests
Simon Pilgrim [Sat, 4 Jul 2020 13:42:20 +0000 (14:42 +0100)]
[X86][SSE] Add add/fadd reduction shuffle+subvector tests

Tests based on the PR37890 test cases - the vector combine pass should leave us with a reduction chain ending in extract(add(x,shuffle(x,1,-1,...))), but the higher reduction stages will be subvector extractions not shuffles.

4 years ago[MLIR] Parallelize affine.for op to 1-D affine.parallel op
Yash Jain [Sat, 4 Jul 2020 13:22:46 +0000 (18:52 +0530)]
[MLIR] Parallelize affine.for op to 1-D affine.parallel op

Introduce pass to convert parallel affine.for op into 1-D
affine.parallel op. Run using --affine-parallelize. Removes
test-detect-parallel: pass for checking parallel affine.for ops.

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

4 years ago[X86][AVX] Fold PACK(LOSUBVECTOR(SHUFFLE(X)),HISUBVECTOR(SHUFFLE(X))) -> SHUFFLE...
Simon Pilgrim [Sat, 4 Jul 2020 12:54:30 +0000 (13:54 +0100)]
[X86][AVX] Fold PACK(LOSUBVECTOR(SHUFFLE(X)),HISUBVECTOR(SHUFFLE(X))) -> SHUFFLE(PACK(LOSUBVECTOR(X),HISUBVECTOR(X)))

Using PACK for truncations leaves us with intermediate shuffles that can be tricky to remove while the truncation tree is being formed.

This fold helps pull out the PERMQ case which is one of the most common, avoiding some costly lane-crossing shuffles.

A future patch will begin adding more general shuffle folding, which we should be able to use for HADD/HSUB as well.

4 years ago[gn build] Port b6cbe6cb039
LLVM GN Syncbot [Sat, 4 Jul 2020 12:02:31 +0000 (12:02 +0000)]
[gn build] Port b6cbe6cb039

4 years ago[analyzer][NFC] Move the data structures from CheckerRegistry to the Core library
Kirstóf Umann [Thu, 18 Jun 2020 19:40:43 +0000 (21:40 +0200)]
[analyzer][NFC] Move the data structures from CheckerRegistry to the Core library

If you were around the analyzer for a while now, you must've seen a lot of
patches that awkwardly puts code from one library to the other:

* D75360 moves the constructors of CheckerManager, which lies in the Core
  library, to the Frontend library. Most the patch itself was a struggle along
  the library lines.
* D78126 had to be reverted because dependency information would be utilized
  in the Core library, but the actual data lied in the frontend.
  D78126#inline-751477 touches on this issue as well.

This stems from the often mentioned problem: the Frontend library depends on
Core and Checkers, Checkers depends on Core. The checker registry functions
(`registerMallocChecker`, etc) lie in the Checkers library in order to keep each
checker its own module. What this implies is that checker registration cannot
take place in the Core, but the Core might still want to use the data that
results from it (which checker/package is enabled, dependencies, etc).

D54436 was the patch that initiated this. Back in the days when CheckerRegistry
was super dumb and buggy, it implemented a non-documented solution to this
problem by keeping the data in the Core, and leaving the logic in the Frontend.
At the time when the patch landed, the merger to the Frontend made sense,
because the data hadn't been utilized anywhere, and the whole workaround without
any documentation made little sense to me.

So, lets put the data back where it belongs, in the Core library. This patch
introduces `CheckerRegistryData`, and turns `CheckerRegistry` into a short lived
wrapper around this data that implements the logic of checker registration. The
data is tied to CheckerManager because it is required to parse it.

Side note: I can't help but cringe at the fact how ridiculously awkward the
library lines are. I feel like I'm thinking too much inside the box, but I guess
this is just the price of keeping the checkers so modularized.

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

4 years ago[clangd] Try to fix windows buildbot. NFC
Sam McCall [Sat, 4 Jul 2020 10:03:22 +0000 (12:03 +0200)]
[clangd] Try to fix windows buildbot. NFC

http://45.33.8.238/win/19116/step_9.txt

4 years ago[MLIR][Linalg] Generate the right type of load/store when lowering max/min pooling ops
Uday Bondhugula [Thu, 11 Jun 2020 12:40:53 +0000 (18:10 +0530)]
[MLIR][Linalg] Generate the right type of load/store when lowering max/min pooling ops

While lowering min/max pooling ops to loops, generate the right kind of
load/stores (std or affine) instead of always generating std
load/stores.

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

4 years ago[SVE] Fix invalid assert in expand_DestructiveOp.
Paul Walker [Sat, 4 Jul 2020 09:17:53 +0000 (09:17 +0000)]
[SVE] Fix invalid assert in expand_DestructiveOp.

AArch64ExpandPseudo::expand_DestructiveOp contains an assert to
ensure the destructive operand's register is unique.  However,
this is only required when psuedo expansion emits a movprfx.

A simple example when a movprfx is not required is
  Z0 = FADD_ZPZZ_UNDEF_S P0, Z0, Z0
which expands to an unprefixed FADD_ZPmZ_S instruction.

This patch moves the assert to the places where a movprfx is emitted.

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

4 years ago[clangd] Config: compute config in TUScheduler and BackgroundIndex
Sam McCall [Thu, 2 Jul 2020 21:09:25 +0000 (23:09 +0200)]
[clangd] Config: compute config in TUScheduler and BackgroundIndex

Summary:
ClangdServer owns the question of exactly which config to create, but
TUScheduler/BackgroundIndex control threads and so decide at which point
to inject it.

Reviewers: kadircet

Subscribers: ilya-biryukov, javed.absar, MaskRay, jkorous, arphaman, usaxena95, cfe-commits

Tags: #clang

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

4 years ago[InstSimplify] Simplify comparison between zext(x) and sext(x)
Nikita Popov [Thu, 2 Jul 2020 19:35:40 +0000 (21:35 +0200)]
[InstSimplify] Simplify comparison between zext(x) and sext(x)

This is picking up a loose thread from D69006: We can simplify
(zext x) ule (sext x) and (zext x) sge (sext x) to true, with
various permutations. Oddly, SCEV knows about this identity,
but nothing on the IR level does.

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

4 years ago[InstSimplify] Add additional zext/sext comparison tests (NFC)
Nikita Popov [Sat, 4 Jul 2020 08:59:01 +0000 (10:59 +0200)]
[InstSimplify] Add additional zext/sext comparison tests (NFC)

Add vector variants, and negative tests where the operand does
not match.

4 years ago[gn build] Port 8bd000a65fe
LLVM GN Syncbot [Sat, 4 Jul 2020 08:53:11 +0000 (08:53 +0000)]
[gn build] Port 8bd000a65fe

4 years ago[clangd] Config: loading and caching config from disk.
Sam McCall [Wed, 1 Jul 2020 14:30:57 +0000 (16:30 +0200)]
[clangd] Config: loading and caching config from disk.

Summary:
The Provider extension point is designed to also be implemented by
ClangdLSPServer (to inject config-over-lsp) and likely by embedders.

Reviewers: kadircet

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

Tags: #clang

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

4 years ago[X86] Directly emit VPTERNLOG from canonicalizeBitSelect when possible.
Craig Topper [Sat, 4 Jul 2020 05:08:28 +0000 (22:08 -0700)]
[X86] Directly emit VPTERNLOG from canonicalizeBitSelect when possible.

Seems to produce better results on some rotate tests. And is
neutral for other tests.

4 years ago[PowerPC] Implement probing for prologue
Kai Luo [Fri, 3 Jul 2020 05:55:33 +0000 (05:55 +0000)]
[PowerPC] Implement probing for prologue

This patch is part of supporting `-fstack-clash-protection`. Implemented
probing when emitting prologue.

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

4 years ago[X86] Add matching support for X86ISD::ANDNP to X86DAGToDAGISel::tryVPTERNLOG.
Craig Topper [Sat, 4 Jul 2020 00:50:35 +0000 (17:50 -0700)]
[X86] Add matching support for X86ISD::ANDNP to X86DAGToDAGISel::tryVPTERNLOG.

4 years ago[flang] Further implementation of external I/O unit operations (part 6)
peter klausler [Fri, 3 Jul 2020 19:38:22 +0000 (12:38 -0700)]
[flang] Further implementation of external I/O unit operations (part 6)

Rework initial implementation of external I/O unit operations to
fix problems exposed in unit tests (in a later patch).  Add flushing.

Reviewed By: sscalpone

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

4 years ago[WebAssembly] Do not omit range checks for i64 switches
Thomas Lively [Sat, 4 Jul 2020 00:15:39 +0000 (17:15 -0700)]
[WebAssembly] Do not omit range checks for i64 switches

Summary:
Since the br_table instruction takes an i32, switches over i64s (and
larger integers) must use the i32.wrap_i64 instruction to truncate the
table index. This truncation makes numbers just over 2^32
indistinguishable from small numbers, so it was a miscompilation to
omit the range check preceding these br_tables. This change fixes the
problem by skipping the "fixing" of the br_table when the range check
is an i64 instruction.

Fixes PR46447.

Reviewers: aheejin, dschuff, kripken

Reviewed By: kripken

Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits

Tags: #llvm

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

4 years ago[gcov][test] Add `UNSUPPORTED: host-byteorder-big-endian` to gcov-fork.c
Fangrui Song [Sat, 4 Jul 2020 00:06:54 +0000 (17:06 -0700)]
[gcov][test] Add `UNSUPPORTED: host-byteorder-big-endian` to gcov-fork.c

This test strangely failed on ppc64be
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/50913

4 years ago[gcov][test] Reorganize some compiler-rt/test/profile tests
Fangrui Song [Fri, 3 Jul 2020 23:17:06 +0000 (16:17 -0700)]
[gcov][test] Reorganize some compiler-rt/test/profile tests

4 years ago[LoopDeletion] Emit a remark when a dead loop is deleted
Francis Visoiu Mistrih [Fri, 3 Jul 2020 05:09:01 +0000 (22:09 -0700)]
[LoopDeletion] Emit a remark when a dead loop is deleted

This emits a remark when LoopDeletion deletes a dead loop, using the
source location of the loop's header. There are currently two reasons
for removing the loop: invariant loop or loop that never executes.

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

4 years ago[PowerPC][NFC] Fix indentation
Lei Huang [Fri, 3 Jul 2020 21:47:24 +0000 (16:47 -0500)]
[PowerPC][NFC] Fix indentation