Stephan T. Lavavej [Sat, 5 May 2018 01:40:24 +0000 (01:40 +0000)]
[libcxx] [test] Fix MSVC x64 truncation warning.
warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
Requesting post-commit review.
llvm-svn: 331575
Sam Clegg [Sat, 5 May 2018 01:23:07 +0000 (01:23 +0000)]
[WebAssembly] Check function signatures by default
But only produce a warning (for now) unless --fatal-warnings
is passed.
Differential Revision: https://reviews.llvm.org/D46484
llvm-svn: 331574
Peter Collingbourne [Sat, 5 May 2018 00:51:55 +0000 (00:51 +0000)]
LowerTypeTests: Fix non-determinism in code that handles icall branch funnels.
This was exposed by enabling expensive checks, which causes llvm::sort
to sort randomly.
Differential Revision: https://reviews.llvm.org/D45901
llvm-svn: 331573
Sam Clegg [Sat, 5 May 2018 00:32:26 +0000 (00:32 +0000)]
Add llvm-dwarfdump tool_patterns
Differential Revision: https://reviews.llvm.org/D46481
llvm-svn: 331572
Sam Clegg [Sat, 5 May 2018 00:18:43 +0000 (00:18 +0000)]
[WebAssembly] Only perform sanity checking of relocation targets in debug builds
Also:
- Reduce the error to a warning so that debug and release
versions can still link the same inputs.
- Add another check to verify the input LEB is padded to 5 bytes
Differential Revision: https://reviews.llvm.org/D46479
llvm-svn: 331571
Eli Friedman [Sat, 5 May 2018 00:09:51 +0000 (00:09 +0000)]
Add warning flag -Wordered-compare-function-pointers.
The C standard doesn't allow comparisons like "f1 < f2" (where f1 and f2
are function pointers), but we allow them as an extension. Add a
warning flag to control this warning.
Differential Revision: https://reviews.llvm.org/D46155
llvm-svn: 331570
Teresa Johnson [Fri, 4 May 2018 23:59:34 +0000 (23:59 +0000)]
[LTO] Allow pass remarks with hotness to be set when emitting to stderr
Summary:
Set setDiagnosticsHotnessRequested before the early exit check for a
diagnostic output file, so that pass remarks with hotness works when
emitting pass remarks to stderr (e.g. via -pass-remarks=.).
Also fix the llvm-lto2 diagnistic handler so that it only calls exit(1)
when the diagnistic is an error type. Otherwise the new test invocation
of llvm-lto2 with -pass-remarks causes it to fail. The new code is
consistent with the diagnostic handler elsewhere (e.g. on the
LLVMContext).
Reviewers: pcc, davide
Subscribers: fhahn, mehdi_amini, llvm-commits, inglorion
Differential Revision: https://reviews.llvm.org/D46387
llvm-svn: 331569
Davide Italiano [Fri, 4 May 2018 23:41:25 +0000 (23:41 +0000)]
[llvm-mc-assemble-fuzzer] Catch up with API changes.
llvm-svn: 331568
Michael Berg [Fri, 4 May 2018 23:41:15 +0000 (23:41 +0000)]
Mapping SDNode flags to MachineInstr flags
Summary: Providing the glue to map SDNode fast math sub flags to MachineInstr fast math sub flags.
Reviewers: spatel, arsenm, wristow
Reviewed By: spatel
Subscribers: wdng
Differential Revision: https://reviews.llvm.org/D46447
llvm-svn: 331567
Sam Clegg [Fri, 4 May 2018 23:14:42 +0000 (23:14 +0000)]
[WebAssembly] Add support for debug (DWARF) sections
Specifically add support for custom sections that contain
relocations, and for the two new relocation types needed
by DWARF sections.
See: https://reviews.llvm.org/D44184
Patch by Yury Delendik!
Differential Revision: https://reviews.llvm.org/D44184
llvm-svn: 331566
Artem Dergachev [Fri, 4 May 2018 23:01:10 +0000 (23:01 +0000)]
[analyzer] Remove untested code in evalLoad.
No functional change intended.
llvm-svn: 331565
Konstantin Zhuravlyov [Fri, 4 May 2018 22:53:55 +0000 (22:53 +0000)]
AMDGPU/NFC: Update D16PreservesUnusedBits description based Tony Tye's comments
llvm-svn: 331564
Artem Dergachev [Fri, 4 May 2018 22:19:32 +0000 (22:19 +0000)]
[analyzer] Invalidate union regions properly. Don't hesitate to load later.
We weren't invalidating our unions correctly. The previous behavior in
invalidateRegionsWorker::VisitCluster() was to direct-bind an UnknownVal
to the union (at offset 0).
For that reason we were never actually loading default bindings from our unions,
because there never was any default binding to load, and the value
that is presumed when there's no default binding to load
is usually completely incorrect (eg. UndefinedVal for stack unions).
The new behavior is to default-bind a conjured symbol (of irrelevant type)
to the union that's being invalidated, similarly to what we do for structures
and classes. Then it becomes safe to load the value properly.
Differential Revision: https://reviews.llvm.org/D45241
llvm-svn: 331563
Artem Dergachev [Fri, 4 May 2018 22:11:12 +0000 (22:11 +0000)]
[analyzer] pr36458: Fix retrieved value cast for symbolic void pointers.
C allows us to write any bytes into any memory region. When loading weird bytes
from memory regions of known types, the analyzer is required to make sure that
the loaded value makes sense by casting it to an appropriate type.
Fix such cast for loading values that represent void pointers from non-void
pointer type places.
Differential Revision: https://reviews.llvm.org/D46415
llvm-svn: 331562
Artem Dergachev [Fri, 4 May 2018 21:56:51 +0000 (21:56 +0000)]
[analyzer] pr18953: Split C++ zero-initialization from default initialization.
The bindDefault() API of the ProgramState allows setting a default value
for reads from memory regions that were not preceded by writes.
It was used for implementing C++ zeroing constructors (i.e. default constructors
that boil down to setting all fields of the object to 0).
Because differences between zeroing consturctors and other forms of default
initialization have been piling up (in particular, zeroing constructors can be
called multiple times over the same object, probably even at the same offset,
requiring a careful and potentially slow cleanup of previous bindings in the
RegionStore), we split the API in two: bindDefaultInitial() for modeling
initial values and bindDefaultZero() for modeling zeroing constructors.
This fixes a few assertion failures from which the investigation originated.
The imperfect protection from both inability of the RegionStore to support
binding extents and lack of information in ASTRecordLayout has been loosened
because it's, well, imperfect, and it is unclear if it fixing more than it
was breaking.
Differential Revision: https://reviews.llvm.org/D46368
llvm-svn: 331561
Craig Topper [Fri, 4 May 2018 21:56:43 +0000 (21:56 +0000)]
[X86] Correct the attributes on the incssp and rdssp builtins to only have 'nothrow'
llvm-svn: 331560
Craig Topper [Fri, 4 May 2018 21:45:25 +0000 (21:45 +0000)]
[X86] Fix some inconsistent formatting in the first line of our intrinsics headers.
Some were too long and some were too short.
llvm-svn: 331559
Artem Dergachev [Fri, 4 May 2018 21:39:25 +0000 (21:39 +0000)]
[analyzer] pr37209: Fix casts of glvalues to references.
Many glvalue expressions aren't of their respective reference type -
they are simply glvalues of their value type.
This was causing problems when we were trying to obtain type of the original
expression while evaluating certain glvalue bit-casts.
Fixed by artificially forging a reference type to provide to the casting
procedure.
Differential Revision: https://reviews.llvm.org/D46224
llvm-svn: 331558
Philip Reames [Fri, 4 May 2018 21:35:00 +0000 (21:35 +0000)]
[LICM] Compute a must execute property for the prefix of the header as we go
Computing this property within the existing walk ensures that the cost is linear with the size of the block. If we did this from within isGuaranteedToExecute, it would be quadratic without some very fancy caching.
This allows us to reliably catch a hoistable instruction within a header which may throw at some point *after* our hoistable instruction. It doesn't do anything for non-header cases, but given how common single block loops are, this seems very worthwhile.
llvm-svn: 331557
Artem Dergachev [Fri, 4 May 2018 20:52:39 +0000 (20:52 +0000)]
[analyzer] Treat more const variables and fields as known contants.
When loading from a variable or a field that is declared as constant,
the analyzer will try to inspect its initializer and constant-fold it.
Upon success, the analyzer would skip normal load and return the respective
constant.
The new behavior also applies to fields/elements of brace-initialized structures
and arrays.
Patch by Rafael Stahl!
Differential Revision: https://reviews.llvm.org/D45774
llvm-svn: 331556
Simon Atanasyan [Fri, 4 May 2018 20:48:53 +0000 (20:48 +0000)]
[ELF][MIPS] Reorganize isMipsPIC routine. NFC
llvm-svn: 331555
Simon Atanasyan [Fri, 4 May 2018 20:48:47 +0000 (20:48 +0000)]
[ELF][MIPS] Add STO_MIPS_MICROMIPS flag to symbols point to microMIPS PLT records
llvm-svn: 331554
Konstantin Zhuravlyov [Fri, 4 May 2018 20:21:31 +0000 (20:21 +0000)]
AMDGPU/NFC: Fix formatting for 900, 902 ISA Version features
llvm-svn: 331553
Sterling Augustine [Fri, 4 May 2018 20:12:39 +0000 (20:12 +0000)]
Allow modifying the PrintingPolicy for fully qualified names.
Author: mikhail.ramalho@gmail.com
llvm-svn: 331552
Konstantin Zhuravlyov [Fri, 4 May 2018 20:06:57 +0000 (20:06 +0000)]
AMDGPU: Add D16 instructions preserve unused bits feature
- Predicate D16 patterns on this new feature
- Added this new feature to gfx900/2/4
Differential Revision: https://reviews.llvm.org/D46366
llvm-svn: 331551
Guansong Zhang [Fri, 4 May 2018 19:29:28 +0000 (19:29 +0000)]
[OpenMP] Use LIBOMPTARGET_DEVICE_RTL_DEBUG env var to control debug messages on the device side
Summary:
Enable the device side debug messages at compile time, use env var to control at runtime.
To achieve this, an environment data block is passed to the device lib when it is loaded.
By default, the message is off, to enable it, a user need to set LIBOMPDEVICE_DEBUG=1.
Reviewers: grokos
Reviewed By: grokos
Subscribers: openmp-commits
Tags: #openmp
Differential Revision: https://reviews.llvm.org/D46210
llvm-svn: 331550
Geoff Berry [Fri, 4 May 2018 19:25:09 +0000 (19:25 +0000)]
[MachineLICM] Debug intrinsics shouldn't affect hoist decisions
Summary:
When checking if an instruction stores to a given frame index, check
that the instruction can write to memory before looking at the memory
operands list to avoid e.g. DBG_VALUE instructions that reference a
frame index preventing a load from that index from being hoisted.
Reviewers: dblaikie, MatzeB, qcolombet, reames, javed.absar
Subscribers: mcrosier, llvm-commits
Differential Revision: https://reviews.llvm.org/D46284
llvm-svn: 331549
Shoaib Meenai [Fri, 4 May 2018 19:03:11 +0000 (19:03 +0000)]
[ObjCARC] Account for catchswitch in bitcast insertion
A catchswitch is both a pad and a terminator, meaning it must be the
only non-phi instruction in its basic block. When we're inserting a
bitcast in the incoming basic block for a phi, if that incoming block is
a catchswitch, we should go up the dominator tree to find a valid
insertion point rather than attempting to insert before the catchswitch
(which would result in invalid IR).
Differential Revision: https://reviews.llvm.org/D46412
llvm-svn: 331548
Michael Berg [Fri, 4 May 2018 18:48:20 +0000 (18:48 +0000)]
Fast Math Flag mapping into SDNode
Summary: Adding support for Fast flags in the SDNode to leverage fast math sub flag usage.
Reviewers: spatel, arsenm, jbhateja, hfinkel, escha, qcolombet, echristo, wristow, javed.absar
Reviewed By: spatel
Subscribers: llvm-commits, rampitec, nhaehnle, tstellar, FarhanaAleen, nemanjai, javed.absar, jbhateja, hfinkel, wdng
Differential Revision: https://reviews.llvm.org/D45710
llvm-svn: 331547
Simon Pilgrim [Fri, 4 May 2018 18:16:13 +0000 (18:16 +0000)]
[X86] Add WriteEMMS scheduler class
Filled in the missing values from Btver2 SoG or Agner
llvm-svn: 331546
Yan Zhang [Fri, 4 May 2018 18:14:08 +0000 (18:14 +0000)]
Add support for ObjC property name to be a single acronym.
Summary:
This change will support cases like:
```
@property(assign, nonatomic) int ID;
```
Reviewers: benhamilton, hokein
Reviewed By: benhamilton
Subscribers: klimek, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D46374
llvm-svn: 331545
Eric Liu [Fri, 4 May 2018 17:55:13 +0000 (17:55 +0000)]
[clang-format] Refactor #include insertion/deletion functionality into a class.
Summary:
The class will be moved into libToolingCore as followup.
The new behaviors in this patch:
- New #include is inserted in the right position in a #include block to
preserver sorted #includes. This is best effort - only works when the
block is already sorted.
- When inserting multiple #includes to the end of a file which doesn't
end with a "\n" character, a "\n" will be prepended to each #include.
This is a special and rare case that was previously handled. This is now
relaxed to avoid complexity as it's rare in practice.
Reviewers: ilya-biryukov
Reviewed By: ilya-biryukov
Subscribers: klimek, cfe-commits, djasper
Differential Revision: https://reviews.llvm.org/D46180
llvm-svn: 331544
Simon Pilgrim [Fri, 4 May 2018 17:47:46 +0000 (17:47 +0000)]
[X86] Finish splitting WriteVecShift and WriteVecIMul to remove InstRW overrides.
llvm-svn: 331543
Craig Topper [Fri, 4 May 2018 17:39:08 +0000 (17:39 +0000)]
[LoopIdiomRecognize] Don't create an IRBuilder just to call getTrue/getFalse.
We can call the methods in ConstantInt directly. We just need a context.
llvm-svn: 331542
Adhemerval Zanella [Fri, 4 May 2018 17:21:26 +0000 (17:21 +0000)]
[AArch64] Add missing testcase for r331522
llvm-svn: 331541
Matt Davis [Fri, 4 May 2018 17:19:40 +0000 (17:19 +0000)]
[llvm-mca] Add descriptive names for the TimelineView report characters. NFC.
Summary:
This change makes the TimelineView source simpler to read and easier to modify in the future.
This patch introduces a class of static chars used as the display values in the TimelineView report, this change just eliminates a few magic characters.
Reviewers: andreadb, courbet, RKSimon
Reviewed By: andreadb
Subscribers: tschuett, gbedwell, llvm-commits
Differential Revision: https://reviews.llvm.org/D46409
llvm-svn: 331540
Julie Hockett [Fri, 4 May 2018 17:02:13 +0000 (17:02 +0000)]
[clang-doc] Attaching a name to reference data
This adds the name of the referenced decl, in addition to its USR, to
the saved data, so that the backend can look at an info in isolation and
still be able to construct a human-readable name for it.
Differential Revision: https://reviews.llvm.org/D46281
llvm-svn: 331539
Peter Collingbourne [Fri, 4 May 2018 16:45:57 +0000 (16:45 +0000)]
Object: The default alignment of a section without alignment flags is 16.
Differential Revision: https://reviews.llvm.org/D46420
llvm-svn: 331538
Peter Collingbourne [Fri, 4 May 2018 16:28:41 +0000 (16:28 +0000)]
obj2yaml: Correctly round-trip default alignment.
Previously we were emitting the "cooked" alignment, which made it hard
to distinguish between that and the default alignment.
Differential Revision: https://reviews.llvm.org/D46418
llvm-svn: 331537
Erich Keane [Fri, 4 May 2018 16:19:53 +0000 (16:19 +0000)]
[NFC]Convert Class to use member initialization instead of inline.
llvm-svn: 331536
Adrian Prantl [Fri, 4 May 2018 16:10:43 +0000 (16:10 +0000)]
DwarfCompileUnit: Fix another assertion failure on malformed input
that is not rejected by the Verifier.
Thanks to Björn Pettersson for providing a reproducer!
llvm-svn: 331535
Zaara Syeda [Fri, 4 May 2018 16:04:04 +0000 (16:04 +0000)]
[PPC64] Remove support for ELF V1 ABI in LLD - buildbot fix
Fix buildbot error, failure to build with msvc due to error C2446
Use switch instead of ternary operator.
Differential Revision: https://reviews.llvm.org/D46316
llvm-svn: 331534
Erich Keane [Fri, 4 May 2018 15:58:31 +0000 (15:58 +0000)]
[clang-cl] Print /showIncludes to stderr, if used in combination with /E, /EP or /P
This replicates 'cl.exe' behavior and allows for both preprocessor output and
dependency information to be extraced with a single compiler invocation.
This is especially useful for compiler caching with tools like Mozilla's sccache.
See: https://github.com/mozilla/sccache/issues/246
Patch By: fxb
Differential Revision: https://reviews.llvm.org/D46394
llvm-svn: 331533
Clement Courbet [Fri, 4 May 2018 15:26:12 +0000 (15:26 +0000)]
[llvm-exegesis] Fix pfm counter names for BDW.
Summary: They are not consistent with other microarchitectures.
Reviewers: gchatelet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D46434
llvm-svn: 331532
Simon Pilgrim [Fri, 4 May 2018 15:20:18 +0000 (15:20 +0000)]
[X86] Cleanup SchedWriteFMA classes and use X86SchedWriteWidths directly.
Rename scalar and XMM versions, this is to match/simplify an upcoming change to split MUL/DIV/SQRT scalar/xmm/ymm/zmm classes.
llvm-svn: 331531
David Bolvansky [Fri, 4 May 2018 15:14:00 +0000 (15:14 +0000)]
[bindings/go] Add Go bindings for volatile loads/stores
Reviewers: whitequark
Reviewed By: whitequark
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46235
llvm-svn: 331530
Zaara Syeda [Fri, 4 May 2018 15:09:49 +0000 (15:09 +0000)]
[PPC64] Remove support for ELF V1 ABI in LLD
The current support for V1 ABI in LLD is incomplete.
This patch removes V1 ABI support and changes the default behavior to V2 ABI,
issuing an error when using the V1 ABI. It also updates the testcases to V2
and removes any V1 specific tests.
Differential Revision: https://reviews.llvm.org/D46316
llvm-svn: 331529
Krzysztof Parzyszek [Fri, 4 May 2018 15:07:30 +0000 (15:07 +0000)]
[Hexagon] Remove leftover debugging code after r331527
llvm-svn: 331528
Krzysztof Parzyszek [Fri, 4 May 2018 15:04:48 +0000 (15:04 +0000)]
[Hexagon] Handle non-immediate constants in HexagonSplitDouble
llvm-svn: 331527
Simon Dardis [Fri, 4 May 2018 15:00:54 +0000 (15:00 +0000)]
[mips] Correct the predicates of sign extension instructions
And eliminatw the duplication of those instructions for microMIPS32r6.
Reviewers: smaksimovic, abeserminji, atanasyan
Differential Revision: https://reviews.llvm.org/D46117
llvm-svn: 331526
Simon Pilgrim [Fri, 4 May 2018 14:54:33 +0000 (14:54 +0000)]
[X86] Add WriteVecMOVMSKY scheduler class
llvm-svn: 331525
David Major [Fri, 4 May 2018 14:41:49 +0000 (14:41 +0000)]
Comment fix.
Test commit!
llvm-svn: 331523
Adhemerval Zanella [Fri, 4 May 2018 14:33:55 +0000 (14:33 +0000)]
[AArch64] Custom Lower MULLH{S,U} for v16i8, v8i16, and v4i32
This patch adds a custom lowering for ISD::MULH{S,U} used on divide by
constant optimization (DAGCombiner::BuildSDIV and DAGCombiner::BuildUDIV).
New patterns for smull and umull are added, so AArch64ISD::{S,U}MULL
can be correctly lowered to smull2 and umull2.
Reviewed By: SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D46009
llvm-svn: 331522
Peter Smith [Fri, 4 May 2018 14:28:29 +0000 (14:28 +0000)]
[ELF][AArch64] Add aarch64_elf64_le_vec emulation
Android AOSP has started specifying -m aarch64_elf64_le_vec as supported
by gold and BFD. This is a simple change to add the emulation so that LLD
doesn't immediately error when used as a linker in an AOSP build.
Differential Revision: https://reviews.llvm.org/D46429
llvm-svn: 331521
Alexander Kornienko [Fri, 4 May 2018 14:13:14 +0000 (14:13 +0000)]
Remove explicit cfg-temporary-dtors=true
Summary:
Remove explicit -analyzer-config cfg-temporary-dtors=true in analyzer tests,
since this option defaults to true since r326461.
Reviewers: NoQ
Reviewed By: NoQ
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D46393
llvm-svn: 331520
Brian Gesiak [Fri, 4 May 2018 14:02:37 +0000 (14:02 +0000)]
[Coroutines] Catch exceptions in await_resume
Summary:
http://wg21.link/P0664r2 section "Evolution/Core Issues 24" describes a
proposed change to Coroutines TS that would have any exceptions thrown
after the initial suspend point of a coroutine be caught by the handler
specified by the promise type's 'unhandled_exception' member function.
This commit provides a sample implementation of the specified behavior.
Test Plan: `check-clang`
Reviewers: GorNishanov, EricWF
Reviewed By: GorNishanov
Subscribers: cfe-commits, lewissbaker, eric_niebler
Differential Revision: https://reviews.llvm.org/D45860
llvm-svn: 331519
Krzysztof Parzyszek [Fri, 4 May 2018 13:59:05 +0000 (13:59 +0000)]
[Hexagon] Skip reserved physical registers when updating liveness
llvm-svn: 331518
Andrea Di Biagio [Fri, 4 May 2018 13:52:12 +0000 (13:52 +0000)]
[llvm-mca] use colors for warnings and notes generated by InstrBuilder.
llvm-svn: 331517
Andrea Di Biagio [Fri, 4 May 2018 13:10:10 +0000 (13:10 +0000)]
[llvm-mca] remove unused argument from method InstrBuilder::createInstrDescImpl.
We don't need to pass the instruction index to the method that constructs new
instruction descriptors.
No functional change intended.
llvm-svn: 331516
Simon Pilgrim [Fri, 4 May 2018 12:59:24 +0000 (12:59 +0000)]
[X86] Add SchedWriteFRnd fp rounding scheduler classes
Split off from SchedWriteFAdd for fp rounding/bit-manipulation instructions.
Fixes an issue on btver2 which only had the ymm version using the JSTC pipe instead of JFPA.
llvm-svn: 331515
Jeremy Morse [Fri, 4 May 2018 10:05:10 +0000 (10:05 +0000)]
[X86] Add test case for PR30290s failing behaviour
Following the advice in review D45022, this currently tests for the broken llc
output where an instruction is mis-scheduled. This test is committed in advance
to improve the eventual fixing patch in D45022, making the bad behaviour that
that patch fixes clearer.
llvm-svn: 331514
Peter Smith [Fri, 4 May 2018 09:10:18 +0000 (09:10 +0000)]
[ELF][AArch64] Add REQUIRES aarch64 to test [NFC]
Forgot to add REQUIRES aarch64 to the test I recently added for D46255.
llvm-svn: 331513
Jeremy Morse [Fri, 4 May 2018 08:58:06 +0000 (08:58 +0000)]
Word wrap a test-file comment to 80 columns
This is a test commit to check whether my account works.
llvm-svn: 331512
Peter Smith [Fri, 4 May 2018 08:53:34 +0000 (08:53 +0000)]
[ELF][AArch64] Implement the AArch64 TLSLD_LDST_LO12 family of relocs
Implement the following relocations for AArch64:
R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC
R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC
R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC
R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC
R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC
These are specified in ELF for the 64-bit Arm Architecture.
Fixes pr36727
Differential Revision: https://reviews.llvm.org/D46255
llvm-svn: 331511
Bjorn Pettersson [Fri, 4 May 2018 08:50:48 +0000 (08:50 +0000)]
[SelectionDAG] Refactor code by adding RegsForValue::getRegsAndSizes(). NFCI
Summary:
Added a helper method in RegsForValue to get a list with
all the <RegNumber, RegSize> pairs that we want to iterate
over in SelectionDAGBuilder::EmitFuncArgumentDbgValue and
in SelectionDAGBuilder::visitIntrinsicCall.
Reviewers: vsk
Reviewed By: vsk
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46360
llvm-svn: 331510
Jonas Paulsson [Fri, 4 May 2018 07:50:05 +0000 (07:50 +0000)]
[RegUsageInfoCollector] Bugfix for handling of register aliases.
Don't assume the alias of a defined reg is always already in the set.
As the test case in https://bugs.llvm.org/show_bug.cgi?id=36587 discovered,
it is wrong to assume that all the aliases of the defined register in the
*current function* is already present in the UsedPhysRegsMask.
This patch changes this so that any definition in the current function of a
phys-reg always results in all its aliases inserted into the set of defined
registers.
Review: Quentin Colombet
https://reviews.llvm.org/D45157
llvm-svn: 331509
Max Kazantsev [Fri, 4 May 2018 07:34:35 +0000 (07:34 +0000)]
[IRCE] Fix misuse of dyn_cast which leads to UB
llvm-svn: 331508
Dean Michael Berris [Fri, 4 May 2018 06:27:53 +0000 (06:27 +0000)]
[XRay][compiler-rt] Support string-based config for Basic mode.
Summary:
This addresses http://llvm.org/PR36790.
This change allows the XRay Basic Mode implementation to use the
string-based initialization routine provided through
`__xray_log_init_mode(...)`. In the process, we've also deprecated some
flags defined for the `XRAY_OPTIONS` environment variable.
We then introduce another environment variable that can control the XRay
Basic Mode implementation through `XRAY_BASIC_OPTIONS`.
We also rename files from `xray_inmemory_log` to `xray_basic_logging` to
be more in line with the mode implementation.
Depends on D46174.
Reviewers: echristo, kpw, pelikan, eizan
Reviewed By: kpw
Subscribers: mgorny, llvm-commits
Differential Revision: https://reviews.llvm.org/D46246
llvm-svn: 331507
Dean Michael Berris [Fri, 4 May 2018 06:13:35 +0000 (06:13 +0000)]
[XRay][compiler-rt] Support string-based config for FDR mode
Summary:
In this chage we add support for the string-based configuration
mechanism for configuring FDR mode.
We deprecate most of the `xray_fdr_log_*` flags that are set with the
`XRAY_OPTIONS` environment variable. Instead we make the FDR
implementation take defaults from the `XRAY_FDR_OPTIONS` environment
variable, and use the flags defined in `xray_fdr_flags.{h,cc,inc}` for
the options we support.
This change addresses http://llvm.org/PR36790.
Depends on D46173.
Reviewers: eizan, pelikan, kpw, echristo
Subscribers: llvm-commits, mgorny
Differential Revision: https://reviews.llvm.org/D46174
llvm-svn: 331506
Martin Storsjo [Fri, 4 May 2018 06:06:27 +0000 (06:06 +0000)]
[COFF] Implement the remaining ARM64 relocations
Now only IMAGE_REL_ARM64_ABSOLUTE and IMAGE_REL_ARM64_TOKEN
are unhandled.
Also add range checks for the existing BRANCH26 relocation.
Differential Revision: https://reviews.llvm.org/D46354
llvm-svn: 331505
Martin Storsjo [Fri, 4 May 2018 06:05:58 +0000 (06:05 +0000)]
[Driver] Don't warn about unused inputs in config files
This avoids warnings about unused linker parameters, just like
other flags are ignored if they're from config files.
Differential Revision: https://reviews.llvm.org/D46286
llvm-svn: 331504
Dean Michael Berris [Fri, 4 May 2018 06:01:12 +0000 (06:01 +0000)]
[XRay][compiler-rt+docs] Introduce __xray_log_init_mode(...).
Summary:
This addresses http://llvm.org/PR36790.
The change Deprecates a number of functions and types in
`include/xray/xray_log_interface.h` to recommend using string-based
configuration of XRay through the __xray_log_init_mode(...) function. In
particular, this deprecates the following:
- `__xray_set_log_impl(...)` -- users should instead use the
`__xray_log_register_mode(...)` and `__xray_log_select_mode(...)` APIs.
- `__xray_log_init(...)` -- users should instead use the
`__xray_log_init_mode(...)` function, which also requires using the
`__xray_log_register_mode(...)` and `__xray_log_select_mode(...)`
functionality.
- `__xray::FDRLoggingOptions` -- in following patches, we'll be
migrating the FDR logging implementations (and tests) to use the
string-based configuration. In later stages we'll remove the
`__xray::FDRLoggingOptions` type, and ask users to migrate to using the
string-based configuration mechanism instead.
- `__xray::BasicLoggingOptions` -- same as `__xray::FDRLoggingOptions`,
we'll be removing this type later and instead rely exclusively on the
string-based configuration API.
We also update the documentation to reflect the new advice and remove
some of the deprecated notes.
Reviewers: eizan, kpw, echristo, pelikan
Reviewed By: kpw
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D46173
llvm-svn: 331503
Michael Zolotukhin [Fri, 4 May 2018 01:40:05 +0000 (01:40 +0000)]
[MachineCSE] Rewrite a loop checking if a block is in a set of blocks without using a set. NFC.
Summary:
Using a set is unnecessary here an in some cases (see e.g. PR37277)
takes significant amount of time to just insert values into it. In this
particular case all we need is just to check if we find the block we are
looking for or not.
Reviewers: davide
Subscribers: hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D46411
llvm-svn: 331502
Jim Ingham [Fri, 4 May 2018 01:31:47 +0000 (01:31 +0000)]
Add children and child[N] properties to SBValue.i.
Also fixed some bad formatting in SBValue.i.
llvm-svn: 331501
Craig Topper [Fri, 4 May 2018 01:04:28 +0000 (01:04 +0000)]
[LoopIdiomRecognize] Replace more unchecked dyn_casts with cast.
Two of these are immediately dereferenced on the next line. The other two are passed immediately to the IRBuilder constructor which can't handle a nullptr.
llvm-svn: 331500
Craig Topper [Fri, 4 May 2018 01:04:26 +0000 (01:04 +0000)]
[LoopIdiomRecognize] Use a regular array instead of a SmallVector and explicit ArrayRef.
llvm-svn: 331499
Craig Topper [Fri, 4 May 2018 01:04:24 +0000 (01:04 +0000)]
[LoopIdiomRecognize] Turn two uncheck dyn_casts into regular casts.
These are casts on users of a PHINode to Instruction. I think since PHINode is an Instruction any users would also be Instructions. At least a cast will give us an assertion if its wrong.
llvm-svn: 331498
Jason Molenda [Fri, 4 May 2018 00:59:37 +0000 (00:59 +0000)]
The on-ios-device command line lldb has an optimization where
when it and the inferior process both have the same shared cache
(a conglomeration of all libraries at the same fixed address for
all processes), lldb will read data out of its own memory to speed
things up. The shared cache has a UUID, so lldb currently checks
that the UUID of its own shared cache matches that of the inferior.
This change adds one refinement to that -- it checks that the UUID
is the same and that the base address of the shared cache is the
same. And only uses its local shared cache if they are both identical.
This involved using a different style of SPI with dyld to get lldb's
shared cache load address, but it's not especially difficult.
One unattractive part of the change is that I'm using the real
underlying types of task_t and kern_return_t instead of picking
them up from mach/mach.h. The defines that get picked up there (a
lot from machine.h but others too) conflict with llvm/Support/MachO.h
even when I have mach.h included before our SafeMachO.h which
undefines most of the defines before including llvm/Support/MachO.h.
I'll need to augment the #undefs in SafeMachO.h to get this to
compile cleanly, but that'll be another day.
<rdar://problem/
39868238>
llvm-svn: 331497
Artem Dergachev [Fri, 4 May 2018 00:53:41 +0000 (00:53 +0000)]
[analyzer] NFC: Remove unused parameteer of StoreManager::CastRetrievedVal().
llvm-svn: 331496
Craig Topper [Thu, 3 May 2018 23:50:29 +0000 (23:50 +0000)]
[LoopIdiomRecognize] Add a test case to show incorrect transformation of an infinite loop with side effets into a countable loop using ctlz.
We currently recognize this idiom where x is signed and thus the shift in an ashr.
int cnt = 0;
while (x) {
x >>= 1; // arithmetic shift right
++cnt;
}
and turn it into (bitwidth - ctlz(x)). And if there is anything else in the loop we will create a new loop that runs that many times.
If x is initially negative, the shift result will never be 0 and thus the loop is infinite. If you put something with side effects in the loop, that side effect will now only happen bitwidth times instead of an infinite number of times.
So this transform is only safe for logical shift right (which we don't currently recognize) or if we can prove that x cannot be negative before the loop.
llvm-svn: 331493
Adrian Prantl [Thu, 3 May 2018 23:32:47 +0000 (23:32 +0000)]
DWARFExpression: Convert file addresses to load addresses early on.
This is a change that only affects Swift and is NFC for the language
plugins on llvm.org. In Swift, we can have global variables with a
location such as DW_OP_addr <addr> DW_OP_deref. The DWARF expression
evaluator doesn't know how to apply a DW_OP_deref to a file address,
but at the very end we convert the file address into a load address.
This patch moves the file->load address conversion to right after the
result of the DW_OP_addr is pushed onto the stack so that a subsequent
DW_OP_deref (and potentially other operations) can be interpreted.
rdar://problem/
39767528
Differential revision: https://reviews.llvm.org/D46362
llvm-svn: 331492
Volodymyr Sapsai [Thu, 3 May 2018 23:06:37 +0000 (23:06 +0000)]
Revert "Follow-up to r331378. Update tests to allow to use C atomics in C++."
It reverts commit r331484 because it caused test failures
ThreadSanitizer-x86_64 :: Darwin/gcd-groups-destructor.mm
ThreadSanitizer-x86_64 :: Darwin/libcxx-shared-ptr-stress.mm
ThreadSanitizer-x86_64 :: Darwin/xpc-race.mm
Foundation.h transitively includes <atomic>, so we have a case of benign mixing
<stdatomic.h> and <atomic>.
llvm-svn: 331491
Tom Stellard [Thu, 3 May 2018 22:38:06 +0000 (22:38 +0000)]
AMDGPU: Make getSubRegFromChannel a static member of AMDGPURegisterInfo
Summary:
This makes is possible to have R600RegisterInfo and SIRegisterInfo
not inherit from AMDGPURegisterInfo.
Reviewers: arsenm, nhaehnle
Reviewed By: arsenm
Subscribers: kzhuravl, wdng, yaxunl, dstuttard, tpr, llvm-commits, t-tye
Differential Revision: https://reviews.llvm.org/D46280
llvm-svn: 331490
Simon Pilgrim [Thu, 3 May 2018 22:31:19 +0000 (22:31 +0000)]
[X86] Add WriteDPPD/WriteDPPS dot product scheduler classes
llvm-svn: 331489
Simon Pilgrim [Thu, 3 May 2018 22:12:23 +0000 (22:12 +0000)]
[X86][Znver1] Use SchedAlias to tag microcoded scheduler classes
Avoids extra entries in the class tables.
Found a typo that missed the MMX_PHSUBSW instruction.
llvm-svn: 331488
Justin Bogner [Thu, 3 May 2018 21:59:13 +0000 (21:59 +0000)]
Fix include of config.h that was incorrectly changed in r331184
The RWMutex implementation depends on config.h macros (specifically
HAVE_PTHREAD_H and HAVE_PTHREAD_RWLOCK_INIT), so we need to be
including it and not just llvm-config.h here or we fall back to a much
slower implementation.
llvm-svn: 331487
Sanjay Patel [Thu, 3 May 2018 21:58:44 +0000 (21:58 +0000)]
[InstCombine] refine select-of-constants to bitwise ops
Add logic for the special case when a cmp+select can clearly be
reduced to just a bitwise logic instruction, and remove an
over-reaching chunk of general purpose bit magic. The primary goal
is to remove cases where we are not improving the IR instruction
count when doing these select transforms, and in all cases here that
is true.
In the motivating 3-way compare tests, there are further improvements
because we can combine/propagate select values (not sure if that
belongs in instcombine, but it's there for now).
DAGCombiner has folds to turn some of these selects into bit magic,
so there should be no difference in the end result in those cases.
Not all constant combinations are handled there yet, however, so it
is possible that some targets will see more cmov/csel codegen with
this change in IR canonicalization.
Ideally, we'll go further to *not* turn selects into multiple
logic/math ops in instcombine, and we'll canonicalize to selects.
But we should make sure that this step does not result in regressions
first (and if it does, we should fix those in the backend).
The general direction for this change was discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2016-September/105373.html
http://lists.llvm.org/pipermail/llvm-dev/2017-July/114885.html
Alive proofs for the new bit magic:
https://rise4fun.com/Alive/XG7
Differential Revision: https://reviews.llvm.org/D46086
llvm-svn: 331486
Tom Stellard [Thu, 3 May 2018 21:44:16 +0000 (21:44 +0000)]
GlobalISel: Use a callback to compute constrained reg class for unallocatble registers
Summary:
constrainOperandRegClass() currently fails if it tries to constrain the
register class of an operand that is defeined with an unallocatable register
class. This patch resolves this by adding a target callback to compute
register constriants in this case.
This is required by the AMDGPU because many of its instructions have source opreands
defined with the unallocatable register classe VS_32 which is a union of two allocatable
register classes VGPR_32 and SReg_32.
Reviewers: dsanders, aditya_nandakumar
Reviewed By: aditya_nandakumar
Subscribers: rovka, kristof.beyls, tpr, llvm-commits
Differential Revision: https://reviews.llvm.org/D45991
llvm-svn: 331485
Volodymyr Sapsai [Thu, 3 May 2018 21:30:47 +0000 (21:30 +0000)]
Follow-up to r331378. Update tests to allow to use C atomics in C++.
Reviewers: kubamracek
Reviewed By: kubamracek
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D46363
llvm-svn: 331484
Craig Topper [Thu, 3 May 2018 21:01:35 +0000 (21:01 +0000)]
[X86] Make __builtin_ia32_directstore_u32 and __builtin_ia32_movdir64b 'nothrow'
These builtins snuck in while I was in the middle of adding nothrow to the other builtins in my local clone and I guess I missed them.
llvm-svn: 331483
Craig Topper [Thu, 3 May 2018 21:01:33 +0000 (21:01 +0000)]
[CodeGenFunction] Use the StringRef::split function that takes a char separator instead of StringRef separator. NFC
The char separator version should be a little better optimized.
llvm-svn: 331482
Teresa Johnson [Thu, 3 May 2018 20:24:12 +0000 (20:24 +0000)]
[ThinLTO] Add support for optimization remarks to thinBackend
Summary:
Support was added to the regular LTO backend, but not thinBackend.
This patch adds that support.
Reviewers: pcc, davide
Subscribers: mehdi_amini, inglorion, llvm-commits
Differential Revision: https://reviews.llvm.org/D46376
llvm-svn: 331481
Adrian Prantl [Thu, 3 May 2018 20:19:39 +0000 (20:19 +0000)]
Revert "DWARFExpression: Convert file addresses to load addresses early on."
This reverts commit 331462 while investigating bot breakage.
llvm-svn: 331480
Adrian Prantl [Thu, 3 May 2018 20:13:58 +0000 (20:13 +0000)]
Add back condition that was accidentally removed in r331462.
This should make the bots much happier.
llvm-svn: 331479
Rumeet Dhindsa [Thu, 3 May 2018 20:13:38 +0000 (20:13 +0000)]
Added ThinLTO test to verify that index files are not generated if thinlto-index-only is not enabled.
Differential Revision: https://reviews.llvm.org/D46405
llvm-svn: 331478
Kostya Kortchinsky [Thu, 3 May 2018 19:14:07 +0000 (19:14 +0000)]
[sanitizer] Remove unused 32-bit allocator TransferBatch parameter
Summary:
NFC. Remove an unused parameter in
`SizeClassAllocator32::TransferBatch::SetFromArray`, and thus get rid of the
compilation warning.
Reviewers: alekseyshl, vitalybuka
Reviewed By: vitalybuka
Subscribers: kubamracek, delcypher, #sanitizers, llvm-commits
Differential Revision: https://reviews.llvm.org/D46397
llvm-svn: 331477
Sanjay Patel [Thu, 3 May 2018 18:49:35 +0000 (18:49 +0000)]
[PowerPC] add more FMF debug output; NFC
We can't see all of the problems currently unless
we look at debug output when the global 'unsafe' is
on. It's a mess. This is another attempt to make
sure that D45710 is not making changes unintentionally.
llvm-svn: 331476
Zinovy Nis [Thu, 3 May 2018 18:31:39 +0000 (18:31 +0000)]
Simplify test clang-tidy-__clang_analyzer__macro.cpp
llvm-svn: 331475
Zinovy Nis [Thu, 3 May 2018 18:26:39 +0000 (18:26 +0000)]
[clang-tidy] Define __clang_analyzer__ macro for clang-tidy for compatibility with clang static analyzer
This macro is widely used in many well-known projects, ex. Chromium.
But it's not set for clang-tidy, so for ex. DCHECK in Chromium is not considered
as [[no-return]], and a lot of false-positive warnings about nullptr
dereferenced are emitted.
Differential Revision: https://reviews.llvm.org/D46325
llvm-svn: 331474
Simon Pilgrim [Thu, 3 May 2018 18:22:49 +0000 (18:22 +0000)]
[X86][AVX512] VPLZCNT instructions match SchedWriteVecIMul scheduling class not SchedWriteVecALU.
llvm-svn: 331473