platform/upstream/llvm.git
4 years ago[CodeGen] [ExpandReduction] Fix the bug for ExpandReduction() when vector size isn...
shkzhang [Sun, 3 Nov 2019 03:59:12 +0000 (23:59 -0400)]
[CodeGen] [ExpandReduction] Fix the bug for ExpandReduction() when vector size isn't power of 2

Summary:
For below test case, we will get assert error except for AArch64 and ARM:

declare i8 @llvm.experimental.vector.reduce.and.i8.v3i8(<3 x i8> %a)
define i8 @test_v3i8(<3 x i8> %a) nounwind {
  %b = call i8 @llvm.experimental.vector.reduce.and.i8.v3i8(<3 x i8> %a)
  ret i8 %b
}
In the function getShuffleReduction (), we can see it needs the vector size must be power of 2.

This patch is fix below error when the number of element is not power of 2 for those llvm.experimental.vector.reduce.* function.

Reviewed By: jsji

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

4 years ago[CodeGenCXX][test] Use -fno-experimental-new-pass-manager for CodeGenCXX/union-tbaa2...
Fangrui Song [Sat, 2 Nov 2019 22:57:10 +0000 (15:57 -0700)]
[CodeGenCXX][test] Use -fno-experimental-new-pass-manager for CodeGenCXX/union-tbaa2.cpp after D68593/llvmorg-10-init-8907-gcecc0d27ad5

It fails with -DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=0 builds. Temporarily use -fno-experimental-new-pass-manager while we are investigating the root cause.

4 years agoStop static analyzer warnings about using bitwise operators on booleans. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 22:38:07 +0000 (22:38 +0000)]
Stop static analyzer warnings about using bitwise operators on booleans. NFCI.

Call each of the rebase_if() calls separately.

4 years agoTargetParserTest - testARMArch - stop bitwise operators on boolean warnings. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 22:26:00 +0000 (22:26 +0000)]
TargetParserTest - testARMArch - stop bitwise operators on boolean warnings. NFCI.

Ensure the test still runs all target checks but stop the static analyzer warnings.

4 years agoCodeGen/DIE.h: prefer the default member initializer to the member initializers in...
Fangrui Song [Sat, 2 Nov 2019 21:54:59 +0000 (14:54 -0700)]
CodeGen/DIE.h: prefer the default member initializer to the member initializers in the constructor. NFC

4 years ago[mips] Remove trailing spaces. NFC
Simon Atanasyan [Sat, 2 Nov 2019 13:35:52 +0000 (16:35 +0300)]
[mips] Remove trailing spaces. NFC

4 years ago[mips] Split long lines in the code. NFC
Simon Atanasyan [Sat, 2 Nov 2019 13:33:10 +0000 (16:33 +0300)]
[mips] Split long lines in the code. NFC

4 years agoA15SDOptimizer::getPrefSPRLane - fix null dereference warning. NFCI
Simon Pilgrim [Sat, 2 Nov 2019 21:49:12 +0000 (21:49 +0000)]
A15SDOptimizer::getPrefSPRLane - fix null dereference warning. NFCI

4 years agoisConditionalBranch/isUnconditionalBranch - use boolean operators. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 21:28:37 +0000 (21:28 +0000)]
isConditionalBranch/isUnconditionalBranch - use boolean operators. NFCI.

Stop static analyzer warnings about using bitwise operators on booleans.

4 years ago[LV] Generalize conditions for sinking instrs for first order recurrences.
Florian Hahn [Sat, 2 Nov 2019 17:45:33 +0000 (18:45 +0100)]
[LV] Generalize conditions for sinking instrs for first order recurrences.

If the recurrence PHI node has a single user, we can sink any
instruction without side effects, given that all users are dominated by
the instruction computing the incoming value of the next iteration
('Previous'). We can sink instructions that may cause traps, because
that only causes the trap to occur later, but not on any new paths.

With the relaxed check, we also have to make sure that we do not have a
direct cycle (meaning PHI user == 'Previous), which indicates a
reduction relation, which potentially gets missed by
ReductionDescriptor.

As follow-ups, we can also sink stores, iff they do not alias with
other instructions we move them across and we could also support sinking
chains of instructions and multiple users of the PHI.

Fixes PR43398.

Reviewers: hsaito, dcaballe, Ayal, rengolin

Reviewed By: Ayal

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

4 years agoisImmPCRel/isImmSigned - both functions should return bool not unsigned. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 21:03:36 +0000 (21:03 +0000)]
isImmPCRel/isImmSigned - both functions should return bool not unsigned. NFCI.

4 years agoMatchTableRecord::emit - fix boolean operator precedence warnings from PVS Studio...
Simon Pilgrim [Sat, 2 Nov 2019 21:01:45 +0000 (21:01 +0000)]
MatchTableRecord::emit - fix boolean operator precedence warnings from PVS Studio. NFCI.

Make it clear that (Flags & MTRF_????) should resolve to a boolean.

4 years ago[Attributor][NFCI] Do not track unnecessary dependences
Johannes Doerfert [Sat, 2 Nov 2019 19:47:45 +0000 (14:47 -0500)]
[Attributor][NFCI] Do not track unnecessary dependences

If we do not look at assumed information there is no need to track
dependences.

4 years ago[Attributor][NFCI] Distinguish optional and required dependences
Johannes Doerfert [Sat, 2 Nov 2019 07:48:05 +0000 (02:48 -0500)]
[Attributor][NFCI] Distinguish optional and required dependences

Dependences between two abstract attributes SRC and TRG come naturally in
two flavors:
  Either (1) "some" information of SRC is *required* for TRG to derive
  information, or (2) SRC is just an *optional* way for TRG to derive
  information.

