platform/upstream/llvm.git
4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Sun, 12 Jan 2020 22:08:56 +0000 (22:08 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointers are dereferenced immediately and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Sun, 12 Jan 2020 21:43:11 +0000 (21:43 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

4 years ago[MC][ELF] Emit a relocation if target is defined in the same section and is non-local
Fangrui Song [Sat, 4 Jan 2020 05:44:57 +0000 (21:44 -0800)]
[MC][ELF] Emit a relocation if target is defined in the same section and is non-local

For a target symbol defined in the same section, currently we don't emit
a relocation if VariantKind is VK_None (with few exceptions like RISC-V
relaxation), while GNU as emits one. This causes program behavior
differences with and without -ffunction-sections, and can break intended
symbol interposition in a -shared link.

```
.globl foo
foo:
  call foo      # no relocation. On other targets, may be written as b foo, etc
  call bar      # a relocation if bar is in another section (e.g. -ffunction-sections)
  call foo@plt  # a relocation
```

Unify these cases by always emitting a relocation. If we ever want to
optimize `call foo` in -shared links, we should emit a STB_LOCAL alias
and call via the alias.

ARM/thumb2-beq-fixup.s: we now emit a relocation to global_thumb_fn as GNU as does.
X86/Inputs/align-branch-64-2.s: we now emit R_X86_64_PLT32 to foo as GNU does.

ELF/relax.s: rewrite the test as target-in-same-section.s .
We omitted relocations to `global` and now emit R_X86_64_PLT32.
Note, GNU as does not emit a relocation for `jmp global` (maybe its own
bug). Our new behavior is compatible except `jmp global`.

Reviewed By: peter.smith

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

4 years ago[AMDGPU] Add gfx8 assembler and disassembler test cases
Jay Foad [Sat, 11 Jan 2020 20:48:29 +0000 (20:48 +0000)]
[AMDGPU] Add gfx8 assembler and disassembler test cases

Summary:
This adds assembler tests for cases that were previously only in the
disassembler tests, and vice versa.

Reviewers: rampitec, arsenm, nhaehnle

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

Tags: #llvm

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

4 years ago__patchable_function_entries: don't use linkage field 'unique' with -no-integrated-as
Fangrui Song [Sun, 12 Jan 2020 20:23:16 +0000 (12:23 -0800)]
__patchable_function_entries: don't use linkage field 'unique' with -no-integrated-as

.section name, "flags"G, @type, GroupName[, linkage]

As of binutils 2.33, linkage cannot be 'unique'.  For integrated
assembler, we use both 'o' flag and 'unique' linkage to support
--gc-sections and COMDAT with lld.

https://sourceware.org/ml/binutils/2019-11/msg00266.html

4 years ago[NFC] Fix compilation of CrashRecoveryContext.cpp on mingw
Markus Böck [Sun, 12 Jan 2020 19:24:35 +0000 (14:24 -0500)]
[NFC] Fix compilation of CrashRecoveryContext.cpp on mingw

Patch by Markus Böck.

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

4 years ago[PowerPC] Delete PPCDarwinAsmPrinter and PPCMCAsmInfoDarwin
Fangrui Song [Thu, 2 Jan 2020 03:27:55 +0000 (19:27 -0800)]
[PowerPC] Delete PPCDarwinAsmPrinter and PPCMCAsmInfoDarwin

Darwin support has been removed.

Reviewed By: nemanjai

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

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Sun, 12 Jan 2020 12:57:01 +0000 (12:57 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use cast<> instead of dyn_cast<> and move into its users where its dereferenced immediately.

4 years ago[MIPS] Regenerate shl/lshr shift tests
Simon Pilgrim [Sun, 12 Jan 2020 14:35:34 +0000 (14:35 +0000)]
[MIPS] Regenerate shl/lshr shift tests

4 years ago[AMDGPU] Regenerate shl shift tests
Simon Pilgrim [Sun, 12 Jan 2020 14:34:36 +0000 (14:34 +0000)]
[AMDGPU] Regenerate shl shift tests

4 years ago[X86][AVX] Use lowerShuffleAsLanePermuteAndSHUFP to lower binary v4f64 shuffles.
Simon Pilgrim [Sun, 12 Jan 2020 12:29:41 +0000 (12:29 +0000)]
[X86][AVX] Use lowerShuffleAsLanePermuteAndSHUFP to lower binary v4f64 shuffles.

Only perform this if we are shuffling lower and upper lane elements across the lanes (otherwise splitting to lower xmm shuffles would be better).

This is a regression if we shuffle build_vectors due to getVectorShuffle canonicalizing 'blend of splat' build vectors, for now I've set this not to shuffle build_vector nodes at all to avoid this.

4 years ago[X86][AVX] lowerShuffleAsLanePermuteAndSHUFP - only set the demanded elements of...
Simon Pilgrim [Sun, 12 Jan 2020 09:41:40 +0000 (09:41 +0000)]
[X86][AVX] lowerShuffleAsLanePermuteAndSHUFP - only set the demanded elements of the lane mask.

Fixes an cyclic dependency issue with an upcoming patch where getVectorShuffle canonicalizes masks with splat build vector sources.

4 years ago[X86][Disassembler] Merge X86DisassemblerDecoder.cpp into X86Disassembler.cpp and...
Fangrui Song [Sun, 12 Jan 2020 02:27:13 +0000 (18:27 -0800)]
[X86][Disassembler] Merge X86DisassemblerDecoder.cpp into X86Disassembler.cpp and refactor

4 years ago[X86][Disassembler] Simplify
Fangrui Song [Sun, 12 Jan 2020 02:08:06 +0000 (18:08 -0800)]
[X86][Disassembler] Simplify

4 years ago[profile] Support merge pool size >= 10
Fangrui Song [Sun, 12 Jan 2020 08:24:10 +0000 (00:24 -0800)]
[profile] Support merge pool size >= 10

The executable acquires an advisory record lock (`fcntl(fd, F_SETLKW, *)`) on a profile file.
Merge pool size >= 10 may be beneficial when the concurrency is large.

Also fix a small problem about snprintf. It can cause the filename to be truncated after %m.

Reviewed By: davidxl

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

4 years ago[NFC] Refactor memory ops cluster method
Qiu Chaofan [Sun, 12 Jan 2020 05:10:04 +0000 (13:10 +0800)]
[NFC] Refactor memory ops cluster method

Current implementation of BaseMemOpsClusterMutation is a little bit
obscure. This patch directly uses a map from store chain ID to set of
memory instrs to make it simpler, so that future improvements are easier
to read, update and review.

Reviewed By: evandro

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

4 years ago[X86] Don't call LowerSETCC from LowerSELECT for STRICT_FSETCC/STRICT_FSETCCS nodes.
Craig Topper [Sun, 12 Jan 2020 02:10:11 +0000 (18:10 -0800)]
[X86] Don't call LowerSETCC from LowerSELECT for STRICT_FSETCC/STRICT_FSETCCS nodes.

This causes the STRICT_FSETCC/STRICT_FSETCCS nodes to lowered
early while lowering SELECT, but the output chain doesn't get
connected. Then we visit the node again when it is its turn
because we haven't replaced the use of the chain result. In the
case of the fp128 libcall lowering, after D72341 this will cause
the libcall to be emitted twice.

4 years ago[SCEV] more accurate range for addrecexpr with nsw flag.
Zheng Chen [Sat, 11 Jan 2020 03:50:39 +0000 (22:50 -0500)]
[SCEV] more accurate range for addrecexpr with nsw flag.

Reviewed By: nikic

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

4 years ago[LegalizeVectorOps] Parallelize the lo/hi part of STRICT_UINT_TO_FLOAT legalization.
Craig Topper [Sun, 12 Jan 2020 01:43:22 +0000 (17:43 -0800)]
[LegalizeVectorOps] Parallelize the lo/hi part of STRICT_UINT_TO_FLOAT legalization.

The lo and hi computation are independent. Give them the same input
chain and TokenFactor the results together.

4 years ago[TargetLowering][X86] Connect the chain from STRICT_FSETCC in TargetLowering::expandF...
Craig Topper [Sun, 12 Jan 2020 01:27:55 +0000 (17:27 -0800)]
[TargetLowering][X86] Connect the chain from STRICT_FSETCC in TargetLowering::expandFP_TO_UINT and X86TargetLowering::FP_TO_INTHelper.

4 years ago[LegalizeVectorOps] Expand vector MERGE_VALUES immediately.
Craig Topper [Sun, 12 Jan 2020 00:04:28 +0000 (16:04 -0800)]
[LegalizeVectorOps] Expand vector MERGE_VALUES immediately.

Custom legalization can produce MERGE_VALUES to return multiple
results. We can expand them immediately instead of leaving them
around for DAG combine to clean up.

4 years ago[X86][Disassembler] Shrink X86GenDisassemblerTables.inc from 36M to 6.1M
Fangrui Song [Sun, 12 Jan 2020 00:27:25 +0000 (16:27 -0800)]
[X86][Disassembler] Shrink X86GenDisassemblerTables.inc from 36M to 6.1M

In x86Disassembler{OneByte,TwoByte,...}Codes,
"/* EmptyTable */" is very common. Omitting it saves lots of space.
Also, there is no need to display a table entry in multiple lines.

It is also common that the whole OpcodeDecision is { MODRM_ONEENTRY, 0}.
Make use of zero-initialization.

4 years ago[X86][Disassembler] Optimize argument passing and immediate reading
Fangrui Song [Sat, 11 Jan 2020 23:06:02 +0000 (15:06 -0800)]
[X86][Disassembler] Optimize argument passing and immediate reading

4 years ago[Disassembler] Delete the VStream parameter of MCDisassembler::getInstruction()
Fangrui Song [Sat, 11 Jan 2020 20:36:13 +0000 (12:36 -0800)]
[Disassembler] Delete the VStream parameter of MCDisassembler::getInstruction()

The argument is llvm::null() everywhere except llvm::errs() in
llvm-objdump in -DLLVM_ENABLE_ASSERTIONS=On builds. It is used by no
target but X86 in -DLLVM_ENABLE_ASSERTIONS=On builds.

If we ever have the needs to add verbose log to disassemblers, we can
record log with a member function, instead of passing it around as an
argument.

4 years ago[ORC] Fix argv handling in runAsMain / lli.
Lang Hames [Sat, 11 Jan 2020 20:58:38 +0000 (12:58 -0800)]
[ORC] Fix argv handling in runAsMain / lli.

This fixes an off-by-one error in the argc value computed by runAsMain, and
switches lli back to using the input bitcode (rather than the string "lli") as
the effective program name.

Thanks to Stefan Graenitz for spotting the bug.

4 years ago[Support] Optionally call signal handlers when a function wrapped by the the CrashRec...
Alexandre Ganea [Sat, 11 Jan 2020 20:27:07 +0000 (15:27 -0500)]
[Support] Optionally call signal handlers when a function wrapped by the the CrashRecoveryContext fails

This patch allows for handling a failure inside a CrashRecoveryContext in the same way as the global exception/signal handler. A failure will have the same side-effect, such as cleanup of temporarty file, printing callstack, calling relevant signal handlers, and finally returning an exception code. This is an optional feature, disabled by default.
This is a support patch for D69825.

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

4 years ago[X86][Disassembler] Replace custom logger with LLVM_DEBUG
Fangrui Song [Sat, 11 Jan 2020 20:03:57 +0000 (12:03 -0800)]
[X86][Disassembler] Replace custom logger with LLVM_DEBUG

llvm-objdump -d on clang is decreased from 7.8s to 7.4s.

The improvement is likely due to the elimination of logger setup and
dbgprintf(), which has a large overhead.

4 years ago[LegalizeVectorOps] Remove some of the simpler Expand methods. Pass Results vector...
Craig Topper [Sat, 11 Jan 2020 20:12:53 +0000 (12:12 -0800)]
[LegalizeVectorOps] Remove some of the simpler Expand methods. Pass Results vector to a couple. NFCI

Some of the simplest handlers just call TLI and if that fails,
they fall back to unrolling. For those just inline the TLI call
and share the unrolling call with the default case of Expand.

For ExpandFSUB and ExpandBITREVERSE so that its obvious they
don't return results sometimes and want to defer to LegalizeDAG.

4 years ago[LegalizeVectorOps] Only pass SDNode* instead SDValue to all of the Expand* and Promo...
Craig Topper [Sat, 11 Jan 2020 19:36:50 +0000 (11:36 -0800)]
[LegalizeVectorOps] Only pass SDNode* instead SDValue to all of the Expand* and Promote* methods.

All the Expand* and Promote* function assume they are being
called with result 0 anyway. Just hardcode result 0 into them.

4 years ago[X86][Disassembler] Simplify and optimize reader functions
Fangrui Song [Sat, 11 Jan 2020 07:43:44 +0000 (23:43 -0800)]
[X86][Disassembler] Simplify and optimize reader functions

llvm-objdump -d on clang is decreased from 8.2s to 7.8s.

4 years ago[X86] Turn FP_ROUND/STRICT_FP_ROUND into X86ISD::VFPROUND/STRICT_VFPROUND during...
Craig Topper [Sat, 11 Jan 2020 19:06:52 +0000 (11:06 -0800)]
[X86] Turn FP_ROUND/STRICT_FP_ROUND into X86ISD::VFPROUND/STRICT_VFPROUND during PreprocessISelDAG to remove some duplicate isel patterns.

4 years agoAdd -Wrange-loop-analysis changes to ReleaseNotes
Mark de Wever [Sat, 11 Jan 2020 18:03:22 +0000 (19:03 +0100)]
Add -Wrange-loop-analysis changes to ReleaseNotes

This reflects the recent changes done.

4 years ago[ExecutionEngine] Re-enable FastISel for non-iOS arm targets.
Lang Hames [Sat, 11 Jan 2020 17:59:33 +0000 (09:59 -0800)]
[ExecutionEngine] Re-enable FastISel for non-iOS arm targets.

Patch by Nicolas Capens. Thanks Nicolas!

https://reviews.llvm.org/D65015

4 years agoRevert "[ASTMatchers] extract public matchers from const-analysis into own patch"
Jonas Toth [Sat, 11 Jan 2020 18:41:27 +0000 (19:41 +0100)]
Revert "[ASTMatchers] extract public matchers from const-analysis into own patch"

This reverts commit 4c48ea68e491cb42f1b5d43ffba89f6a7f0dadc4.
The powerpc buildbots had an internal compiler error after this patch.
This requires some inspection.

4 years ago[ASTMatchers] extract public matchers from const-analysis into own patch
Jonas Toth [Sat, 11 Jan 2020 18:21:03 +0000 (19:21 +0100)]
[ASTMatchers] extract public matchers from const-analysis into own patch

Summary:
The analysis for const-ness of local variables required a view generally useful
matchers that are extracted into its own patch.

They are `decompositionDecl` and `forEachArgumentWithParamType`, that works
for calls through function pointers as well.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

4 years ago[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is properly...
River Riddle [Sat, 11 Jan 2020 16:54:04 +0000 (08:54 -0800)]
[mlir] NFC: Remove Value::operator* and Value::operator-> now that Value is properly value-typed.

Summary: These were temporary methods used to simplify the transition.

Reviewed By: antiagainst

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

4 years ago[X86] Adjust nop emission by compiler to consider target decode limitations
Philip Reames [Sat, 11 Jan 2020 16:41:35 +0000 (08:41 -0800)]
[X86] Adjust nop emission by compiler to consider target decode limitations

The primary motivation of this change is to bring the code more closely in sync behavior wise with the assembler's version of nop emission.  I'd like to eventually factor them into one, but that's hard to do when one has features the other doesn't.

The longest encodeable nop on x86 is 15 bytes, but many processors - for instance all intel chips - can't decode the 15 byte form efficiently.  On those processors, it's better to use either a 10 byte or 11 byte sequence depending.

4 years ago[X86AsmBackend] Move static function before sole use [NFC]
Philip Reames [Fri, 10 Jan 2020 23:22:17 +0000 (15:22 -0800)]
[X86AsmBackend] Move static function before sole use [NFC]

4 years ago[X86AsmBackend] Be consistent about placing definitions out of line [NFC]
Philip Reames [Fri, 10 Jan 2020 23:19:09 +0000 (15:19 -0800)]
[X86AsmBackend] Be consistent about placing definitions out of line [NFC]

4 years agoGlobalModuleIndex - Fix use-after-move clang static analyzer warning.
Simon Pilgrim [Sat, 11 Jan 2020 16:42:41 +0000 (16:42 +0000)]
GlobalModuleIndex - Fix use-after-move clang static analyzer warning.

Shadow variable names meant we were referencing the Buffer input argument, not the GlobalModuleIndex member that its std::move()'d it.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 16:01:46 +0000 (16:01 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointers are dereferenced immediately and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 16:00:17 +0000 (16:00 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

Use cast<> instead of dyn_cast<> since we know that the pointer should be valid (and is dereferenced immediately).

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 15:41:31 +0000 (15:41 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately within mangleCallingConvention and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" static analyzer warnings. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 15:33:25 +0000 (15:33 +0000)]
Fix "pointer is null" static analyzer warnings. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.

4 years agoFix "pointer is null" static analyzer warning. NFCI.
Simon Pilgrim [Sat, 11 Jan 2020 14:47:17 +0000 (14:47 +0000)]
Fix "pointer is null" static analyzer warning. NFCI.

Use castAs<> instead of getAs<> since the pointer is dereferenced immediately below and castAs will perform the null assertion for us.

4 years agoFix uninitialized value clang static analyzer warning. NFC.
Simon Pilgrim [Sat, 11 Jan 2020 14:44:25 +0000 (14:44 +0000)]
Fix uninitialized value clang static analyzer warning. NFC.

4 years agoRemove copy ctors identical to the default one. NFC.
Benjamin Kramer [Sat, 11 Jan 2020 15:50:55 +0000 (16:50 +0100)]
Remove copy ctors identical to the default one. NFC.

Those do nothing but make the type no longer trivial to the compiler.

4 years agomoveOperands - assert Src/Dst MachineOperands are non-null.
Simon Pilgrim [Sat, 11 Jan 2020 14:36:46 +0000 (14:36 +0000)]
moveOperands - assert Src/Dst MachineOperands are non-null.

Fixes static-analyzer warnings.

4 years ago[X86] Fix outdated comment
Simon Pilgrim [Sat, 11 Jan 2020 12:57:21 +0000 (12:57 +0000)]
[X86] Fix outdated comment

The generic saturated math opcodes are no longer widened inside X86TargetLowering

4 years ago[Sema] Improve -Wrange-loop-analysis warnings.
Mark de Wever [Sat, 11 Jan 2020 09:16:40 +0000 (10:16 +0100)]
[Sema] Improve -Wrange-loop-analysis warnings.

No longer generate a diagnostic when a small trivially copyable type is
used without a reference. Before the test looked for a POD type and had no
size restriction. Since the range-based for loop is only available in
C++11 and POD types are trivially copyable in C++11 it's not required to
test for a POD type.

Since copying a large object will be expensive its size has been
restricted. 64 bytes is a common size of a cache line and if the object is
aligned the copy will be cheap. No performance impact testing has been
done.

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

4 years agoFix copy+paste typo in shuffle test name
Simon Pilgrim [Sat, 11 Jan 2020 12:35:33 +0000 (12:35 +0000)]
Fix copy+paste typo in shuffle test name

4 years ago[X86][AVX] Add lowerShuffleAsLanePermuteAndSHUFP lowering
Simon Pilgrim [Sat, 11 Jan 2020 12:28:27 +0000 (12:28 +0000)]
[X86][AVX] Add lowerShuffleAsLanePermuteAndSHUFP lowering

Add initial support for lowering v4f64 shuffles to SHUFPD(VPERM2F128(V1, V2), VPERM2F128(V1, V2)), eventually this could be used for v8f32 (and maybe v8f64/v16f32) but I'm being conservative for the initial implementation as only v4f64 can always succeed.

This currently is only called from lowerShuffleAsLanePermuteAndShuffle so only gets used for unary shuffles, and we limit this to cases where we use upper elements as otherwise concating 2 xmm shuffles is probably the better case.

Helps with poor shuffles mentioned in D66004.

4 years ago[X86] Add more complex tests for vector masks used with AND/OR/XOR.
Florian Hahn [Fri, 10 Jan 2020 18:08:56 +0000 (18:08 +0000)]
[X86] Add more complex tests for vector masks used with AND/OR/XOR.

Additional test cases for D72524.

4 years agoDSE: fix bug where we would only check libcalls for name rather than whole decl
Nuno Lopes [Sat, 11 Jan 2020 11:57:29 +0000 (11:57 +0000)]
DSE: fix bug where we would only check libcalls for name rather than whole decl

4 years ago[LoopRotate] Add tests for rotate with switch; NFC
Nikita Popov [Thu, 9 Jan 2020 21:17:37 +0000 (22:17 +0100)]
[LoopRotate] Add tests for rotate with switch; NFC

For D72420.

4 years ago[LoopSimplify] Regenerate test checks; NFC
Nikita Popov [Fri, 10 Jan 2020 17:20:32 +0000 (18:20 +0100)]
[LoopSimplify] Regenerate test checks; NFC

For D72519.

4 years ago[InstCombine] Preserve nuw on sub of geps (PR44419)
Nikita Popov [Wed, 1 Jan 2020 10:11:05 +0000 (11:11 +0100)]
[InstCombine] Preserve nuw on sub of geps (PR44419)

Fix https://bugs.llvm.org/show_bug.cgi?id=44419 by preserving the
nuw on sub of geps. We only do this if the offset has a multiplication
as the final operation, as we can't be sure the operations is nuw
in the other cases without more thorough analysis.

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

4 years ago[X86] Remove dead code from X86DAGToDAGISel::Select that is no longer needed now...
Craig Topper [Sat, 11 Jan 2020 08:27:06 +0000 (00:27 -0800)]
[X86] Remove dead code from X86DAGToDAGISel::Select that is no longer needed now that we don't mutate strict fp nodes. NFC

4 years agoAdd test for GDB pretty printers.
Christian Sigg [Sat, 11 Jan 2020 07:47:41 +0000 (08:47 +0100)]
Add test for GDB pretty printers.

Reviewers: dblaikie, aprantl, davide, JDevlieghere

Reviewed By: aprantl

Subscribers: jmorse, aprantl, merge_guards_bot, mgorny, llvm-commits

Tags: #llvm

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

4 years ago[X86] Simplify code by removing an unreachable condition. NFCI
Craig Topper [Sat, 11 Jan 2020 07:28:31 +0000 (23:28 -0800)]
[X86] Simplify code by removing an unreachable condition. NFCI

For X87<->SSE conversions, the SSE type is always smaller than
the X87 type. So we can always use the smallest type for the
memory type.

4 years ago[X86] Preserve fpexcept property when turning strict_fp_extend and strict_fp_round...
Craig Topper [Sat, 11 Jan 2020 05:14:47 +0000 (21:14 -0800)]
[X86] Preserve fpexcept property when turning strict_fp_extend and strict_fp_round into stack operations.

We use the stack for X87 fp_round and for moving from SSE f32/f64 to
X87 f64/f80. Or from X87 f64/f80 to SSE f32/f64.

Note for the SSE<->X87 conversions the conversion always happens in the
X87 domain. The load/store ops in the X87 instructions are able
to signal exceptions.

4 years ago[X86][Disassembler] Simplify readPrefixes
Fangrui Song [Sat, 11 Jan 2020 07:31:49 +0000 (23:31 -0800)]
[X86][Disassembler] Simplify readPrefixes

4 years ago[X86] Use ReplaceAllUsesWith instead of ReplaceAllUsesOfValueWith to simplify some...
Craig Topper [Sat, 11 Jan 2020 04:30:54 +0000 (20:30 -0800)]
[X86] Use ReplaceAllUsesWith instead of ReplaceAllUsesOfValueWith to simplify some code. NFCI

4 years agoMark the test/Feature/load_extension.ll test as unsupported on Darwin.
Amara Emerson [Sat, 11 Jan 2020 04:17:34 +0000 (20:17 -0800)]
Mark the test/Feature/load_extension.ll test as unsupported on Darwin.

With plugins and examples enabled, this XPASSes. Mark it as unsupported until
the owner investigates what's going on.

4 years ago[AMDGPU] Remove unnecessary v_mov from a register to itself in WQM lowering.
Michael Bedy [Thu, 12 Dec 2019 03:31:32 +0000 (22:31 -0500)]
[AMDGPU] Remove unnecessary v_mov from a register to itself in WQM lowering.

Summary:
- SI Whole Quad Mode phase is replacing WQM pseudo instructions with v_mov instructions.
While this is necessary for the special handling of moving results out of WWM live ranges,
it is not necessary for WQM live ranges. The result is a v_mov from a register to itself after every
WQM operation. This change uses a COPY psuedo in these cases, which allows the register
allocator to coalesce the moves away.

Reviewers: tpr, dstuttard, foad, nhaehnle

Reviewed By: nhaehnle

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

Tags: #llvm

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

4 years ago[NFC] [PowerPC] Update mi-peephole-splat test
Qiu Chaofan [Sat, 11 Jan 2020 03:51:59 +0000 (11:51 +0800)]
[NFC] [PowerPC] Update mi-peephole-splat test

Use script to re-generate the test case, for easier comparison with
future patches.

4 years ago[SCEV] [NFC] add more test cases for range of addrecexpr with nsw flag
Zheng Chen [Sat, 11 Jan 2020 03:43:29 +0000 (22:43 -0500)]
[SCEV] [NFC] add more test cases for range of addrecexpr with nsw flag

4 years ago[TargetLowering][ARM][Mips][WebAssembly] Remove the ordered FP compare from RunttimeL...
Craig Topper [Sat, 11 Jan 2020 02:35:43 +0000 (18:35 -0800)]
[TargetLowering][ARM][Mips][WebAssembly] Remove the ordered FP compare from RunttimeLibcalls.def and all associated usages

Summary:
This always just used the same libcall as unordered, but the comparison predicate was different. This change appears to have been made when targets were given the ability to override the predicates. Before that they were hardcoded into the type legalizer. At that time we never inverted predicates and we handled ugt/ult/uge/ule compares by emitting an unordered check ORed with a ogt/olt/oge/ole checks. So only ordered needed an inverted predicate. Later ugt/ult/uge/ule were optimized to only call a single libcall and invert the compare.

This patch removes the ordered entries and just uses the inverting logic that is now present. This removes some odd things in both the Mips and WebAssembly code.

Reviewers: efriedma, ABataev, uweigand, cameron.mcinally, kpn

Reviewed By: efriedma

Subscribers: dschuff, sdardis, sbc100, arichardson, jgravelle-google, kristof.beyls, hiraditya, aheejin, sunfish, atanasyan, Petar.Avramovic, llvm-commits

Tags: #llvm

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

4 years ago[COFF] Align ARM64 range extension thunks at instruction boundary
Tom Tan [Sat, 11 Jan 2020 02:55:56 +0000 (18:55 -0800)]
[COFF] Align ARM64 range extension thunks at instruction boundary

RangeExtensionThunkARM64 is created for out-of-range branches on Windows ARM64
because branch instructions has limited bits to encode target address.
Currently, RangeExtensionThunkARM64 is appended to its referencing COFF section
from object file at link time without any alignment requirement, so if size of
the preceding COFF section is not aligned to instruction boundary (4 bytes),
RangeExtensionThunkARM64 will emit thunk instructions at unaligned address
which is never a valid branch target on ARM64, and usually triggers invalid
instruction exception when branching to it.

This PR fixes it by requiring such thunks to align at 4 bytes.

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

4 years agoRemove umask tests
Alexandre Ganea [Sat, 11 Jan 2020 02:05:59 +0000 (21:05 -0500)]
Remove umask tests

These tests were added in 18627115f4d2db5dc73207e0b5312f52536be7dd and e08b59f81d950bd5c8b8528fcb3ac4230c7b736c for validating a refactoring.
Removing because they break on ACL-controlled folders on Ubuntu, and their added value is low.

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

4 years ago[Concepts] Fix MarkUsedTemplateParameters for exprs
Saar Raz [Sat, 11 Jan 2020 01:12:04 +0000 (03:12 +0200)]
[Concepts] Fix MarkUsedTemplateParameters for exprs

D41910 introduced a recursive visitor to MarkUsedTemplateParameters, but
disregarded the 'Depth' parameter, and had incorrect assertions. This fixes
the visitor and removes the assertions.

4 years ago[Driver] Fix OptionClass of -fconvergent-functions and -fms-volatile (Joined -> Flag)
Fangrui Song [Sat, 11 Jan 2020 01:06:40 +0000 (17:06 -0800)]
[Driver] Fix OptionClass of -fconvergent-functions and -fms-volatile (Joined -> Flag)

4 years agodriver: Allow -fdebug-compilation-dir=foo in joined form.
Nico Weber [Sat, 11 Jan 2020 00:18:11 +0000 (19:18 -0500)]
driver: Allow -fdebug-compilation-dir=foo in joined form.

All 130+ f_Group flags that take an argument allow it after a '=',
except for fdebug-complation-dir. Add a Joined<> alias so that
it behaves consistently with all the other f_Group flags.
(Keep the old Separate flag for backwards compat.)

4 years agoClean up and slightly generalize implementation of composite pointer
Richard Smith [Fri, 10 Jan 2020 03:24:44 +0000 (19:24 -0800)]
Clean up and slightly generalize implementation of composite pointer
type computation, in preparation for P0388R4, which adds another few
cases here.

We now properly handle forming multi-level composite pointer types
involving nested Objective-C pointer types (as is consistent with
including them as part of the notion of 'similar types' on which this
rule is based). We no longer lose non-CVR qualifiers on nested pointer
types.

4 years agoAdd a FIXME and corresponding test coverage for some suspicious behavior
Richard Smith [Fri, 10 Jan 2020 03:22:52 +0000 (19:22 -0800)]
Add a FIXME and corresponding test coverage for some suspicious behavior
forming composite ObjC pointer types in comparisons.

4 years agoRemove redundant implicit cast creation.
Richard Smith [Fri, 10 Jan 2020 21:21:24 +0000 (13:21 -0800)]
Remove redundant implicit cast creation.

FindCompositePointerType has already cast the operands to the composite
type for us in the case where it succeeds.

4 years ago[AArch64] Don't generate libcalls for wide shifts on Darwin
Jessica Paquette [Fri, 10 Jan 2020 23:46:52 +0000 (15:46 -0800)]
[AArch64] Don't generate libcalls for wide shifts on Darwin

Similar to cff90f07cb5cc3.

Darwin doesn't always use compiler-rt, and so we can't assume that these
functions are available (at least on arm64).

4 years agoImprove precision of documentation comment.
Richard Smith [Fri, 10 Jan 2020 23:47:29 +0000 (15:47 -0800)]
Improve precision of documentation comment.

4 years ago[mlir][ods] Support dialect specific content emission via hooks
Lei Zhang [Fri, 10 Jan 2020 16:24:47 +0000 (11:24 -0500)]
[mlir][ods] Support dialect specific content emission via hooks

Thus far we can only generate the same set of methods even for
operations in different dialects. This is problematic for dialects that
want to generate additional operation class methods programmatically,
e.g., a special builder method or attribute getter method. Apparently
we cannot update the OpDefinitionsGen backend every time when such
a need arises. So this CL introduces a hook into the OpDefinitionsGen
backend to allow dialects to emit additional methods and traits to
operation classes.

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

4 years ago[mlir] NFC: put C++ code emission classes in their own files
Lei Zhang [Fri, 10 Jan 2020 16:18:08 +0000 (11:18 -0500)]
[mlir] NFC: put C++ code emission classes in their own files

This exposes thse classes so that they can be used in interfaces.

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

4 years ago[NFC][InlineCost] Factor cost modeling out of CallAnalyzer traversal.
Mircea Trofin [Fri, 10 Jan 2020 23:29:48 +0000 (15:29 -0800)]
[NFC][InlineCost] Factor cost modeling out of CallAnalyzer traversal.

Summary:
The goal is to simplify experimentation on the cost model. Today,
CallAnalyzer decides 2 things: legality, and benefit. The refactoring
keeps legality assessment in CallAnalyzer, and factors benefit
evaluation out, as an extension.

Reviewers: davidxl, eraman

Reviewed By: davidxl

Subscribers: kamleshbhalui, fedor.sergeev, hiraditya, baloghadamsoftware, haicheng, a.sidorin, Szelethus, donat.nagy, dkrupp, llvm-commits

Tags: #llvm

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

4 years ago[LockFileManager] Make default waitForUnlock timeout a parameter, NFC
Vedant Kumar [Fri, 10 Jan 2020 23:24:30 +0000 (15:24 -0800)]
[LockFileManager] Make default waitForUnlock timeout a parameter, NFC

Patch by Xi Ge!

4 years agoOnly destroy static locals if they have non-trivial destructors.
Richard Smith [Fri, 10 Jan 2020 23:16:15 +0000 (15:16 -0800)]
Only destroy static locals if they have non-trivial destructors.

This fixes a regression introduced in
2b4fa5348ee157b6b1a1af44d0137ca8c7a71573 that caused us to emit
shutdown-time destruction for variables with ARC ownership, using
C++-specific functions that don't exist in C implementations.

4 years ago[lldb/Reproducer] Add SBReproducer::Replay overload (again)
Jonas Devlieghere [Fri, 10 Jan 2020 22:54:29 +0000 (14:54 -0800)]
[lldb/Reproducer] Add SBReproducer::Replay overload (again)

I modified the SBAPI under the assumption that nobody was using the old
API yet. However, that turns out to be false. So instead of adding the
deafault argument I've reintroduced the old API and made the new one an
overload.

4 years agoLet targets adjust operand latency of bundles
Stanislav Mekhanoshin [Fri, 10 Jan 2020 20:28:37 +0000 (12:28 -0800)]
Let targets adjust operand latency of bundles

This reverts the AMDGPU DAG mutation implemented in D72487 and gives
a more general way of adjusting BUNDLE operand latency.

It also replaces FixBundleLatencyMutation with adjustSchedDependency
callback in the AMDGPU, fixing not only successor latencies but
predecessors' as well.

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

4 years agolldbutil: Forward ASan launch info to test inferiors
Vedant Kumar [Thu, 12 Dec 2019 00:19:08 +0000 (16:19 -0800)]
lldbutil: Forward ASan launch info to test inferiors

This allows an unsanitized test process which loads a sanitized DSO (the
motivating example is a Swift runtime dylib) to launch on Darwin.

rdar://57290132

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

4 years ago[lldb/Utils] Remove vim-lldb
Jonas Devlieghere [Fri, 10 Jan 2020 22:40:42 +0000 (14:40 -0800)]
[lldb/Utils] Remove vim-lldb

The vim-lldb plugin is unmaintained and doesn't work with a recent vim
installation that uses Python 3. This removes it from the LLDB
repository. The code is still available under lldb-tools on GitHub like
we did with for lldb-mi. (https://github.com/lldb-tools/vim-lldb)

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

4 years ago[lldb/Test] Bypass LLDB_TEST_COMMON_ARGS for certain dotest args (NFC)
Jonas Devlieghere [Fri, 10 Jan 2020 22:38:19 +0000 (14:38 -0800)]
[lldb/Test] Bypass LLDB_TEST_COMMON_ARGS for certain dotest args (NFC)

Rather than serializing every argument through LLDB_TEST_COMMON_ARGS, we
can pass some of them directly using their CMake variable. Although this
does introduce some code duplication between lit's site config and the
lldb-dotest utility, it also means that it becomes easier to override
these values (WIP).

4 years ago[AArch64] Add isAuthenticated predicate to MCInstDesc
Vedant Kumar [Thu, 14 Nov 2019 21:11:34 +0000 (13:11 -0800)]
[AArch64] Add isAuthenticated predicate to MCInstDesc

Add a predicate to MCInstDesc that allows tools to determine whether an
instruction authenticates a pointer. This can be used by diagnostic
tools to hint at pointer authentication failures.

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

rdar://55089604

4 years ago[lldb/Scripts] Move android script from underneath Python dir
Jonas Devlieghere [Fri, 10 Jan 2020 21:54:31 +0000 (13:54 -0800)]
[lldb/Scripts] Move android script from underneath Python dir

The scripts root directory already contains python scripts. No need to
keep this one nested under a dedicated Python directory.

4 years ago[lldb/Scripts] Remove remote-build.py
Jonas Devlieghere [Fri, 10 Jan 2020 21:53:10 +0000 (13:53 -0800)]
[lldb/Scripts] Remove remote-build.py

With Xcode gone this is no longer relevant.

4 years ago[lldb/Scripts] Remove buildbot.py
Jonas Devlieghere [Fri, 10 Jan 2020 21:44:00 +0000 (13:44 -0800)]
[lldb/Scripts] Remove buildbot.py

This file is outdated and still references SVN. Buildbots are configured
through the zorg repository.

4 years agoSummary: update macro for OFF_T so that sanitizer works on AARCH64.
Lirong Yuan [Fri, 10 Jan 2020 21:18:55 +0000 (13:18 -0800)]
Summary: update macro for OFF_T so that sanitizer works on AARCH64.

Reviewers: vitalybuka, eugenis, MaskRay

Reviewed By: eugenis, MaskRay

Subscribers: MaskRay, kristof.beyls, #sanitizers, llvm-commits, jkz, scw

Tags: #sanitizers, #llvm

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

4 years agoclang-tidy doc: unbreak the CI
Sylvestre Ledru [Fri, 10 Jan 2020 21:24:30 +0000 (22:24 +0100)]
clang-tidy doc: unbreak the CI

4 years ago[TargetLowering] Use SelectionDAG::getSetCC and remove a repeated call to getSetCCRes...
Craig Topper [Fri, 10 Jan 2020 21:11:14 +0000 (13:11 -0800)]
[TargetLowering] Use SelectionDAG::getSetCC and remove a repeated call to getSetCCResultType in softenSetCCOperands. NFCI

4 years agoclang-tidy doc: Refresh the list of checkers and polish the script
Sylvestre Ledru [Fri, 10 Jan 2020 17:50:05 +0000 (18:50 +0100)]
clang-tidy doc: Refresh the list of checkers and polish the script

4 years agoMakeUniqueCheck.cpp: explicit the fact that there is an autofix for this checker
Sylvestre Ledru [Fri, 10 Jan 2020 17:48:03 +0000 (18:48 +0100)]
MakeUniqueCheck.cpp: explicit the fact that there is an autofix for this checker

4 years agoImplement new AST matcher hasAnyCapture to match on LambdaExpr captures.
Reid [Fri, 10 Jan 2020 20:49:43 +0000 (15:49 -0500)]
Implement new AST matcher hasAnyCapture to match on LambdaExpr captures.

Accepts child matchers cxxThisExpr to match on capture of this and also on varDecl.

4 years ago[lldb] Fix TestClangASTContext.TestFunctionTemplateInRecordConstruction in Debug...
Raphael Isemann [Fri, 10 Jan 2020 20:33:54 +0000 (21:33 +0100)]
[lldb] Fix TestClangASTContext.TestFunctionTemplateInRecordConstruction in Debug builds

Summary:
In Debug builds we call VerifyDecl in ClangASTContext::CreateFunctionDeclaration which in turn
calls `getAccess` on the created FunctionDecl. As we passed in a RecordDecl as the DeclContext
for the FunctionDecl, we end up hitting the assert in `getAccess` that checks that we never have
a Decl inside a Record without a valid AccessSpecifier. FunctionDecls are never in RecordDecls
(that would be a CXXMethodDecl) so setting a access specifier would not be the correct way to
fix this.

Instead this patch does the same thing that DWARFASTParserClang::ParseSubroutine is doing:
We pass in the FunctionDecl with the TranslationUnit as the DeclContext. That's not ideal but
it is how we currently do it when creating our debug info AST, so the unit test should do
the same.

Reviewers: shafik

Reviewed By: shafik

Subscribers: aprantl, JDevlieghere, lldb-commits

Tags: #lldb

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

4 years ago[lldb] Make CompleteTagDeclsScope completion order deterministic
Raphael Isemann [Fri, 10 Jan 2020 19:16:41 +0000 (20:16 +0100)]
[lldb] Make CompleteTagDeclsScope completion order deterministic

Summary:
We iterate over `m_decls_to_complete` to complete declarations. As
`m_decls_to_complete` is a set the iteration order can be non-deterministic.
The order is currently only non-deterministic when we have
a large set of decls that need to be completed (i.e. more than 32 decls,
as otherwise the SmallPtrSet is just a linear-searched list).

This doesn't really fix any specific bug or has any really observable
change in behavior as the order in which we import should not influence
any semantics. However the order we create decls/types is now always
deterministic which should make debugging easier.

Reviewers: labath, mib, shafik, davide

Reviewed By: shafik, davide

Subscribers: davide, abidh, JDevlieghere, lldb-commits, mgrang

Tags: #lldb

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