platform/upstream/llvm.git
4 years ago[LoopUnrollAndJam] Fixed null check after dereferencing warning. NFCI.
Dávid Bolvanský [Sun, 3 Nov 2019 19:02:54 +0000 (20:02 +0100)]
[LoopUnrollAndJam] Fixed null check after dereferencing warning. NFCI.

4 years ago[BitcodeReader] Fixed use after move warnings. NFCI.
Dávid Bolvanský [Sun, 3 Nov 2019 18:45:25 +0000 (19:45 +0100)]
[BitcodeReader] Fixed use after move warnings. NFCI.

4 years ago[BitcodeReader] Fixed null check after dereferencing warning. NFCI.
Dávid Bolvanský [Sun, 3 Nov 2019 18:42:11 +0000 (19:42 +0100)]
[BitcodeReader] Fixed null check after dereferencing warning. NFCI.

4 years ago[BitcodeReader] Fixed null pointer dereferencing warning. NFCI.
Dávid Bolvanský [Sun, 3 Nov 2019 18:40:26 +0000 (19:40 +0100)]
[BitcodeReader] Fixed null pointer dereferencing warning. NFCI.

4 years ago[SelectionDAG] Fixed null check after dereferencing warning. NFCI.
Dávid Bolvanský [Sun, 3 Nov 2019 18:34:03 +0000 (19:34 +0100)]
[SelectionDAG] Fixed null check after dereferencing warning. NFCI.

4 years ago[opaque pointer types] Add element type argument to IRBuilder CreatePreserveStructAcc...
Craig Topper [Sun, 3 Nov 2019 17:30:08 +0000 (09:30 -0800)]
[opaque pointer types] Add element type argument to IRBuilder CreatePreserveStructAccessIndex and CreatePreserveArrayAccessIndex

Summary:
These were the only remaining users of the GetElementPtrInst::getGEPReturnType
method that gets the element type from the pointer type.

Remove that method since its now dead.

Reviewers: jyknight, t.p.northover, arsenm

Reviewed By: arsenm

Subscribers: wdng, arsenm, arphaman, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

4 years agogn build: (manually) merge 3a399c09 / add76dd3c
Nico Weber [Sun, 3 Nov 2019 17:52:12 +0000 (12:52 -0500)]
gn build: (manually) merge 3a399c09 / add76dd3c

4 years ago[X86][SSE] combineX86ShufflesRecursively - don't bother merging shuffles with empty...
Simon Pilgrim [Sun, 3 Nov 2019 17:45:32 +0000 (17:45 +0000)]
[X86][SSE] combineX86ShufflesRecursively - don't bother merging shuffles with empty roots. NFCI.

This doesn't affect actual codegen, but is a minor refactor toward fixing PR43024 where we need to avoid excess changes (folding zeroables etc.) to the shuffle mask at Depth == 0.

4 years ago[X86] Convert PICStyles::Style to scoped enum class. NFCI.
Simon Pilgrim [Sun, 3 Nov 2019 17:27:51 +0000 (17:27 +0000)]
[X86] Convert PICStyles::Style to scoped enum class. NFCI.

Fixes MSVC static analyzer warnings about enum safety, this enum performs no integer math so it'd be better to fix its scope.

4 years ago[DebugInfo] Fix for DW_OP_LLVM_fragment in DIExpression::isImplicit()
Bjorn Pettersson [Sun, 3 Nov 2019 16:37:34 +0000 (17:37 +0100)]
[DebugInfo] Fix for DW_OP_LLVM_fragment in DIExpression::isImplicit()

DIExpression::isImplicit() did not handle DW_OP_LLVM_fragment
correctly. It was scanning the elements in the expression by
iterating from the end. But we do not know the position of
ops unless we iterate from the beginning of the expression,
since DW_OP:s and their operands are stored flat in the expression
list. The old code also assumed that a DW_OP_LLVM_fragment
only occupied one element in the expression list, but it actually
occupies three elements.

4 years ago[BPF] fix a bug in __builtin_preserve_field_info() with FIELD_BYTE_SIZE
Yonghong Song [Sun, 3 Nov 2019 14:54:39 +0000 (06:54 -0800)]
[BPF] fix a bug in __builtin_preserve_field_info() with FIELD_BYTE_SIZE

During deriving proper bitfield access FIELD_BYTE_SIZE,
function Member->getStorageOffsetInBits() is used to
get llvm IR type storage offset in bits so that
the byte size can permit aligned loads/stores with previously
derived FIELD_BYTE_OFFSET.

The function should only be used with bitfield members and it will
assert if ASSERT is turned on during cmake build.
  Constant *getStorageOffsetInBits() const {
    assert(getTag() == dwarf::DW_TAG_member && isBitField());
    if (auto *C = cast_or_null<ConstantAsMetadata>(getExtraData()))
      return C->getValue();
    return nullptr;
  }

This patch fixed the issue by using Member->isBitField()
directly and a test case is added to cover this missing case.
This issue is discovered when running Andrii's linux kernel CO-RE
tests.

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

4 years ago[compiler-rt] Harmonize __sanitizer_addrinfo with the NetBSD headers
Kamil Rytarowski [Sun, 3 Nov 2019 15:47:03 +0000 (16:47 +0100)]
[compiler-rt] Harmonize __sanitizer_addrinfo with the NetBSD headers

Add missing pad for sparc, alpha and a variation of i386.

4 years ago[compiler-rt] Sync NetBSD syscall hooks with 9.99.17
Kamil Rytarowski [Sun, 3 Nov 2019 15:17:26 +0000 (16:17 +0100)]
[compiler-rt] Sync NetBSD syscall hooks with 9.99.17

Document the minimal version supported as 9.0 and add compat code for
renamed syscalls after 9.0.

4 years agoDrop spurious self-include [NFC]
Aaron Puchert [Sun, 3 Nov 2019 13:29:59 +0000 (14:29 +0100)]
Drop spurious self-include [NFC]

This was introduced in D61357, probably by accident.

4 years agoModuleMap::findHeader - fix null dereference warning. NFCI.
Simon Pilgrim [Sun, 3 Nov 2019 11:33:57 +0000 (11:33 +0000)]
ModuleMap::findHeader - fix null dereference warning. NFCI.

We were checking M for a null value after we'd already dereferenced it multiple times.

4 years agoSymbolRecord - fix more uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 3 Nov 2019 11:27:57 +0000 (11:27 +0000)]
SymbolRecord - fix more uninitialized variable warnings. NFCI.

4 years agoFix uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 3 Nov 2019 11:23:53 +0000 (11:23 +0000)]
Fix uninitialized variable warnings. NFCI.

4 years agoFix line_iterator uninitialized variable warnings. NFCI.
Simon Pilgrim [Sun, 3 Nov 2019 11:20:12 +0000 (11:20 +0000)]
Fix line_iterator uninitialized variable warnings. NFCI.

Allows us to auto define the default constructor as well.

4 years agoEnsure VPlanPrinter::Depth is initialized to fix static analyzer warning. NFCI.
Simon Pilgrim [Sun, 3 Nov 2019 11:17:05 +0000 (11:17 +0000)]
Ensure VPlanPrinter::Depth is initialized to fix static analyzer warning. NFCI.

4 years agoFix uninitialized variable warning. NFCI.
Simon Pilgrim [Sun, 3 Nov 2019 11:15:55 +0000 (11:15 +0000)]
Fix uninitialized variable warning. NFCI.

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