While it is not strictly necessary to distinguish these types
explicitly, it can help us to converge faster, in terms of iterations,
and also cut down the number of `AbstractAttribute::update` calls.

As far as I can tell, we only use optional dependences for liveness so
far but that might change in the future. With this change the Attributor
can be informed about the "dependence class" and it will perform
appropriate actions when an Attribute is set to an invalid state, thus
one that cannot be used by others to derive information from.

4 years agoFix -Wreorder warnings. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 20:12:35 +0000 (20:12 +0000)]
Fix -Wreorder warnings. NFCI.

4 years agoARMAttributeParser - fix shadow variable name warnings from decodeULEB128 calls....
Simon Pilgrim [Sat, 2 Nov 2019 20:11:29 +0000 (20:11 +0000)]
ARMAttributeParser - fix shadow variable name warnings from decodeULEB128 calls. NFCI.

Consistently rename the Length attribute to DecodeLength in decodeULEB128 calls.

4 years agoGSYMTest::TestLineTable - check all LT1+LT2 comparisons.
Simon Pilgrim [Sat, 2 Nov 2019 19:24:03 +0000 (19:24 +0000)]
GSYMTest::TestLineTable - check all LT1+LT2 comparisons.

PVS Studio was warning about "LT2 < LT2" but really we should be testing all permutations of LT1 and LT2.

4 years ago[LegacyPassManager] Fixed "null check after derefencing" warning
Dávid Bolvanský [Sat, 2 Nov 2019 19:14:29 +0000 (20:14 +0100)]
[LegacyPassManager] Fixed "null check after derefencing" warning

The 'RequiredPass' pointer was utilized before it was verified against nullptr. Check lines: 1626, 1629.

4 years agobuild: avoid custom handling for C++ standard
Saleem Abdulrasol [Sat, 2 Nov 2019 19:06:17 +0000 (15:06 -0400)]
build: avoid custom handling for C++ standard

Use the builtin CMake support for specifying the proper flags for the targets to
build at a certain C++ standard.  This avoids unnecessary checks in CMake,
speeding up the configure phase as well as simplifies the logic overall.

4 years agoX86_MC::createX86MCSubtargetInfo - X86_MC::ParseX86Triple never returns an empty...
Simon Pilgrim [Sat, 2 Nov 2019 18:45:31 +0000 (18:45 +0000)]
X86_MC::createX86MCSubtargetInfo - X86_MC::ParseX86Triple never returns an empty string. NFCI.

PVS Studio was complaining that the expression '!ArchFS.empty()' is always true.

4 years agoX86Operand::print - fix SymName shadow variable warning. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 18:37:58 +0000 (18:37 +0000)]
X86Operand::print - fix SymName shadow variable warning. NFCI.

4 years agoNoFree argument attribute.
Stefan Stipanovic [Sat, 2 Nov 2019 15:35:38 +0000 (16:35 +0100)]
NoFree argument attribute.

Summary: Deducing nofree atrribute for function arguments.

Reviewers: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFastISel - fix uninitialized variable warnings in constructor. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 17:40:52 +0000 (17:40 +0000)]
FastISel - fix uninitialized variable warnings in constructor. NFCI.

4 years agollvm.coverage.FunctionRecord - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 17:38:04 +0000 (17:38 +0000)]
llvm.coverage.FunctionRecord - fix uninitialized variable warning. NFCI.

4 years agoX86AsmPrinter - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 17:36:14 +0000 (17:36 +0000)]
X86AsmPrinter - fix uninitialized variable warnings. NFCI.

4 years agoDIEAbbrev - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 17:28:08 +0000 (17:28 +0000)]
DIEAbbrev - fix uninitialized variable warning. NFCI.

4 years agoFix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 17:27:18 +0000 (17:27 +0000)]
Fix uninitialized variable warnings. NFCI.

4 years agoFix uninitialized variable warning. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 16:45:06 +0000 (16:45 +0000)]
Fix uninitialized variable warning. NFCI.

4 years agoRevert "[Codegen] Both sides of '&&' are same; fixed"
Dávid Bolvanský [Sat, 2 Nov 2019 18:02:33 +0000 (19:02 +0100)]
Revert "[Codegen] Both sides of '&&' are same; fixed"

This reverts commit edb42dccfafb2c0d25d19175c49d016a7c2e0b13. Buildbot timeouts.

4 years agomake -ftime-trace also trace time spent creating debug info
Luboš Luňák [Sat, 2 Nov 2019 15:39:59 +0000 (16:39 +0100)]
make -ftime-trace also trace time spent creating debug info

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

4 years agoRevert "NoFree argument attribute."
Stefan Stipanovic [Sat, 2 Nov 2019 16:31:02 +0000 (17:31 +0100)]
Revert "NoFree argument attribute."

This reverts commit c12efa2ed0547f7f9f8fba0ad7a76a4cb08bf53a.

4 years agoTargetMachine - fix uninitialized variable warning. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 16:11:01 +0000 (16:11 +0000)]
TargetMachine - fix uninitialized variable warning. NFCI.

TargetPassConfig::addCoreISelPasses() always initializes O0WantsFastISel but it appeases static analyzers that complain that O0WantsFastISel isn't initialized in the constructor.

4 years agoCustomTypeNode/SpecialTableSymbolNode - fix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 16:00:21 +0000 (16:00 +0000)]
CustomTypeNode/SpecialTableSymbolNode - fix uninitialized variable warnings. NFCI.

