Andrea Di Biagio [Thu, 1 Nov 2018 18:04:39 +0000 (18:04 +0000)]
[llvm-mca] Add extra counters for move elimination in view RegisterFileStatistics.
This patch teaches view RegisterFileStatistics how to report events for
optimizable register moves.
For each processor register file, view RegisterFileStatistics reports the
following extra information:
- Number of optimizable register moves
- Number of register moves eliminated
- Number of zero moves (i.e. register moves that propagate a zero)
- Max Number of moves eliminated per cycle.
Differential Revision: https://reviews.llvm.org/D53976
llvm-svn: 345865
Reid Kleckner [Thu, 1 Nov 2018 18:02:27 +0000 (18:02 +0000)]
[AArch64] Fix unintended fallthrough and strengthen cast
This was added in r330630. GCC's -Wimplicit-fallthrough seems to not
fire when the previous case contains a switch itself.
This fallthrough was bening because the helper function implementing the
case used dyn_cast to re-check the type of the node in question. After
fixing the fallthrough, we can strengthen the cast.
llvm-svn: 345864
Mandeep Singh Grang [Thu, 1 Nov 2018 17:53:57 +0000 (17:53 +0000)]
Revert "[COFF, ARM64] Implement Intrinsic.sponentry for AArch64"
This reverts commit
585b6667b4712e3c7f32401e929855b3313b4ff2.
llvm-svn: 345863
Reid Kleckner [Thu, 1 Nov 2018 17:51:48 +0000 (17:51 +0000)]
Replace two fallthrough annotations after covered switch with unreachable
Both preceding switches handle all possible enumerators, so the
fallthrough is actually unreachable. This strengthens that to an
assertion.
The first instance had a comment from 2010 indicating that fallthrough
was possible, but that was back when we had a unary operator for
offsetof. Now it is its own expression kind, so the annotation was
stale.
llvm-svn: 345862
Jordan Rupprecht [Thu, 1 Nov 2018 17:48:46 +0000 (17:48 +0000)]
[llvm-strip] Support --keep and --strip-all-gnu from llvm-objcopy
Summary: Add --keep and --strip-all-gnu from llvm-objcopy into llvm-strip.
Reviewers: jakehehrlich, jhenderson, alexshap
Reviewed By: jhenderson, alexshap
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D53954
llvm-svn: 345861
Jonas Devlieghere [Thu, 1 Nov 2018 17:46:31 +0000 (17:46 +0000)]
[FileSystem] Fix typo in ProcessFreeBSD
llvm-svn: 345860
Jordan Rupprecht [Thu, 1 Nov 2018 17:36:37 +0000 (17:36 +0000)]
[llvm-objcopy] Support --{enable,disable}-deterministic-archives
Summary: ar and objcopy/strip all support configuring whether archives are written deterministically (timestamps/UIDs/GIDs/etc zero'd). This has been ported to llvm-ar (the U/D modifiers) but not yet to llvm-objcopy/strip.
Reviewers: jakehehrlich, jhenderson, alexshap
Reviewed By: jhenderson
Subscribers: ruiu, mgrang, llvm-commits
Differential Revision: https://reviews.llvm.org/D53913
llvm-svn: 345859
Yan Zhang [Thu, 1 Nov 2018 17:36:18 +0000 (17:36 +0000)]
Fix the issue that not recognizing single acronym with prefix as ObjC property name.
Summary: This will make clang-tidy accept property names like xyz_URL (URL is a common acronym).
Reviewers: benhamilton, hokein
Reviewed By: benhamilton
Subscribers: jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D53955
llvm-svn: 345858
Jonas Devlieghere [Thu, 1 Nov 2018 17:35:31 +0000 (17:35 +0000)]
[FileSystem] Fix Exists call sites
There were some calls left to Exists() on non-darwin platforms (Windows,
Linux and FreeBSD) that weren't yet updated to use the FileSystem.
llvm-svn: 345857
Jordan Rupprecht [Thu, 1 Nov 2018 17:26:36 +0000 (17:26 +0000)]
[llvm-objcopy] Don't apply --localize flags to common symbols
Summary:
--localize-symbol and --localize-hidden will currently localize common symbols. GNU objcopy will not localize these symbols even when explicitly requested, which seems reasonable; common symbols should always be global so they can be merged during linking.
See PR39461
Reviewers: jakehehrlich, jhenderson, alexshap, MaskRay, espindola
Reviewed By: jakehehrlich, jhenderson, alexshap, MaskRay
Subscribers: emaste, arichardson, alexshap, MaskRay, llvm-commits
Differential Revision: https://reviews.llvm.org/D53782
llvm-svn: 345856
Fangrui Song [Thu, 1 Nov 2018 17:20:40 +0000 (17:20 +0000)]
[llvm-objcopy] For multiclass Eq, associate help text with --name= , not with --name
Summary:
Before:
% llvm-objcopy -help
...
--weaken-symbol=symbol Mark <symbol> as weak
--weaken-symbol symbol Mark <symbol> as weak
After:
% llvm-objcopy -help
...
--weaken-symbol=symbol Mark <symbol> as weak
Reviewers: jhenderson, rupprecht, alexshap, jakehehrlich
Reviewed By: jhenderson
Subscribers: llvm-commits, kristina
Differential Revision: https://reviews.llvm.org/D53983
llvm-svn: 345855
Jonas Devlieghere [Thu, 1 Nov 2018 17:09:25 +0000 (17:09 +0000)]
[FileSystem] Remove Exists() from FileSpec
This patch removes the Exists method from FileSpec and updates its uses
with calls to the FileSystem.
Differential revision: https://reviews.llvm.org/D53845
llvm-svn: 345854
Jonas Devlieghere [Thu, 1 Nov 2018 17:09:22 +0000 (17:09 +0000)]
[FileSystem] Remove ResolveExecutableLocation() from FileSpec
This patch removes the ResolveExecutableLocation method from FileSpec
and updates its uses with calls to the FileSystem.
Differential revision: https://reviews.llvm.org/D53834
llvm-svn: 345853
Sanjay Patel [Thu, 1 Nov 2018 16:57:54 +0000 (16:57 +0000)]
[InstCombine] add test for ComputeNumSignBits on 2-input shuffle; NFC
llvm-svn: 345852
Cameron McInally [Thu, 1 Nov 2018 16:57:52 +0000 (16:57 +0000)]
Fix whitespace in test/Assembler/fast-math-flags.ll
Differential Revision: https://reviews.llvm.org/D53981
llvm-svn: 345851
Sam Parker [Thu, 1 Nov 2018 16:44:45 +0000 (16:44 +0000)]
[ARM] Attempt to fix ppc64be buildbot
llvm-svn: 345850
Jonas Devlieghere [Thu, 1 Nov 2018 16:43:34 +0000 (16:43 +0000)]
[FileSystem] Improve assert and add Terminate in unit test.
Speculative fix for the Xcode bots where we were seeing the assertion
being triggered because we would re-initialize the FileSystem without
terminating it.
llvm-svn: 345849
Zachary Turner [Thu, 1 Nov 2018 16:37:29 +0000 (16:37 +0000)]
[NativePDB] Get LLDB types from PDB function types.
This adds basic support for getting function signature types
into LLDB's type system, including into clang's AST. There are
a few edge cases which are not correctly handled, mostly dealing
with nested classes, but this isn't specific to functions and
apply equally to variable types. Note that no attempt has been
made yet to deal with member function types, which will happen
in subsequent patches.
Differential Revision: https://reviews.llvm.org/D53951
llvm-svn: 345848
David Bolvansky [Thu, 1 Nov 2018 16:26:10 +0000 (16:26 +0000)]
[Diagnostics] Implement -Wsizeof-pointer-div
Summary:
void test(int *arr) {
int arr_len = sizeof(arr) / sizeof(*arr); // warn, incorrect way to compute number of array elements
}
Enabled under -Wall (same behaviour as GCC)
Reviewers: rsmith, MTC, aaron.ballman
Reviewed By: aaron.ballman
Subscribers: MTC, thakis, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D52949
llvm-svn: 345847
Tim Northover [Thu, 1 Nov 2018 16:15:24 +0000 (16:15 +0000)]
Revert "Logging: make os_log buffer size an integer constant expression.
This also reverts a couple of follow-up commits trying to fix the
dependency issues. Latest revision added a cyclic dependency that can't
just be patched up in 5 minutes.
llvm-svn: 345846
Fangrui Song [Thu, 1 Nov 2018 16:02:12 +0000 (16:02 +0000)]
[llvm-objcopy] Use proper cases
Reviewers: jhenderson, alexshap, jakehehrlich, espindola, rupprecht
Reviewed By: jhenderson, rupprecht
Subscribers: emaste, arichardson, rupprecht, llvm-commits
Differential Revision: https://reviews.llvm.org/D53971
llvm-svn: 345845
Kadir Cetinkaya [Thu, 1 Nov 2018 15:54:18 +0000 (15:54 +0000)]
[clang] Improve ctor initializer completions.
Summary:
Instead of providing generic "args" for member and base class
initializers, tries to fetch relevant constructors and show their signatures.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: ZaMaZaN4iK, eraman, arphaman, cfe-commits
Differential Revision: https://reviews.llvm.org/D53654
llvm-svn: 345844
Jonas Devlieghere [Thu, 1 Nov 2018 15:47:33 +0000 (15:47 +0000)]
[FileSystem] Remove GetPermissions() and Readable() from FileSpec
This patch removes the GetPermissions and GetReadable methods from
FileSpec and updates its uses with calls to the FileSystem.
Differential revision: https://reviews.llvm.org/D53831
llvm-svn: 345843
Sanjay Patel [Thu, 1 Nov 2018 15:41:12 +0000 (15:41 +0000)]
[DAGCombiner] make sure we have a whole-number extract before trying to narrow a vector op (PR39511)
The test causes a crash because we were trying to extract v4f32 to v3f32, and the
narrowing factor was then 4/3 = 1 producing a bogus narrow type.
This should fix:
https://bugs.llvm.org/show_bug.cgi?id=39511
llvm-svn: 345842
Daniel Sanders [Thu, 1 Nov 2018 15:41:11 +0000 (15:41 +0000)]
[MC] Implement EmitRawText in MCNullStreamer
Summary:
This adds dummy implementation of `EmitRawText` in `MCNullStreamer`.
This fixes the behavior of `AsmPrinter` with `MCNullStreamer` on targets
on which no integrated assembler is used. An attempt to emit inline asm
on such a target would previously lead to a crash, since `AsmPrinter` does not
check for `hasRawTextSupport` in `EmitInlineAsm` and calls `EmitRawText`
anyway if integrated assembler is disabled (the behavior has changed
in D2686).
Error message printed by MCStreamer:
> EmitRawText called on an MCStreamer that doesn't support it, something
> must not be fully mc'ized
Patch by Eugene Sharygin
Reviewers: dsanders, echristo
Reviewed By: dsanders
Subscribers: eraman, llvm-commits
Differential Revision: https://reviews.llvm.org/D53938
llvm-svn: 345841
Sam Parker [Thu, 1 Nov 2018 15:23:42 +0000 (15:23 +0000)]
[ARM][CGP] Negative constant operand handling
While mutating instructions, we sign extended negative constant
operands for binary operators that can safely overflow. This was to
allow instructions, such as add nuw i8 %a, -2, to still be able to
perform a subtraction. However, the code to handle constants doesn't
take into consideration that instructions, such as sub nuw i8 -2, %a,
require the i8 -2 to be converted into i32 254.
This is a relatively simple fix, but I've taken the time to
reorganise the code a bit - mainly that instructions that can be
promoted are cached and splitting up the Mutate function.
Differential Revision: https://reviews.llvm.org/D53972
llvm-svn: 345840
Erich Keane [Thu, 1 Nov 2018 15:11:43 +0000 (15:11 +0000)]
Multiversioning- Ensure all MV functions are emitted.
Multiverson function versions are always used (by the resolver), so ensure that
they are always emitted.
Change-Id: I5d2e0841fddf0d18918b3fb92ae76814add7ee96
llvm-svn: 345839
Erich Keane [Thu, 1 Nov 2018 15:11:41 +0000 (15:11 +0000)]
CPU-Dispatch- Fix type of a member function, prevent deferrals
The member type creation for a cpu-dispatch function was not correctly
including the 'this' parameter, so ensure that the type is properly
determined. Also, disable defer in the cases of emitting the functoins,
as it can end up resulting in the wrong version being emitted.
Change-Id: I0b8fc5e0b0d1ae1a9d98fd54f35f27f6e5d5d083
llvm-svn: 345838
Zachary Turner [Thu, 1 Nov 2018 15:07:32 +0000 (15:07 +0000)]
[MS Demangler] Expose the Demangler AST publicly.
LLDB would like to use this in order to build a clang AST from
a mangled name.
This is NFC otherwise.
llvm-svn: 345837
Simon Pilgrim [Thu, 1 Nov 2018 14:57:07 +0000 (14:57 +0000)]
[X86][X86FixupLEA] Rename processInstructionForSLM to processInstructionForSlowLEA (NFCI)
The function isn't SLM specific (its driven by the FeatureSlowLEA flag).
Minor tidyup prior to PR38225.
llvm-svn: 345836
Tim Northover [Thu, 1 Nov 2018 14:43:35 +0000 (14:43 +0000)]
Logging: put link against libclangAnalysis rather than libLLVMAnalysis for os_log
llvm-svn: 345835
Louis Dionne [Thu, 1 Nov 2018 14:41:37 +0000 (14:41 +0000)]
[libcxx] Fix usage of _C2, which is a "nasty macro" in some environments
The problem was pointed out in https://reviews.llvm.org/D48896#inline-475775.
llvm-svn: 345834
Tim Northover [Thu, 1 Nov 2018 14:22:20 +0000 (14:22 +0000)]
Logging: add CMake dependency so libAST can use OSLog analysis.
Should fix bots on platforms with slightly different symbol resolution
semantics.
llvm-svn: 345833
Sanjay Patel [Thu, 1 Nov 2018 14:07:39 +0000 (14:07 +0000)]
[InstSimplify] fold icmp based on range of abs/nabs (2nd try)
This is retrying the fold from rL345717
(reverted at rL347780)
...with a fix for the miscompile
demonstrated by PR39510:
https://bugs.llvm.org/show_bug.cgi?id=39510
Original commit message:
This is a fix for PR39475:
https://bugs.llvm.org/show_bug.cgi?id=39475
We managed to get some of these patterns using computeKnownBits in https://reviews.llvm.org/D47041, but that
can't be used for nabs(). Instead, put in some range-based logic, so we can fold
both abs/nabs with icmp with a constant value.
Alive proofs:
https://rise4fun.com/Alive/21r
Name: abs_nsw_is_positive
%cmp = icmp slt i32 %x, 0
%negx = sub nsw i32 0, %x
%abs = select i1 %cmp, i32 %negx, i32 %x
%r = icmp sgt i32 %abs, -1
=>
%r = i1 true
Name: abs_nsw_is_not_negative
%cmp = icmp slt i32 %x, 0
%negx = sub nsw i32 0, %x
%abs = select i1 %cmp, i32 %negx, i32 %x
%r = icmp slt i32 %abs, 0
=>
%r = i1 false
Name: nabs_is_negative_or_0
%cmp = icmp slt i32 %x, 0
%negx = sub i32 0, %x
%nabs = select i1 %cmp, i32 %x, i32 %negx
%r = icmp slt i32 %nabs, 1
=>
%r = i1 true
Name: nabs_is_not_over_0
%cmp = icmp slt i32 %x, 0
%negx = sub i32 0, %x
%nabs = select i1 %cmp, i32 %x, i32 %negx
%r = icmp sgt i32 %nabs, 0
=>
%r = i1 false
Differential Revision: https://reviews.llvm.org/D53844
llvm-svn: 345832
Sanjay Patel [Thu, 1 Nov 2018 14:03:22 +0000 (14:03 +0000)]
[InstSimplify] add tests for icmp fold bug (PR39510); NFC
Verify that set intersection/subset are not confused.
llvm-svn: 345831
Aleksandar Beserminji [Thu, 1 Nov 2018 13:57:54 +0000 (13:57 +0000)]
[mips][micromips] Fix JmpLink to TargetExternalSymbol
When matching MipsISD::JmpLink t9, TargetExternalSymbol:i32'...',
wrong JALR16_MM is selected. This patch adds missing pattern for
JmpLink, so that JAL instruction is selected.
Differential Revision: https://reviews.llvm.org/D53366
llvm-svn: 345830
Benjamin Kramer [Thu, 1 Nov 2018 13:55:59 +0000 (13:55 +0000)]
[ADT] Clean up SparseBitVector copying and make it moveable
llvm-svn: 345829
Tim Northover [Thu, 1 Nov 2018 13:49:54 +0000 (13:49 +0000)]
Logging: make os_log buffer size an integer constant expression.
The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.
llvm-svn: 345828
Chad Rosier [Thu, 1 Nov 2018 13:45:16 +0000 (13:45 +0000)]
[AArch64] Add support for ARMv8.4 in Saphira.
llvm-svn: 345827
Erich Keane [Thu, 1 Nov 2018 12:50:37 +0000 (12:50 +0000)]
CPU-Dispatch-- Fix conflict between 'generic' and 'pentium'
When a dispatch function was being emitted that had both a generic and a
pentium configuration listed, we would assert. This is because neither
configuration has any 'features' associated with it so they were both
considered the 'default' version. 'pentium' lacks any features because
we implement it in terms of __builtin_cpu_supports (instead of Intel
proprietary checks), which is unable to decern between the two.
The fix for this is to omit the 'generic' version from the dispatcher if
both are present. This permits existing code to compile, and still will
choose the 'best' version available (since 'pentium' is technically
better than 'generic').
Change-Id: I4b69f3e0344e74cbdbb04497845d5895dd05fda0
llvm-svn: 345826
Sven van Haastregt [Thu, 1 Nov 2018 12:43:00 +0000 (12:43 +0000)]
Allow clk_event_t comparisons
Also rename `invalid-clk-events-cl2.0.cl` to `clk_event_t.cl` and
repurpose it to include both positive and negative clk_event_t tests.
Differential Revision: https://reviews.llvm.org/D53871
llvm-svn: 345825
Simon Pilgrim [Thu, 1 Nov 2018 11:52:09 +0000 (11:52 +0000)]
[X86][SSE] Move 2-input limit up from getFauxShuffleMask to resolveTargetShuffleInputs (reapplied)
Reapplying an updated version of rL345395 (reverted in rL345451), now the issues noticed in PR39483 have been fixed.
This patch allows resolveTargetShuffleInputs to remove UNDEF inputs from cases where we have more than 2 inputs.
llvm-svn: 345824
Aaron Ballman [Thu, 1 Nov 2018 11:52:07 +0000 (11:52 +0000)]
Update to the 10-10 SARIF spec.
This removes the Step property (which can be calculated by consumers trivially), and updates the schema and version numbers accordingly.
llvm-svn: 345823
Max Kazantsev [Thu, 1 Nov 2018 10:16:06 +0000 (10:16 +0000)]
[NFC] Specialize public API of ICFLoopSafetyInfo for insertions and removals
llvm-svn: 345822
Stefan Maksimovic [Thu, 1 Nov 2018 10:10:42 +0000 (10:10 +0000)]
[Mips] Conditionally remove successor block
In MipsBranchExpansion::splitMBB, upon splitting
a block with two direct branches, remove the successor
of the newly created block (which inherits successors from
the original block) which is pointed to by the last
branch in the original block only if the targets of two
branches differ.
This is to fix the failing test when ran with
-verify-machineinstrs enabled.
Differential Revision: https://reviews.llvm.org/D53756
llvm-svn: 345821
Max Kazantsev [Thu, 1 Nov 2018 09:42:50 +0000 (09:42 +0000)]
[NFC] Reorganize code to prepare it for more transforms
llvm-svn: 345820
George Rimar [Thu, 1 Nov 2018 09:20:06 +0000 (09:20 +0000)]
[ELF] - Do not crash when -r output uses linker script with `/DISCARD/`
This is https://bugs.llvm.org/show_bug.cgi?id=39493.
We crashed previously because did not handle /DISCARD/ properly
when -r was used. I think it is uncommon to use scripts with -r, though I see
nothing wrong to handle the /DISCARD/ so that we will not crash at least.
Differential revision: https://reviews.llvm.org/D53864
llvm-svn: 345819
Jonas Paulsson [Thu, 1 Nov 2018 09:05:32 +0000 (09:05 +0000)]
[SystemZ::TTI] Recognize the higher cost of scalar i1 -> fp conversion
Scalar i1 to fp conversions are done with a branch sequence, so it should
have a higher cost.
Review: Ulrich Weigand
https://reviews.llvm.org/D53924
llvm-svn: 345818
Jonas Paulsson [Thu, 1 Nov 2018 09:01:51 +0000 (09:01 +0000)]
[SystemZ::TTI] Accurate costs for i1->double vector conversions
This factors out a new method getBoolVecToIntConversionCost() containing the
code for vector sext/zext of i1, in order to reuse it for i1 to double vector
conversions.
Review: Ulrich Weigand
https://reviews.llvm.org/D53923
llvm-svn: 345817
Roman Lebedev [Thu, 1 Nov 2018 08:56:51 +0000 (08:56 +0000)]
[clang][CodeGen] ImplicitIntegerSignChangeSanitizer: actually ignore NOP casts.
I fully expected for that to be handled by the canonical type check,
but it clearly wasn't. Sadly, somehow it hide until now.
Reported by Eli Friedman.
llvm-svn: 345816
Aleksandr Urakov [Thu, 1 Nov 2018 08:54:38 +0000 (08:54 +0000)]
[Windows] A basic implementation of memory allocations in a debuggee process
Summary:
This patch adds a basic implementation of `DoAllocateMemory` and
`DoDeallocateMemory` for Windows processes. For now it considers only the
executable permission (and always allows reads and writes).
Reviewers: zturner, asmith, stella.stamenova, labath, clayborg
Reviewed By: zturner
Subscribers: Hui, vsk, jingham, aleksandr.urakov, clayborg, abidh, teemperor, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D52618
llvm-svn: 345815
Max Kazantsev [Thu, 1 Nov 2018 06:47:01 +0000 (06:47 +0000)]
[IndVars] Smart hard uses detection
When rewriting loop exit values, IndVars considers this transform not profitable if
the loop instruction has a loop user which it believes cannot be optimized away.
In current implementation only calls that immediately use the instruction are considered
as such.
This patch extends the definition of "hard" users to any side-effecting instructions
(which usually cannot be optimized away from the loop) and also allows handling
of not just immediate users, but use chains.
Differentlai Revision: https://reviews.llvm.org/D51584
Reviewed By: etherzhhb
llvm-svn: 345814
Max Kazantsev [Thu, 1 Nov 2018 06:18:27 +0000 (06:18 +0000)]
[SCEV] Avoid redundant computations when doing AddRec merge
When we calculate a product of 2 AddRecs, we end up making quite massive
computations to deduce the operands of resulting AddRec. This process can
be optimized by computing all args of intermediate sum and then calling
`getAddExpr` once rather than calling `getAddExpr` with intermediate
result every time a new argument is computed.
Differential Revision: https://reviews.llvm.org/D53189
Reviewed By: rtereshin
llvm-svn: 345813
Jonas Devlieghere [Thu, 1 Nov 2018 04:45:28 +0000 (04:45 +0000)]
[FileSystem] Remove GetByteSize() from FileSpec
This patch removes the GetByteSize method from FileSpec and updates its
uses with calls to the FileSystem.
Differential revision: https://reviews.llvm.org/D53788
llvm-svn: 345812
Zachary Turner [Thu, 1 Nov 2018 04:02:41 +0000 (04:02 +0000)]
[CodeView] Emit the correct TypeIndex for std::nullptr_t.
The TypeIndex used by cl.exe is 0x103, which indicates a SimpleTypeMode
of NearPointer (note the absence of the bitness, normally pointers use a
mode of NearPointer32 or NearPointer64) and a SimpleTypeKind of void.
So this is basically a void*, but without a specified size, which makes
sense given how std::nullptr_t is defined.
clang-cl was actually not emitting *anything* for this. Instead, when we
encountered std::nullptr_t in a DIType, we would actually just emit a
TypeIndex of 0, which is obviously wrong.
std::nullptr_t in DWARF is represented as a DW_TAG_unspecified_type with
a name of "decltype(nullptr)", so we add that logic along with a test,
as well as an update to the dumping code so that we no longer print
void* when dumping 0x103 (which would previously treat Void/NearPointer
no differently than Void/NearPointer64).
Differential Revision: https://reviews.llvm.org/D53957
llvm-svn: 345811
Li Jia He [Thu, 1 Nov 2018 02:35:17 +0000 (02:35 +0000)]
[PowerPC] Support constraint 'wi' in asm
From the gcc manual, we can see that the specific limit of wi inline asm is “FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS”. The link is https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Machine-Constraints.html#Machine-Constraints. We should accept this constraint.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D53265
llvm-svn: 345810
Li Jia He [Thu, 1 Nov 2018 02:32:49 +0000 (02:32 +0000)]
[Clang][PowerPC] Support constraint 'wi' in asm
From the gcc manual, we can see that the specific limit of wi inline asm is “FP or VSX register to hold 64-bit integers for VSX insns or NO_REGS”. The link is https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gcc/Machine-Constraints.html#Machine-Constraints. We should accept this constraint.
Reviewed By: jsji
Differential Revision: https://reviews.llvm.org/D53265
llvm-svn: 345809
Mandeep Singh Grang [Thu, 1 Nov 2018 01:35:34 +0000 (01:35 +0000)]
[COFF, ARM64] Implement llvm.addressofreturnaddress intrinsic
llvm-svn: 345808
Artem Dergachev [Thu, 1 Nov 2018 01:27:01 +0000 (01:27 +0000)]
[analyzer] SARIF: Suppress version testing in a more downstream-friendly manner.
No functional change intended.
llvm-svn: 345807
Sam Clegg [Thu, 1 Nov 2018 01:08:37 +0000 (01:08 +0000)]
[WebAssembly] Remove duplicate function. NFC.
Differential Revision: https://reviews.llvm.org/D53963
llvm-svn: 345806
Richard Smith [Thu, 1 Nov 2018 01:05:00 +0000 (01:05 +0000)]
Fix typo in comment.
llvm-svn: 345805
Thomas Lively [Thu, 1 Nov 2018 01:03:17 +0000 (01:03 +0000)]
[WebAssembly] Fix type names in truncation builtins
Summary: Use the same convention as all the other WebAssembly builtin names.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits
Differential Revision: https://reviews.llvm.org/D53724
llvm-svn: 345804
Richard Smith [Thu, 1 Nov 2018 00:46:54 +0000 (00:46 +0000)]
Fix regression in behavior of clang -x c++-header -fmodule-name=XXX
-fsyntax-only.
The driver accidentally stopped passing the input filenames on to -cc1
in this mode due to confusion over what action was being requested.
This change also fixes a couple of crashes I encountered when passing
multiple files to such a -cc1 invocation.
llvm-svn: 345803
Artem Dergachev [Thu, 1 Nov 2018 00:43:35 +0000 (00:43 +0000)]
[analyzer] pr39348: MallocChecker: Realize that sized delete isn't custom delete.
MallocChecker no longer thinks that operator delete() that accepts the size of
the object to delete (available since C++14 or under -fsized-deallocation)
is some weird user-defined operator. Instead, it handles it like normal delete.
Additionally, it exposes a regression in NewDelete-intersections.mm's
testStandardPlacementNewAfterDelete() test, where the diagnostic is delayed
from before the call of placement new into the code of placement new
in the header. This happens because the check for pass-into-function-after-free
for placement arguments is located in checkNewAllocator(), which happens after
the allocator is inlined, which is too late. Move this use-after-free check
into checkPreCall instead, where it works automagically because the guard
that prevents it from working is useless and can be removed as well.
This commit causes regressions under -analyzer-config
c++-allocator-inlining=false but this option is essentially unsupported
because the respective feature has been enabled by default quite a while ago.
Differential Revision: https://reviews.llvm.org/D53543
llvm-svn: 345802
Matthias Braun [Thu, 1 Nov 2018 00:38:01 +0000 (00:38 +0000)]
X86: Consistently declare pass initializers in X86.h; NFC
This avoids declaring them twice: in X86TargetMachine.cpp and the file
implementing the pass.
llvm-svn: 345801
Jonas Devlieghere [Thu, 1 Nov 2018 00:33:27 +0000 (00:33 +0000)]
[FileSystem] Move EnumerateDirectory from FileSpec to FileSystem.
This patch moves the EnumerateDirectory functionality and related enum
and typedef from FileSpec to FileSystem.
This is part of a set of patches that extracts file system related
convenience methods from FileSpec. The long term goal is to remove this
method altogether and use the iterators directly, but for introducing
the VFS into LLDB this change is sufficient.
Differential revision: https://reviews.llvm.org/D53785
llvm-svn: 345800
Jonas Devlieghere [Thu, 1 Nov 2018 00:26:09 +0000 (00:26 +0000)]
[FileSystem] Re-add EnumerateDirectory
Re-enable EnumerateDirectory now that no_push is available in llvm (r345793).
llvm-svn: 345799
Dean Michael Berris [Thu, 1 Nov 2018 00:18:52 +0000 (00:18 +0000)]
[XRay] Add CPU ID in Custom Event FDR Records
Summary:
This change cuts across compiler-rt and llvm, to increment the FDR log
version number to 4, and include the CPU ID in the custom event records.
This is a step towards allowing us to change the `llvm::xray::Trace`
object to start representing both custom and typed events in the stream
of records. Follow-on changes will allow us to change the kinds of
records we're presenting in the stream of traces, to incorporate the
data in custom/typed events.
A follow-on change will handle the typed event case, where it may not
fit within the 15-byte buffer for metadata records.
This work is part of the larger effort to enable writing analysis and
processing tools using a common in-memory representation of the events
found in traces. The work will focus on porting existing tools in LLVM
to use the common representation and informing the design of a
library/framework for expressing trace event analysis as C++ programs.
Reviewers: mboerger, eizan
Subscribers: hiraditya, mgrang, llvm-commits
Differential Revision: https://reviews.llvm.org/D53920
llvm-svn: 345798
Thomas Lively [Thu, 1 Nov 2018 00:01:02 +0000 (00:01 +0000)]
[WebAssembly] Lower vselect
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53630
llvm-svn: 345797
Reid Kleckner [Thu, 1 Nov 2018 00:00:03 +0000 (00:00 +0000)]
Compile and test i128 math builtins for Win64
Summary:
Windows has always been LLP64, not LP64, so the macros were incorrect.
Check for _WIN64, since AArch64 sets that too.
The tests have to be fixed up in two main ways:
1. Use 'ULL' suffixes to avoid sign extension when passing hex literals
with the sign bit set to signed 128 arguments. Clang
-fms-compatibility makes such hex literals signed, not unsigned.
2. Disable various tests for 80-bit long double interoperation with i128
values.
Reviewers: joerg, mstorsjo
Subscribers: javed.absar, kristof.beyls, hiraditya, aheejin, llvm-commits
Differential Revision: https://reviews.llvm.org/D53918
llvm-svn: 345796
Thomas Lively [Wed, 31 Oct 2018 23:58:20 +0000 (23:58 +0000)]
[WebAssembly] Process p2align operands for SIMD loads and stores
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53886
llvm-svn: 345795
Thomas Lively [Wed, 31 Oct 2018 23:50:53 +0000 (23:50 +0000)]
[WebAssembly] Handle vector IMPLICIT_DEFs.
Summary:
Also reduce the test case for implicit defs and test it with all
register classes.
Reviewers: aheejin, dschuff
Subscribers: sbc100, jgravelle-google, sunfish, llvm-commits
Differential Revision: https://reviews.llvm.org/D53855
llvm-svn: 345794
Jonas Devlieghere [Wed, 31 Oct 2018 23:36:10 +0000 (23:36 +0000)]
[VFS] Add support for "no_push" to VFS recursive iterators.
The "regular" file system has a useful feature that makes it possible to
stop recursing when using the recursive directory iterators. This
functionality was missing for the VFS recursive iterator and this patch
adds that.
Differential revision: https://reviews.llvm.org/D53465
llvm-svn: 345793
Mandeep Singh Grang [Wed, 31 Oct 2018 23:17:36 +0000 (23:17 +0000)]
[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
Summary: ARM64 setjmp expects sp on entry instead of framepointer.
Reviewers: mgrang, rnk, TomTan, compnerd, mstorsjo, efriedma
Reviewed By: mstorsjo
Subscribers: javed.absar, kristof.beyls, chrib, cfe-commits
Differential Revision: https://reviews.llvm.org/D53684
llvm-svn: 345792
Mandeep Singh Grang [Wed, 31 Oct 2018 23:16:20 +0000 (23:16 +0000)]
[COFF, ARM64] Implement Intrinsic.sponentry for AArch64
Summary: This patch adds Intrinsic.sponentry. This intrinsic is required to correctly support setjmp for AArch64 Windows platform.
Reviewers: mgrang, TomTan, rnk, compnerd, mstorsjo, efriedma
Reviewed By: efriedma
Subscribers: majnemer, chrib, javed.absar, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D53673
llvm-svn: 345791
Eli Friedman [Wed, 31 Oct 2018 23:03:58 +0000 (23:03 +0000)]
[IR] Allow increasing the alignment of dso-local globals.
I think this is the actual important property; the previous visibility
check was an approximation.
Differential Revision: https://reviews.llvm.org/D53852
llvm-svn: 345790
George Burgess IV [Wed, 31 Oct 2018 22:45:31 +0000 (22:45 +0000)]
[InlineCost] Remove a dead constant; NFC
My `grep`-fu indicates that this hasn't been used for years. It also no
longer makes much sense to have this flavor of penalty in general, since
a call to a noreturn should mean that we're in a BB that's terminated by
`unreachable`. That case is accounted for by
CallAnalyzer::allowSizeGrowth.
llvm-svn: 345789
Petr Hosek [Wed, 31 Oct 2018 22:40:25 +0000 (22:40 +0000)]
[compiler-rt] Pass CMake C and C++ flags to the custom libc++
When building the custom libc++ that's used by libFuzzer as well as
MSan and TSan tests, passthrough the C and C++ flags that were passed
to the compiler-rt CMake build. These may be needed to successfuly
compile the library on a particular platform.
Differential Revision: https://reviews.llvm.org/D53862
llvm-svn: 345788
Jonas Devlieghere [Wed, 31 Oct 2018 22:09:58 +0000 (22:09 +0000)]
[FileSystem] Remove EnumerateDirectory
The new implementation of EnumerateDirectory relies on `::no_push()`
being implemented for the VFS recursive directory iterators. However
this patch (D53465) hasn't been landed yet.
llvm-svn: 345787
Evandro Menezes [Wed, 31 Oct 2018 21:56:49 +0000 (21:56 +0000)]
[AArch64] Sort switch cases (NFC)
llvm-svn: 345786
Craig Topper [Wed, 31 Oct 2018 21:53:24 +0000 (21:53 +0000)]
Revert r345165 "[X86] Bring back the MOV64r0 pseudo instruction"
Google is reporting regressions on some benchmarks.
llvm-svn: 345785
Shafik Yaghmour [Wed, 31 Oct 2018 21:53:15 +0000 (21:53 +0000)]
Revert "[ASTImporter][Structural Eq] Check for isBeingDefined"
This reverts commit r345760
because it caused an assertion in the lldb test suite. This is the log from the build bot: http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/12003/
llvm-svn: 345784
Jonas Devlieghere [Wed, 31 Oct 2018 21:49:27 +0000 (21:49 +0000)]
[FileSystem] Extend file system and have it use the VFS.
This patch extends the FileSystem class with a bunch of functions that
are currently implemented as methods of the FileSpec class. These
methods will be removed in future commits and replaced by calls to the
file system.
The new functions are operated in terms of the virtual file system which
was recently moved from clang into LLVM so it could be reused in lldb.
Because the VFS is stateful, we turned the FileSystem class into a
singleton.
Differential revision: https://reviews.llvm.org/D53532
llvm-svn: 345783
Eli Friedman [Wed, 31 Oct 2018 21:45:48 +0000 (21:45 +0000)]
[ARM] Add missing pseudo-instruction for Thumb1 RSBS.
Shows up rarely for 64-bit arithmetic, more frequently for the compare
patterns added in r325323.
Differential Revision: https://reviews.llvm.org/D53848
llvm-svn: 345782
Eli Friedman [Wed, 31 Oct 2018 21:39:41 +0000 (21:39 +0000)]
[AArch64] [Windows] Emit unwind tables by default.
Unwind tables are necessary even in code that doesn't support
exceptions. The tables are used for setjmp(), and by debuggers.
Differential Revision: https://reviews.llvm.org/D53618
llvm-svn: 345781
Sanjay Patel [Wed, 31 Oct 2018 21:37:40 +0000 (21:37 +0000)]
revert rL345717 : [InstSimplify] fold icmp based on range of abs/nabs
This can miscompile as shown in PR39510:
https://bugs.llvm.org/show_bug.cgi?id=39510
llvm-svn: 345780
Eli Friedman [Wed, 31 Oct 2018 21:31:09 +0000 (21:31 +0000)]
[ARM64] [Windows] Implement _InterlockedExchangeAdd*_* builtins.
These apparently need to be proper builtins to handle the Windows
SDK.
Differential Revision: https://reviews.llvm.org/D53916
llvm-svn: 345779
Stanislav Mekhanoshin [Wed, 31 Oct 2018 21:24:30 +0000 (21:24 +0000)]
Check shouldReduceLoadWidth from SimplifySetCC
SimplifySetCC could shrink a load without checking for
profitability or legality of such shink with a target.
Added checks to prevent shrinking of aligned scalar loads
in AMDGPU below dword as scalar engine does not support it.
Differential Revision: https://reviews.llvm.org/D53846
llvm-svn: 345778
Sanjay Patel [Wed, 31 Oct 2018 21:11:59 +0000 (21:11 +0000)]
[ValueTracking] add tests for fmin/fmax; NFC
llvm-svn: 345777
Wolfgang Pieb [Wed, 31 Oct 2018 21:05:51 +0000 (21:05 +0000)]
[DWARF][NFC] Refactor a function to return Optional<> instead of bool
Minor refactor of DWARFUnit::getStringOffsetSectionItem().
Differential Revision: https://reviews.llvm.org/D53948
llvm-svn: 345776
Ryan Prichard [Wed, 31 Oct 2018 20:53:17 +0000 (20:53 +0000)]
[ELF] Refactor per-target TLS layout configuration. NFC.
Summary:
There are really three different kinds of TLS layouts:
* A fixed TLS-to-TP offset. On architectures like PowerPC, MIPS, and
RISC-V, the thread pointer points to a fixed offset from the start
of the executable's TLS segment. The offset is 0x7000 for PowerPC
and MIPS, which allows a signed 16-bit offset to reach 0x1000 of
per-thread implementation data and 0xf000 of the application's TLS
segment. The size and layout of the TCB isn't relevant to the static
linker and might not be known.
* A fixed TCB size. This is the format documented as "variant 1" in
Ulrich Drepper's TLS spec. The thread pointer points to a 2-word TCB
followed by the executable's TLS segment. The first word is always
the DTV pointer. Used on ARM. The thread pointer must be aligned to
the TLS segment's alignment, possibly creating alignment padding.
* Variant 2. This format predates variant 1 and is also documented in
Drepper's TLS spec. It allocates the executable's TLS segment before
the thread pointer, apparently for backwards-compatibility. It's
used on x86 and SPARC.
Factor out an lld::elf::getTlsTpOffset() function for use in a
follow-up patch for Android. The TcbSize/TlsTpOffset fields are only used
in getTlsTpOffset, so replace them with a switch on Config->EMachine.
Reviewers: espindola, ruiu, PkmX, jrtc27
Reviewed By: ruiu, PkmX, jrtc27
Subscribers: jyknight, emaste, sdardis, nemanjai, javed.absar, arichardson, kristof.beyls, kbarton, fedor.sergeev, atanasyan, PkmX, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D53905
llvm-svn: 345775
Richard Smith [Wed, 31 Oct 2018 20:39:26 +0000 (20:39 +0000)]
Part of PR39508: Emit an @llvm.invariant.start after storing to
__tls_guard.
__tls_guard can only ever transition from 0 to 1, and only once. This
permits LLVM to remove repeated checks for TLS initialization and
repeated initialization code in cases like:
int g();
thread_local int n = g();
int a = n + n;
where we could not prove that __tls_guard was still 'true' when checking
it for the second reference to 'n' in the initializer of 'a'.
llvm-svn: 345774
Richard Smith [Wed, 31 Oct 2018 20:38:41 +0000 (20:38 +0000)]
Remove unused internal template parameter.
llvm-svn: 345773
Daniel Sanders [Wed, 31 Oct 2018 20:05:32 +0000 (20:05 +0000)]
[adt] SparseBitVector::test() should be const
Summary:
Re-worked SparseBitVector's most-recently-used-word caching (CurrElementIter)
such that SparseBitVector::test() can be made const. This came up when
attempting to test individual bits in a SparseBitVector which was a member of a
const object.
The cached iterator has no bearing on the externally visible state, it's merely
a performance optimization. Therefore it has been made mutable and
FindLowerBound() has been split into a const and non-const function
(FindLowerBound/FindLowerBoundConst) for the const/non-const
interfaces.
Reviewers: rtereshin
Reviewed By: rtereshin
Subscribers: rtereshin, dexonsmith, kristina, llvm-commits
Differential Revision: https://reviews.llvm.org/D53447
llvm-svn: 345772
Sanjay Patel [Wed, 31 Oct 2018 20:03:27 +0000 (20:03 +0000)]
[InstCombine] add tests for fmin/fmax pattern matching failure; NFC
llvm-svn: 345771
Scott Linder [Wed, 31 Oct 2018 19:57:36 +0000 (19:57 +0000)]
[SelectionDAG] Handle constant range [0,1) in lowerRangeToAssertZExt
lowerRangeToAssertZExt currently relies on something like EarlyCSE having
eliminated the constant range [0,1). At -O0 this leads to an assert.
Differential Revision: https://reviews.llvm.org/D53888
llvm-svn: 345770
Daniel Sanders [Wed, 31 Oct 2018 19:49:37 +0000 (19:49 +0000)]
[globalisel] Add comments indicating the operand order
llvm-svn: 345769
Adrian Prantl [Wed, 31 Oct 2018 19:42:02 +0000 (19:42 +0000)]
Makefile.rules: Don't use code signing on macOS; it isn't necessary.
llvm-svn: 345768
Sam Clegg [Wed, 31 Oct 2018 19:30:43 +0000 (19:30 +0000)]
[WedAssembly] Add -s and -S alias for --strip-all and --strip-debug
llvm-svn: 345767
Aaron Ballman [Wed, 31 Oct 2018 19:17:44 +0000 (19:17 +0000)]
Removing a reliance on system headers from this test; NFC.
llvm-svn: 345766