4 years ago[Codegen] Both sides of '&&' are same; fixed
Dávid Bolvanský [Fri, 1 Nov 2019 23:38:09 +0000 (00:38 +0100)]
[Codegen] Both sides of '&&' are same; fixed

Summary:
Found by PVS Studio

Not familiar with this code; no testcase.

Reviewers: craig.topper, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

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

4 years agoNoFree argument attribute.
Stefan Stipanovic [Sat, 2 Nov 2019 15:35:38 +0000 (16:35 +0100)]
NoFree argument attribute.

Summary: Deducing nofree atrribute for function arguments.

Reviewers: jdoerfert

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years agoFix uninitialized variable warning. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 14:42:38 +0000 (14:42 +0000)]
Fix uninitialized variable warning. NFCI.

4 years ago[X86] Move computeZeroableShuffleElements before getTargetShuffleAndZeroables. NFCI.
Simon Pilgrim [Sat, 2 Nov 2019 13:38:35 +0000 (13:38 +0000)]
[X86] Move computeZeroableShuffleElements before getTargetShuffleAndZeroables. NFCI.

Prep work toward merging some of the functionality.

4 years agoRevert BCmp Loop Idiom recognition transform (PR43870)
Roman Lebedev [Sat, 2 Nov 2019 09:39:02 +0000 (12:39 +0300)]
Revert BCmp Loop Idiom recognition transform (PR43870)

As discussed in https://bugs.llvm.org/show_bug.cgi?id=43870,
this transform is missing a crucial legality check:
the old (non-countable) loop would early-return upon first mismatch,
but there is no such guarantee for bcmp/memcmp.

We'd need to ensure that [PtrA, PtrA+NBytes) and [PtrB, PtrB+NBytes)
are fully dereferenceable memory regions. But that would limit
the transform to constant loop trip counts and would further
cripple it because dereferenceability analysis is *very* partial.

Furthermore, even if all that is done, every single test
would need to be rewritten from scratch.

So let's just give up.

4 years agopython path should be platform-dependent
Luboš Luňák [Tue, 15 Oct 2019 19:24:37 +0000 (21:24 +0200)]
python path should be platform-dependent

Because one of the installed files is the _lldb.so symlink.

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

4 years ago[IR] Avoid use of PointerType::getElementType() in one of the CallBrInst constructors.
Craig Topper [Sat, 2 Nov 2019 07:11:48 +0000 (00:11 -0700)]
[IR] Avoid use of PointerType::getElementType() in one of the CallBrInst constructors.

We already have the FunctionType we can call getReturnType on.
I think this was due to a bad rebase of the CallBr patch while
it was in development when CallInst and InvokeInst were updated.

4 years ago[X86][NFC] Fix buildbot failure on clang-x64-windows-msvc after commit
Pengfei Wang [Sat, 2 Nov 2019 08:18:24 +0000 (01:18 -0700)]
[X86][NFC] Fix buildbot failure on clang-x64-windows-msvc after commit
02728f49da7

Windows uses different VR numbers from Linux. So ignore the number
checking in the CHECK.

4 years ago[Attributor] Ignore BlockAddress users in call site traversal
Johannes Doerfert [Sat, 2 Nov 2019 03:35:18 +0000 (22:35 -0500)]
[Attributor] Ignore BlockAddress users in call site traversal

BlockAddress users will not "call" the function so they do not qualify
as call sites in the first place. When we delete a function with
BlockAddress users we need to first remove the body so they are properly
discarded.

4 years ago[AbstractCallSite][FIX] Correct faulty assertion
Johannes Doerfert [Sat, 2 Nov 2019 04:32:17 +0000 (23:32 -0500)]
[AbstractCallSite][FIX] Correct faulty assertion

When the Attributor run on the IPConstantProp test case for multiple
callbacks it triggered a faulty assertion in the AbstractCallSite
implementation. The callee can well be at argument position 0.

4 years ago[X86] Remove FeatureSSE3 from the implies list of HasFastHorizontalOps.
Craig Topper [Sat, 2 Nov 2019 06:17:23 +0000 (23:17 -0700)]
[X86] Remove FeatureSSE3 from the implies list of HasFastHorizontalOps.

HasFastHorizontalOps is a tuning flag. It shouldn't imply an ISA flag.

4 years ago[Attributor][FIX] Do not try to cast if a cast is not required
Johannes Doerfert [Sat, 2 Nov 2019 04:03:35 +0000 (23:03 -0500)]
[Attributor][FIX] Do not try to cast if a cast is not required

When we replace constant returns at the call site we did issue a cast in
the hopes it would be a no-op if the types are equal. Turns out that is
not the case and we have to check it ourselves first.

Reused an IPConstantProp test for coverage. No functional change to the
test wrt. IPConstantProp.

4 years ago[Attributor][FIX] Transform invoke of nounwind to call + br %normal_dest
Johannes Doerfert [Sat, 2 Nov 2019 02:59:32 +0000 (21:59 -0500)]
[Attributor][FIX] Transform invoke of nounwind to call + br %normal_dest

Even if the invoked function may-return, we can replace it with a call
and branch if it is nounwind. We had almost everything in place to do
this but did not which actually caused a crash when we removed the
landingpad from the actually dead unwind block.

Exposed by the IPConstantProp tests.

4 years ago[Attributor][FIX] Make "known" and "assumed" liveness explicit
Johannes Doerfert [Sat, 2 Nov 2019 02:04:54 +0000 (21:04 -0500)]
[Attributor][FIX] Make "known" and "assumed" liveness explicit

We did merge "known" and "assumed" liveness information into a single
set which caused various kinds of problems, especially because we did
not properly record when something was actually known. With this patch
we properly track the "known" bit and distinguish dead ends we know from
the ones we still need to explore in future updates.

4 years ago[Attributor] `willreturn` + `noreturn` = UB
Johannes Doerfert [Sat, 2 Nov 2019 01:17:48 +0000 (20:17 -0500)]
[Attributor] `willreturn` + `noreturn` = UB

We gave up on `noreturn` if `willreturn` was known for a while but we
now again try to always derive `noreturn`. This is useful because a
function that is `noreturn` + `willreturn` is basically dead as
executing it would lead to undefined behavior (UB).

This came up in the IPConstantProp cases where a function only contained
a unreachable but was not marked `noreturn` which caused missed
opportunities down the line.

4 years ago[Attributor][FIX] Make AAValueSimplifyArgument aware of thread-dependent constants
Johannes Doerfert [Fri, 1 Nov 2019 23:45:25 +0000 (18:45 -0500)]
[Attributor][FIX] Make AAValueSimplifyArgument aware of thread-dependent constants

As in IPConstantProp, thread-dependent constants need not be propagated
over callbacks. Took the comment and test from there, see also D56447.

4 years ago[Attributor][FIX] Handle the default case of a switch
Johannes Doerfert [Fri, 1 Nov 2019 18:57:49 +0000 (13:57 -0500)]
[Attributor][FIX] Handle the default case of a switch

In D69605 only the "cases" of a switch were handled but if none matched
we did not make the default case life. This is fixed now and properly
tested (with code from IPConstantProp/user-with-multiple-uses.ll).

4 years ago[Attributor][FIX] Make value simplification aware of "complicated" attributes
Johannes Doerfert [Fri, 1 Nov 2019 18:42:54 +0000 (13:42 -0500)]
[Attributor][FIX] Make value simplification aware of "complicated" attributes

We cannot simply replace arguments that carry attributes like `nest`,
`inalloca`, `sret`, and `byval`. Except for the last one, which we can
replace if it is not written, we bail for now.

4 years ago[Attributor][NFCI] Avoid unnecessary work except for testing
Johannes Doerfert [Fri, 1 Nov 2019 01:15:02 +0000 (20:15 -0500)]
[Attributor][NFCI] Avoid unnecessary work except for testing

Trying to deduce information for declarations and calls sites of
declarations is not useful in practice but only for testing. Add a flag
that disables this by default but also enable it in the tests.

The misc.ll test will verify the flag "works" as expected.

4 years ago[Attributor][FIX] NoCapture is not a subsuming property
Johannes Doerfert [Fri, 1 Nov 2019 01:03:13 +0000 (20:03 -0500)]
[Attributor][FIX] NoCapture is not a subsuming property

We cannot look at the subsuming positions and take their nocapture bit
as shown with the two tests for which we derived nocapture on the call
site argument and readonly on the argument of the second before.

4 years ago[Attributor][NFCI] Remove obsolete code
Johannes Doerfert [Fri, 1 Nov 2019 00:45:06 +0000 (19:45 -0500)]
[Attributor][NFCI] Remove obsolete code

The code in question does not add anything as the class is a subclass of
AACallSiteReturnedFromReturnedAndMustBeExecutedContext already.

4 years ago[X86] Model MXCSR for MMX FP instructions
Pengfei Wang [Sat, 2 Nov 2019 04:18:09 +0000 (21:18 -0700)]
[X86] Model MXCSR for MMX FP instructions

Summary:
This patch models MXCSR and adds flag "mayRaiseFPException" for MMX FP
instructions.

Reviewers: craig.topper, andrew.w.kaylor, RKSimon, cameron.mcinally

Reviewed By: craig.topper

Subscribers: hiraditya, llvm-commits, LiuChen3

Tags: #llvm

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

4 years ago[X86] add mayRaiseFPException flag and FPCW registers for X87 instructions
Pengfei Wang [Fri, 1 Nov 2019 06:17:07 +0000 (23:17 -0700)]
[X86] add mayRaiseFPException flag and FPCW registers for X87  instructions

Summary:
This patch adds flag "mayRaiseFPException"  , FPCW and FPSW for X87 instructions which could raise
float exception.

Reviewers: pengfei, RKSimon, andrew.w.kaylor, uweigand, kpn, spatel, cameron.mcinally, craig.topper

Reviewed By: craig.topper

Subscribers: thakis, hiraditya, llvm-commits

Patch by LiuChen.

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

4 years ago[dsymutil] Second attempt to fix dsymutil tests on non-darwin platforms
Francis Visoiu Mistrih [Sat, 2 Nov 2019 04:07:40 +0000 (21:07 -0700)]
[dsymutil] Second attempt to fix dsymutil tests on non-darwin platforms

4 years agoDon't assume that __cxa_current_exception_type exists.
Jim Ingham [Sat, 2 Nov 2019 00:20:31 +0000 (17:20 -0700)]
Don't assume that __cxa_current_exception_type exists.

Normally you shouldn't be able to have a process with an ItaniumABI plugin
that doesn't have this symbol.  But if the loader crashes before loading
libc++abi.dylib (on MacOS), then the symbol might not be present.  So we
should check before accessing the pointer.

There isn't a good way to write a test for this, but the change is obvious.

4 years ago[dsymutil] Require darwin in fat binary test
Francis Visoiu Mistrih [Fri, 1 Nov 2019 23:15:07 +0000 (16:15 -0700)]
[dsymutil] Require darwin in fat binary test

dsymutil uses lipo(1) to build the fat binary, which it invokes as a
process. For that, we need to only run this test on darwin systems.

Should fix: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-ubuntu/builds/181/steps/test-check-all/logs/stdio

4 years ago[dsymutil] Add support for linking remarks
Francis Visoiu Mistrih [Mon, 30 Sep 2019 16:05:12 +0000 (09:05 -0700)]
[dsymutil] Add support for linking remarks

This adds support to dsymutil for linking remark files and placing them
in the final .dSYM bundle.

The result will be placed in:

* a.out.dSYM/Contents/Resources/Remarks/a.out
or
* a.out.dSYM/Contents/Resources/Remarks/a.out-<arch> for universal binaries

When multi-threaded, this runs a third thread which loops over all the
object files and parses remarks as it finds __remarks sections.

Testing this involves running dsymutil on pre-built binaries and object
files, then running llvm-bcanalyzer on the final result to check for
remarks.

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

4 years agoDebugInfo: Accept -gdwarf even in clang-cl
David Blaikie [Fri, 1 Nov 2019 22:36:15 +0000 (15:36 -0700)]
DebugInfo: Accept -gdwarf even in clang-cl

Fixes regression introduced by llvmorg-10-init-8908-g098d901bd1b

4 years agoDebugInfo: Let -gdwarf use the toolchain default DWARF version, instead of hardcoded...
David Blaikie [Fri, 1 Nov 2019 22:17:04 +0000 (15:17 -0700)]
DebugInfo: Let -gdwarf use the toolchain default DWARF version, instead of hardcoded/aliased to -gdwarf-4

4 years ago[NewPM] Add an SROA pass after loop unroll
Guozhi Wei [Fri, 1 Nov 2019 21:59:08 +0000 (14:59 -0700)]
[NewPM] Add an SROA pass after loop unroll

If there is a small local array accessed in a loop, SROA can't handle memory
accesses with variant offset inside a loop, after the loop is fully unrolled,
all memory accesses to the array are with fixed offset, so now they can be
processed by SROA. But there is no more SROA passes after loop unroll. This
patch add an SROA pass after loop unroll to handle this pattern.

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

4 years agoDebugInfo: Streamline debug_ranges/rnglists/rnglists.dwo emission code
David Blaikie [Fri, 1 Nov 2019 21:50:12 +0000 (14:50 -0700)]
DebugInfo: Streamline debug_ranges/rnglists/rnglists.dwo emission code

More code reuse, better basis for modelling
debug_loc/loclists/loclists.dwo emission support.

4 years agoDebugInfo: (NFC) Refactor DWARF version calculation to make a future change (-fdebug...
David Blaikie [Fri, 1 Nov 2019 21:22:29 +0000 (14:22 -0700)]
DebugInfo: (NFC) Refactor DWARF version calculation to make a future change (-fdebug-default-version) easier

4 years ago[TargetLowering] Move the setBooleanContents check on (xor (setcc), (setcc)) == ...
Craig Topper [Fri, 1 Nov 2019 21:09:08 +0000 (14:09 -0700)]
[TargetLowering] Move the setBooleanContents check on (xor (setcc), (setcc)) == / != 1 -> (setcc) != / == (setcc) to the right place

We need to be checking the value types for the inner setccs not
the outer setcc. We need to ensure those setccs produce a 0/1
value or that the xor is on the i1 type. I think at the time
this code was originally written, getBooleanContents didn't
take any arguments so this was probably correct. But now we can
have a different boolean contents for integer and floating point.

Not sure why the other combines below the xor were also checking
the boolean contents. None of them involve any setccs other than
the outer one and they only produce a new setcc.

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

4 years ago[MachineBasicBlock] Skip over debug instructions in computeRegisterLiveness before...
Craig Topper [Fri, 1 Nov 2019 21:06:52 +0000 (14:06 -0700)]
[MachineBasicBlock] Skip over debug instructions in computeRegisterLiveness before checking for begin

If there are debug instructions before the stopping point,
we need to skip over them before checking for begin in order
to avoid having the debug instructions effect behavior.

Fixes PR43758.

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

4 years ago[JT][CVP] Regenerate test checks, again
Nikita Popov [Fri, 1 Nov 2019 21:27:48 +0000 (22:27 +0100)]
[JT][CVP] Regenerate test checks, again

The changes to update_test_checks format have been disabled again,
so regenerate these tests. Also regenerate select.ll.

4 years ago[amdgpu] Fix known bits compuation on `MUL_I24`/`MUL_U24`.
Michael Liao [Fri, 1 Nov 2019 19:49:41 +0000 (15:49 -0400)]
[amdgpu] Fix known bits compuation on `MUL_I24`/`MUL_U24`.

Reviewers: arsenm, rampitec

Subscribers: kzhuravl, jvesely, wdng, nhaehnle, dstuttard, tpr, t-tye, hiraditya, llvm-commits, yaxunl

Tags: #llvm

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

4 years agoRecommit "[ThinLTO] Handle GUID collision in import global processing""
Teresa Johnson [Fri, 1 Nov 2019 17:31:02 +0000 (10:31 -0700)]
Recommit "[ThinLTO] Handle GUID collision in import global processing""

This recommits cc0b9647b76178bc3869bbfff80535ad86366472 which was
reverted in d39d1a2f87aca3cfabe58ecfa5146879baa70096.

I added a fix for an issue found when testing via distributed ThinLTO,
and added a test case for that failure.

4 years ago[WinCFG] Handle constant casts carefully in .gfids emission
Reid Kleckner [Wed, 30 Oct 2019 23:32:26 +0000 (16:32 -0700)]
[WinCFG] Handle constant casts carefully in .gfids emission

Summary:
The general Function::hasAddressTaken has two issues that make it
inappropriate for our purposes:
1. it is sensitive to dead constant users (PR43858 / crbug.com/1019970),
   leading to different codegen when debu info is enabled
2. it considers direct calls via a function cast to be address escapes

The first is fixable, but the second is not, because IPO clients rely on
this behavior. They assume this function means that all call sites are
analyzable for IPO purposes.

So, implement our own analysis, which gets closer to finding functions
that may be indirect call targets.

Reviewers: ajpaverd, efriedma, hans

Subscribers: hiraditya, llvm-commits

Tags: #llvm

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

4 years ago[NFC]: Removed an implicit capture argument from lambda.
Sourabh Singh Tomar [Fri, 1 Nov 2019 19:58:40 +0000 (01:28 +0530)]
[NFC]: Removed an implicit capture argument from lambda.

4 years ago[X86] Change the behavior of canWidenShuffleElements used by lowerV2X128Shuffle to...
Craig Topper [Fri, 1 Nov 2019 18:28:32 +0000 (11:28 -0700)]
[X86] Change the behavior of canWidenShuffleElements used by lowerV2X128Shuffle to match the behavior in lowerVectorShuffle with regards to zeroable elements.

Previously we marked zeroable elements in a way that prevented
the widening check from recognizing that it could widen. Now
we only mark them zeroable if V2 is an all zeros vector. This
matches what we do for widening elements in lowerVectorShuffle.

Fixes PR43866.

4 years agoWarn when an output section name is longer than 8 characters
Reid Kleckner [Tue, 29 Oct 2019 22:57:40 +0000 (15:57 -0700)]
Warn when an output section name is longer than 8 characters

Recent versions of Microsoft's dumpbin tool cannot handle such PE files.
LLVM tools and GNU tools can, and use this to encode long section names
like ".debug_info", which is commonly used for DWARF. Don't do this in
mingw mode or when -debug:dwarf is passed, since the user probably wants
long section names for DWARF sections.

PR43754

Reviewers: ruiu, mstorsjo

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

4 years ago[CMake] Add cross Windows to ARM Linux toolchain CMake cache file.
Vladimir Vereschaka [Fri, 1 Nov 2019 18:52:27 +0000 (11:52 -0700)]
[CMake] Add cross Windows to ARM Linux toolchain CMake cache file.

This cache file can be used to build a cross Windows to ARM Linux
toolchain.

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

4 years agoReapply [LLDB] [test] Use %clang_cl instead of build.py in a few tests
Martin Storsjö [Wed, 16 Oct 2019 12:11:50 +0000 (15:11 +0300)]
Reapply [LLDB] [test] Use %clang_cl instead of build.py in a few tests

This allows explicitly specifying the intended target architecture,
for tests that aren't supposed to be executed, and that don't
require MSVC headers or libraries to be available.

(These tests already implicitly assumed to be built for x86; one
didn't specify anything, assuming x86_64, while the other specified
--arch=32, which only picks the 32 bit variant of the default target
architecture).

Join two comment lines in disassembly.cpp, to keep row numbers
checked in the test unchanged.

This fixes running check-lldb on arm linux.

Previously when this was applied (in 95980409e6), it broke
macos buildbots, as they added "-isysroot <path>" to all %clang*
substitutions, and clang-cl didn't support that.

Reapplying it without further changes to this patch, after D69619
(9c73925226), because now, such extra parameters are added to
%clang_host*, but not to plain %clang_cl.

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

4 years ago[debuginfo-tests] Don't look for Python 3 if we already have it
Reid Kleckner [Thu, 31 Oct 2019 21:00:22 +0000 (14:00 -0700)]
[debuginfo-tests] Don't look for Python 3 if we already have it

LLDB already requires Python 3 on Windows, so I already configure it
that way. For some reason CMake fails to find the one that Visual Studio
automatically installs at this standard location:
  C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python37_64/python.exe

CMake prefers the python on path, which happens to be python 2.7.

Reviewers: aprantl, jmorse

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

4 years ago[lit] Fix internal env calling env
Joel E. Denny [Fri, 1 Nov 2019 14:14:22 +0000 (10:14 -0400)]
[lit] Fix internal env calling env

Without this patch, when using lit's internal shell, if `env` on a lit
RUN line calls `env`, lit accidentally searches for the latter as an
external executable.  What's worse is that works fine when a developer
is testing on a platform where `env` is available and behaves as
expected, but it then breaks on other platforms.

`env` calling `env` can make sense if one such `env` is within a lit
substitution, as in D65156 and D65121.  This patch ensures that lit
executes both as internal commands.

Reviewed By: probinson, mgorny, rnk

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

4 years ago[MIPS GlobalISel] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after...
Fangrui Song [Fri, 1 Nov 2019 18:07:21 +0000 (11:07 -0700)]
[MIPS GlobalISel] Fix -Wunused-variable in -DLLVM_ENABLE_ASSERTIONS=off builds after D69663

4 years agoIllustrate a redirector using the example of round function from math.h.
Siva Chandra Reddy [Tue, 15 Oct 2019 20:25:36 +0000 (13:25 -0700)]
Illustrate a redirector using the example of round function from math.h.

Setup demonstrated in this patch is only for ELF-ish platforms.

Also note:

1. Use of redirectors is a temporary scheme. They will be removed once
   LLVM-libc has implementations for the redirected functions.
2. Redirectors are optional. One can choose to not include them in the
   LLVM-libc build for their platform.
3. Even with redirectors used, we want to link to the system libc
   dynamically.

Reviewers: dlj, hfinkel, jakehehrlich, phosek, stanshebs, theraven, alexshap

Subscribers: mgorny, libc-commits

Tags: #libc-project

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

4 years ago[X86][AVX] Add support for and/or scalar bool reduction with AVX512 mask registers
Simon Pilgrim [Fri, 1 Nov 2019 17:55:18 +0000 (17:55 +0000)]
[X86][AVX] Add support for and/or scalar bool reduction with AVX512 mask registers

combineBitcastvxi1 only handles bitcast->MOVMSK combines, with mask registers we use BITCAST directly.

4 years ago[dsymutil] Add DW_TAG_common_block to dieNeedsChildrenToBeMeaningful
Jonas Devlieghere [Fri, 1 Nov 2019 17:43:39 +0000 (10:43 -0700)]
[dsymutil] Add DW_TAG_common_block to dieNeedsChildrenToBeMeaningful

Ensure we walk the children of common blocks when deciding what DIEs to
keep. Otherwise we might incorrectly discard them leading to missing
variables in the linked debug info.

This also sorts the list of DW_TAGs alphabetically.

4 years agoAdd MemTagSanitizer documentation.
Evgenii Stepanov [Fri, 18 Oct 2019 19:32:21 +0000 (12:32 -0700)]
Add MemTagSanitizer documentation.

Summary: A lot of this is work in progress...

Reviewers: kcc, pcc

Subscribers: cryptoad, llvm-commits

Tags: #llvm

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

4 years ago[WebAssembly] Add experimental SIMD dot product instruction
Thomas Lively [Fri, 1 Nov 2019 01:28:02 +0000 (18:28 -0700)]
[WebAssembly] Add experimental SIMD dot product instruction

Summary:
This instruction is not merged to the spec proposal, but we need it to
be implemented in the toolchain to experiment with it. It is available
only on an opt-in basis through a clang builtin.

Defined in https://github.com/WebAssembly/simd/pull/127.

Depends on D69696.

Reviewers: aheejin

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

Tags: #clang, #llvm

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

4 years ago[LV] Move interleave_short_tc.ll into the X86 directory to hopefully make fix non...
Craig Topper [Fri, 1 Nov 2019 17:18:54 +0000 (10:18 -0700)]
[LV] Move interleave_short_tc.ll into the X86 directory to hopefully make fix non-X86 bots.

4 years agoReland "[WebAssembly] Expand setcc of v2i64"
Thomas Lively [Fri, 1 Nov 2019 17:21:00 +0000 (10:21 -0700)]
Reland "[WebAssembly] Expand setcc of v2i64"

This reverts commit e5cae5692b5899631b5bfe5c23234deb5efda10c, which
reverted 11850a6305c5778b180243eb06aefe86762dd4ce. The original revert
was done because of breakage that was actually in a separate commit,
2ab1b8c1ec452fb743f6cc5051e75a01039cabfe, which was also reverted and
has since been fixed and relanded.

4 years ago[Support] Use /proc/self/exe for GNU Hurd
kristina [Fri, 1 Nov 2019 17:27:24 +0000 (17:27 +0000)]
[Support] Use /proc/self/exe for GNU Hurd

Use `/proc/self/exe` to get the current executable
path on GNU Hurd.

Patch by sthibaul (Samuel Thibault)

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

4 years ago[X86] isFNEG - use switch() instead of if-else tree. NFCI.
Simon Pilgrim [Fri, 1 Nov 2019 17:08:39 +0000 (17:08 +0000)]
[X86] isFNEG - use switch() instead of if-else tree. NFCI.

In a future patch this will avoid some checks which don't need to be done for some opcodes.

4 years agoDisable exceptions in libfuzzer's copy of libcxxabi.
Evgenii Stepanov [Fri, 1 Nov 2019 17:04:38 +0000 (10:04 -0700)]
Disable exceptions in libfuzzer's copy of libcxxabi.

External project configuration for libcxxabi now has exceptions on by
default, but this is not needed for libfuzzer.

4 years agoRevert "[LLD][ThinLTO] Handle GUID collision in import global processing"
Teresa Johnson [Fri, 1 Nov 2019 16:43:06 +0000 (09:43 -0700)]
Revert "[LLD][ThinLTO] Handle GUID collision in import global processing"

This reverts commit cc0b9647b76178bc3869bbfff80535ad86366472.

The commit is causing a failure in internal testing. Will recommit with
a fix later.

4 years ago[X86] Fix -DBUILD_SHARED_LIBS=on builds after D69568/llvmorg-10-init-8877-g3a399c09878
Fangrui Song [Fri, 1 Nov 2019 16:45:27 +0000 (09:45 -0700)]
[X86] Fix -DBUILD_SHARED_LIBS=on builds after D69568/llvmorg-10-init-8877-g3a399c09878

In -DBUILD_SHARED_LIBS=on builds, a component must specify its direct dependencies to satisfy -Wl,-z,defs (added by llvm/modules/HandleLLVMOptions.cmake).

Core is a direct dependency via transitive header inclusion:

  ld.lld: error: undefined symbol: llvm::LLVMContext::LLVMContext()
  >>> referenced by MachineSizeOptsTest.cpp
  >>>               unittests/Target/X86/CMakeFiles/X86Tests.dir/MachineSizeOptsTest.cpp.o:(testing::internal::TestFactoryImpl<(anonymous namespace)::MachineSizeOptsTest_Test_Test>::CreateTest())

MC is a direct dependency via transitive header inclusion:

  ld.lld: error: undefined symbol: llvm::MCTargetOptions::MCTargetOptions()
  >>> referenced by MachineSizeOptsTest.cpp
  >>>               unittests/Target/X86/CMakeFiles/X86Tests.dir/MachineSizeOptsTest.cpp.o:((anonymous namespace)::MachineSizeOptsTest::SetUp())

4 years ago[Utils] Hide the default behavior change of D68819 under a flag
Johannes Doerfert [Fri, 1 Nov 2019 16:17:27 +0000 (11:17 -0500)]
[Utils] Hide the default behavior change of D68819 under a flag

With D69701, the options used when running the script on a file will be
recorded and reused on a rerun. This allows us to hide new features
behind flags, starting with the "define" that was introduced in D68819.

4 years agoRemove unnecessary unit test dependencies.
Hiroshi Yamauchi [Tue, 29 Oct 2019 16:23:14 +0000 (09:23 -0700)]
Remove unnecessary unit test dependencies.

Summary: This is to address comment on D69409.

Reviewers: davidxl, thakis

Subscribers: mgorny, llvm-commits

Tags: #llvm

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

4 years agollvm-config: emit the C++ standard flag into CXXFLAGS
Saleem Abdulrasool [Fri, 1 Nov 2019 16:12:03 +0000 (09:12 -0700)]
llvm-config: emit the C++ standard flag into CXXFLAGS

This recovers the now "missing" flag as this is controlled by CMake
rather than injected into the user defined flags list.  This is
primarily needed by LDC and other out-of-tree users which do not
correctly setup the C++ flags.

4 years ago[InstCombine] regenerate test checks; NFC
Sanjay Patel [Fri, 1 Nov 2019 16:07:09 +0000 (12:07 -0400)]
[InstCombine] regenerate test checks; NFC

Avoid subsequent test noise from improved CHECK-LABEL matching.

4 years agoRevert "[AArch64][MachineOutliner] Return address signing for outlined functions"
Oliver Stannard [Fri, 1 Nov 2019 16:00:07 +0000 (16:00 +0000)]
Revert "[AArch64][MachineOutliner] Return address signing for outlined functions"

This is causing faults when an instruction which modifies SP is
outlined, causing the PAC and AUT instructions to not match.

This reverts commits 70caa1fc30c392974df3bccd9959765dae1779f6 and
55314d323738e4a8c1890b6a6e5064e7f4e0da1c.

4 years ago[libTooling] Add Stencil constructor.
Yitzhak Mandelbaum [Wed, 30 Oct 2019 18:57:52 +0000 (14:57 -0400)]
[libTooling] Add Stencil constructor.

Summary:
Adds a constructor that takes a vector with which to initialize the `Parts`
field and a corresponding free function that forwards to the constructor. These
definitions are needed to assist in transitioning away from `Stencil` as a class
to defining it as a type alias.

Reviewers: ilya-biryukov

Subscribers: cfe-commits, gribozavr

Tags: #clang

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

4 years ago[libomptarget] Implement target_impl for amdgcn
JonChesterfield [Fri, 1 Nov 2019 14:58:39 +0000 (14:58 +0000)]
[libomptarget] Implement target_impl for amdgcn

Summary:
[libomptarget] Implement target_impl for amdgcn

Smallest atomic addition for a new target. Implements enough of the amdgcn
specific code that some of the source files under nvptx/src could be compiled,
without modification, to run on amdgcn.

This foreshadows a work in progress patch to move said source out of nvptx/src.
Patch based on fork at https://github.com/ROCm-Developer-Tools/llvm-project

Reviewers: ABataev, jdoerfert, grokos, ronlieb

Subscribers: jvesely, jfb, openmp-commits

Tags: #openmp

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

4 years ago[LDV][RAGreedy] Inform LiveDebugVariables about new VRegs added by InlineSpiller
Bjorn Pettersson [Fri, 25 Oct 2019 17:03:18 +0000 (19:03 +0200)]
[LDV][RAGreedy] Inform LiveDebugVariables about new VRegs added by InlineSpiller

Summary:
Make sure RAGreedy informs LiveDebugVariables about new VRegs
that is introduced at spill by InlineSpiller.

Consider this example

 LDV: !"var"  [48r;128r):0 Loc0=%2

 48B   %2 = ...
 ...
 128B  %7 = ADD %2, ...

If %2 is spilled the InlineSpiller will insert spill/reload
instructions and introduces some new vregs. So we get

 48B   %4 = ...
 56B   spill %4
 ...
 120B  reload %5
 128B  %3 = ADD %5, ...

In the past we did not inform LDV about this, and when reintroducing
DBG_VALUE instruction LDV still got information that "var" had the
location of the spilled register %2 for the interval [48r;128r).
The result was bad, since we mapped "var" to the spill slot even
before the spill happened:

 %4 = ...
 DBG_VALUE %spill.0, !"var"
 spill %4 to %spill.0
 ...
 reload %5
 %3 = ADD %5, ...

This patch will inform LDV about the interval split introduced
due to spilling. So the location map in LDV will become

 !"var" [48r;56r):1 [56r;120r):0 [120r;128r):2 Loc0=%2 Loc1=%4 Loc2=%5

And when inserting DBG_VALUE instructions we get

 %4 = ...
 DBG_VALUE %4, !"var"
 spill %4 to %spill.0
 DBG_VALUE %spill.0, !"var"
 ...
 reload %5
 DBG_VALUE %5, !"var"
 %3 = ADD %5, ...

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

Reviewers: jmorse, vsk, aprantl

Reviewed By: jmorse

Subscribers: dstenb, wuzish, MatzeB, qcolombet, nemanjai, hiraditya, jsji, llvm-commits

Tags: #llvm

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

4 years agogn build: Merge d36a0333102
LLVM GN Syncbot [Fri, 1 Nov 2019 15:17:32 +0000 (15:17 +0000)]
gn build: Merge d36a0333102