platform/upstream/llvm.git
7 years ago[IR] Move a few static functions in Instruction class inline.
Craig Topper [Mon, 20 Mar 2017 06:40:39 +0000 (06:40 +0000)]
[IR] Move a few static functions in Instruction class inline.

They just check for certain opcodes and opcode enums are available in Instruction.h.

llvm-svn: 298237

7 years ago[ConstantRange] Add setSizeSmallerThanOf method.
Michael Zolotukhin [Mon, 20 Mar 2017 06:33:07 +0000 (06:33 +0000)]
[ConstantRange] Add setSizeSmallerThanOf method.

Summary:
ConstantRange class currently has a method getSetSize, which is mostly used to
compare set sizes of two constant ranges (there is only one spot where it's used
in a slightly different scenario). This patch introduces setSizeSmallerThanOf
method, which does such comparison in a more efficient way. In the original
method we have to extend our types to (BitWidth+1), which can result it using
slow case of APInt, extra memory allocations, etc.

The change is supposed to not change any functionality, but it slightly improves
compile time. Here is compile time improvements that I observed on CTMark:
* tramp3d-v4 -2.02%
* pairlocalalign -1.82%
* lencod -1.67%

Reviewers: sanjoy, atrick, pete

Subscribers: llvm-commits

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

llvm-svn: 298236

7 years ago[IR] Remove some unneeded includes from Operator.h and fix cpp files that were transi...
Craig Topper [Mon, 20 Mar 2017 05:08:41 +0000 (05:08 +0000)]
[IR] Remove some unneeded includes from Operator.h and fix cpp files that were transitively depending on it. NFC

llvm-svn: 298235

7 years ago[IR] Add missing copyright header.
Craig Topper [Mon, 20 Mar 2017 05:08:38 +0000 (05:08 +0000)]
[IR] Add missing copyright header.

llvm-svn: 298234

7 years ago[APInt] Don't initialize VAL to 0 in APInt constructors. Push it down to the initSlow...
Craig Topper [Mon, 20 Mar 2017 01:29:52 +0000 (01:29 +0000)]
[APInt] Don't initialize VAL to 0 in APInt constructors. Push it down to the initSlowCase and other init methods.

I'm not sure if zeroing VAL before writing pVal is really necessary, but at least one other place did it in code.

But by taking the store out of line, this reduces the opt binary by about 20k on my local x86-64 build.

llvm-svn: 298233

7 years agoRemove unnecessary IDom check
Xin Tong [Mon, 20 Mar 2017 00:30:19 +0000 (00:30 +0000)]
Remove unnecessary IDom check

Summary: This Idom check seems unnecessary. The immediate children of a node on the Dominator Tree should always be the IDom of its immediate children in this case.

Reviewers: hfinkel, majnemer, dberlin

Reviewed By: dberlin

Subscribers: dberlin, davide, llvm-commits

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

llvm-svn: 298232

7 years ago[InstCombine] Remove duplicate code in SimplifyDemandedUseBits for URem. NFC
Craig Topper [Sun, 19 Mar 2017 21:45:57 +0000 (21:45 +0000)]
[InstCombine] Remove duplicate code in SimplifyDemandedUseBits for URem. NFC

llvm-svn: 298231

7 years ago[ELF] clang-format sortMipsSymbols. NFC
Simon Atanasyan [Sun, 19 Mar 2017 19:32:51 +0000 (19:32 +0000)]
[ELF] clang-format sortMipsSymbols. NFC

llvm-svn: 298230

7 years agoRename the clang-tidy safety module to be hicpp, for the High-Integrity C++ coding...
Aaron Ballman [Sun, 19 Mar 2017 17:23:23 +0000 (17:23 +0000)]
Rename the clang-tidy safety module to be hicpp, for the High-Integrity C++ coding standard from PRQA.

This commit renames all of the safety functionality to be hicpp, adds an appropriate LICENSE.TXT, and updates the documentation accordingly.

llvm-svn: 298229

7 years ago[AVX-512] Handle kor/kand/kandn/kxor/kxnor/knot intrinsics at lowering time instead...
Craig Topper [Sun, 19 Mar 2017 17:11:09 +0000 (17:11 +0000)]
[AVX-512] Handle kor/kand/kandn/kxor/kxnor/knot intrinsics at lowering time instead of isel

Summary:
Currently we handle these intrinsics at isel with special patterns. But as they just map to normal logic operations, we should just handle them at lowering. This will expose them to DAG combine optimizations. Right now the kor-sequence test generates a bunch of regclass copies between GR16 and VK16 that the peephole optimizer and/or register coallescing are removing to keep everything in the mask domain. By handling the logic op intrinsics earlier, these copies become bitcasts in the DAG and get removed by DAG combine which seems more robust.

This should help enable my plan to stop copying between K registers and GR8/GR16. The peephole optimizer can't remove a chain of copies between K and GR32 with insert_subreg/extract_subreg present in the chain so the kor-sequence test break. But this patch should dodge the problem entirely.

Reviewers: zvi, delena, RKSimon, igorb

Reviewed By: igorb

Subscribers: llvm-commits

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

llvm-svn: 298228

7 years ago[InstCombine] Use update_test_checks.py to regenerate a test. NFC
Craig Topper [Sun, 19 Mar 2017 17:04:52 +0000 (17:04 +0000)]
[InstCombine] Use update_test_checks.py to regenerate a test. NFC

llvm-svn: 298227

7 years agoFix constant folding of fp2int to large integers
Simon Pilgrim [Sun, 19 Mar 2017 16:50:25 +0000 (16:50 +0000)]
Fix constant folding of fp2int to large integers

We make the assumption in most of our constant folding code that a fp2int will target an integer of 128-bits or less, calling the APFloat::convertToInteger with only uint64_t[2] of raw bits for the result.

Fuzz testing (PR24662) showed that we don't handle other cases at all, resulting in stack overflows and all sorts of crashes.

This patch uses the APSInt version of APFloat::convertToInteger instead to better handle such cases.

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

llvm-svn: 298226

7 years agoFix MSVC warning: "switch statement contains 'default' but no 'case' labels". NFCI.
Simon Pilgrim [Sun, 19 Mar 2017 16:39:04 +0000 (16:39 +0000)]
Fix MSVC warning: "switch statement contains 'default' but no 'case' labels". NFCI.

llvm-svn: 298225

7 years ago[GlobalISel] Don't select trivially dead instructions.
Ahmed Bougacha [Sun, 19 Mar 2017 16:13:00 +0000 (16:13 +0000)]
[GlobalISel] Don't select trivially dead instructions.

Folding instructions when selecting can cause them to become dead.
Don't select these dead instructions (if they don't have other side
effects, and don't define physical registers).

Preserve existing tests by adding COPYs.

In some tests, the G_CONSTANT vregs never get constrained to a class:
the only use of the vreg was folded into another instruction, so the
G_CONSTANT, now dead, never gets selected.

llvm-svn: 298224

7 years ago[GlobalISel][AArch64] Add DBG_VALUE select test. NFC.
Ahmed Bougacha [Sun, 19 Mar 2017 16:12:53 +0000 (16:12 +0000)]
[GlobalISel][AArch64] Add DBG_VALUE select test. NFC.

llvm-svn: 298223

7 years ago[GlobalISel][AArch64] Split out cast select tests. NFC.
Ahmed Bougacha [Sun, 19 Mar 2017 16:12:51 +0000 (16:12 +0000)]
[GlobalISel][AArch64] Split out cast select tests. NFC.

And remove some redundant bitcast tests.

Also split the test functions themselves: it makes it obvious to see
what's tested where and what isn't, it makes the tests much easier to
read and manually update, and, most importantly, it makes them almost
trivial to update using tooling.  Yes, it's obnoxiously verbose, but
said tooling helps upgrade to better MIR syntax whenever available.

llvm-svn: 298222

7 years ago[GlobalISel] Move method definition to the proper file. NFC.
Ahmed Bougacha [Sun, 19 Mar 2017 16:12:48 +0000 (16:12 +0000)]
[GlobalISel] Move method definition to the proper file. NFC.

llvm-svn: 298221

7 years ago[CodeGen] Update hasSideEffects comment. NFC.
Ahmed Bougacha [Sun, 19 Mar 2017 16:12:45 +0000 (16:12 +0000)]
[CodeGen] Update hasSideEffects comment. NFC.

We used to have 3 side effect flags, but as of r222809, we only have
hasSideEffects.  Change the comment to reflect that.

llvm-svn: 298220

7 years agoCorrect a rebase mistake.
Xin Tong [Sun, 19 Mar 2017 15:41:46 +0000 (15:41 +0000)]
Correct a rebase mistake.

Left out AA in jumpthreading SimplifyPartiallyRedundantLoad

llvm-svn: 298219

7 years agoRemove unused arguments. NFCI
Xin Tong [Sun, 19 Mar 2017 15:31:16 +0000 (15:31 +0000)]
Remove unused arguments. NFCI

llvm-svn: 298218

7 years ago[JumpThreading] Perform phi-translation in SimplifyPartiallyRedundantLoad.
Xin Tong [Sun, 19 Mar 2017 15:30:53 +0000 (15:30 +0000)]
[JumpThreading] Perform phi-translation in SimplifyPartiallyRedundantLoad.

Summary:
In case we are loading on a phi-load in SimplifyPartiallyRedundantLoad.
Try to phi translate it into incoming values in the predecessors before
we search for available loads.

This needs https://reviews.llvm.org/D30524

Reviewers: davide, sanjoy, efriedma, dberlin, rengolin

Reviewed By: dberlin

Subscribers: junbuml, llvm-commits

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

llvm-svn: 298217

7 years agoExtract FindAvailablePtrLoadStore out of FindAvailableLoadedValue. NFCI
Xin Tong [Sun, 19 Mar 2017 15:27:52 +0000 (15:27 +0000)]
Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue. NFCI

Summary:
Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue.
Prepare for upcoming change which will do phi-translation for load on
phi pointer in jump threading SimplifyPartiallyRedundantLoad.

This is in preparation for https://reviews.llvm.org/D30543

Reviewers: efriedma, sanjoy, davide, dberlin

Reviewed By: davide

Subscribers: junbuml, davide, llvm-commits

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

llvm-svn: 298216

7 years agoCleaning up the IdentifierResolver::iterator class a bit; NFC.
Aaron Ballman [Sun, 19 Mar 2017 15:15:28 +0000 (15:15 +0000)]
Cleaning up the IdentifierResolver::iterator class a bit; NFC.

The comment about there being three different forms that Ptr represents was stale. Also, the opaque value does not need to be exposed (these functions are unused).

llvm-svn: 298215

7 years agoUse pthreads for thread-local lsan allocator cache on darwin
Francis Ricci [Sun, 19 Mar 2017 15:02:43 +0000 (15:02 +0000)]
Use pthreads for thread-local lsan allocator cache on darwin

Summary:
This patch allows us to move away from using __thread on darwin,
which is requiring for building lsan for darwin on ios version 7
and on iossim i386.

Reviewers: kubamracek, kcc

Subscribers: llvm-commits

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

llvm-svn: 298214

7 years agoEnable stripping of multiple DILocation on !llvm.loop metadata
Teresa Johnson [Sun, 19 Mar 2017 13:54:57 +0000 (13:54 +0000)]
Enable stripping of multiple DILocation on !llvm.loop metadata

Summary:
I found that stripDebugInfo was still leaving significant amounts of
debug info due to !llvm.loop that contained DILocation after stripping.
The support for stripping debug info on !llvm.loop added in r293377 only
removes a single DILocation. Enhance that to remove all DILocation from
!llvm.loop.

Reviewers: hfinkel, aprantl, dsanders

Subscribers: llvm-commits

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

llvm-svn: 298213

7 years ago[MIR] Test assumes x64 windows calling convention upon printing/parsing MIR output...
Oren Ben Simhon [Sun, 19 Mar 2017 13:23:20 +0000 (13:23 +0000)]
[MIR] Test assumes x64 windows calling convention upon printing/parsing MIR output/input.

llvm-svn: 298212

7 years ago[MIR] Add triple to test that assumes it runs on windows.
Benjamin Kramer [Sun, 19 Mar 2017 13:04:35 +0000 (13:04 +0000)]
[MIR] Add triple to test that assumes it runs on windows.

llvm-svn: 298211

7 years agoCalleeSavedRegister was removed from MIR and is recalculated upon MIR parsing.
Oren Ben Simhon [Sun, 19 Mar 2017 11:18:09 +0000 (11:18 +0000)]
CalleeSavedRegister was removed from MIR and is recalculated upon MIR parsing.

llvm-svn: 298210

7 years agoMoving the test to x86 because other architectures do not suport regcall calling...
Oren Ben Simhon [Sun, 19 Mar 2017 08:53:42 +0000 (08:53 +0000)]
Moving the test to x86 because other architectures do not suport regcall calling convention.

llvm-svn: 298209

7 years ago[X86][AVX512][Clang][Intrinsics] Adding missing intrinsics to Clang .
Igor Breger [Sun, 19 Mar 2017 08:27:16 +0000 (08:27 +0000)]
[X86][AVX512][Clang][Intrinsics] Adding missing intrinsics to Clang .

Summary:
Adding missing intrinsics :
    _mm512_set_epi16,
    _mm512_set_epi8,
    _mm512_permutevar_epi32
    _mm512_mask_permutevar_epi32

Reviewers: zvi, guyblank, eladcohen, craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, cfe-commits

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

llvm-svn: 298208

7 years ago[MIR] Support Customed Register Mask and CSRs
Oren Ben Simhon [Sun, 19 Mar 2017 08:14:18 +0000 (08:14 +0000)]
[MIR] Support Customed Register Mask and CSRs

The MIR printer dumps a string that describe the register mask of a function.
A static predefined list of register masks matches a static list of strings.
However when the register mask is not from the static predefined list, there is no descriptor string and the printer fails.
This patch adds support to custom register mask printing and dumping.
Also the list of callee saved registers (describing the registers that must be preserved for the caller) might be dynamic.
As such this data needs to be dumped and parsed back to the Machine Register Info.

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

llvm-svn: 298207

7 years agoFix syntax error when building with editline support.
Zachary Turner [Sun, 19 Mar 2017 06:00:31 +0000 (06:00 +0000)]
Fix syntax error when building with editline support.

llvm-svn: 298206

7 years agoRemove FileSystem::Get/SetFilePermissions
Zachary Turner [Sun, 19 Mar 2017 05:49:43 +0000 (05:49 +0000)]
Remove FileSystem::Get/SetFilePermissions

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

llvm-svn: 298205

7 years ago[InstCombine] Use setHighBits/setLowBits/setBitsFrom in place of getLowBitsSet/getHig...
Craig Topper [Sun, 19 Mar 2017 05:49:16 +0000 (05:49 +0000)]
[InstCombine] Use setHighBits/setLowBits/setBitsFrom in place of getLowBitsSet/getHighBitsSet.

llvm-svn: 298204

7 years agoRemove FileSystem::MakeDirectory.
Zachary Turner [Sun, 19 Mar 2017 05:48:47 +0000 (05:48 +0000)]
Remove FileSystem::MakeDirectory.

Have callers use llvm::sys::fs::create_directory() instead.

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

llvm-svn: 298203

7 years agoFix unit test compilation failure.
Zachary Turner [Sun, 19 Mar 2017 05:48:01 +0000 (05:48 +0000)]
Fix unit test compilation failure.

llvm-svn: 298202

7 years ago[Analysis] bitreverse(undef) returns undef
Brian Gesiak [Sun, 19 Mar 2017 04:40:42 +0000 (04:40 +0000)]
[Analysis] bitreverse(undef) returns undef

Summary:
The reverse of an artbitrary bitpattern is also an arbitrary
bitpattern.

Reviewers: trentxintong, arsenm, majnemer

Reviewed By: majnemer

Subscribers: majnemer, wdng, llvm-commits

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

llvm-svn: 298201

7 years agoRe-commit of r296706 ("Increase stack size for stack-use-after-return test"). Hopefu...
Kuba Mracek [Sun, 19 Mar 2017 00:59:08 +0000 (00:59 +0000)]
Re-commit of r296706 ("Increase stack size for stack-use-after-return test").  Hopefully the recent changes in the test will make it not flaky anymore.

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

llvm-svn: 298200

7 years agoNewGVN: Now that we have a better verifier, we can prove that we can erase the predic...
Daniel Berlin [Sun, 19 Mar 2017 00:07:32 +0000 (00:07 +0000)]
NewGVN: Now that we have a better verifier, we can prove that we can erase the predicateuser set each time we mark it touched

llvm-svn: 298199

7 years agoNewGVN: Remove dead code (for now)
Daniel Berlin [Sun, 19 Mar 2017 00:07:27 +0000 (00:07 +0000)]
NewGVN: Remove dead code (for now)

llvm-svn: 298198

7 years ago[CodeGen] Remove need for all parameters to be in scop context for load hoisting.
Tobias Grosser [Sat, 18 Mar 2017 23:12:49 +0000 (23:12 +0000)]
[CodeGen] Remove need for all parameters to be in scop context for load hoisting.

When not adding constraints on parameters using -polly-ignore-parameter-bounds,
the context may not necessarily list all parameter dimensions. To support code
generation in this situation, we now always iterate over the actual parameter
list, rather than relying on the context to list all parameter dimensions.

llvm-svn: 298197

7 years agoApparently, PTHREAD_STACK_MIN can be in limits.h on some systems...
Kuba Mracek [Sat, 18 Mar 2017 22:01:33 +0000 (22:01 +0000)]
Apparently, PTHREAD_STACK_MIN can be in limits.h on some systems...

llvm-svn: 298196

7 years agoChange stack-use-after-return.cc to respect PTHREAD_STACK_MIN before calling pthread_...
Kuba Mracek [Sat, 18 Mar 2017 21:35:12 +0000 (21:35 +0000)]
Change stack-use-after-return.cc to respect PTHREAD_STACK_MIN before calling pthread_attr_setstacksize. To investigate <https://reviews.llvm.org/D30267>. NFC.

llvm-svn: 298195

7 years ago[IslExprBuilder] Print accessed memory locations with RuntimeDebugBuilder
Tobias Grosser [Sat, 18 Mar 2017 20:54:43 +0000 (20:54 +0000)]
[IslExprBuilder] Print accessed memory locations with RuntimeDebugBuilder

After this change, enabling -polly-codegen-add-debug-printing in combination
with -polly-codegen-generate-expressions allows us to instrument the compiled
binaries to not only print the values stored and loaded to a given memory
access, but also to print the accessed location with array name and
per-dimension offset:

  MemRef_A[3][2]
  Store to  6299784: 5.000000
  MemRef_A[3][3]
  Load from 6299788: 0.000000
  MemRef_A[3][3]
  Store to  6299788: 6.000000

This can be very helpful for debugging.

llvm-svn: 298194

7 years agoAdd extra return value checks into stack-use-after-return.cc to help diagnose AArch64...
Kuba Mracek [Sat, 18 Mar 2017 20:39:31 +0000 (20:39 +0000)]
Add extra return value checks into stack-use-after-return.cc to help diagnose AArch64 test failures for <https://reviews.llvm.org/D30267>. NFC.

llvm-svn: 298193

7 years ago[OpenMP] Do not emit lifetime markers for context
Tobias Grosser [Sat, 18 Mar 2017 20:10:07 +0000 (20:10 +0000)]
[OpenMP] Do not emit lifetime markers for context

In commit r219005 lifetime markers have been introduced to mark the lifetime of
the OpenMP context data structure. However, their use seems incorrect and
recently caused a miscompile in ASC_Sequoia/CrystalMk after r298053 which was
not at all related to r298053. r298053 only caused a change in the loop order,
as this change resulted in a different isl internal representation which caused
the scheduler to derive a different schedule. This change then caused the IR to
change, which apparently created a pattern in which LLVM exploites the lifetime
markers. It seems we are using the OpenMP context outside of the lifetime
markers. Even though CrystalMk could probably be fixed by expanding the scope of
the lifetime markers, it is not clear what happens in case the OpenMP function
call is in a loop which will cause a sequence of starting and ending lifetimes.
As it is unlikely that the lifetime markers give any performance benefit, we
just drop them to remove complexity.

llvm-svn: 298192

7 years ago[GVN] Fix accidental double storage of the function BasicBlock list in iterateOnFunction
Craig Topper [Sat, 18 Mar 2017 18:24:41 +0000 (18:24 +0000)]
[GVN] Fix accidental double storage of the function BasicBlock list in iterateOnFunction

Summary:
iterateOnFunction creates a ReversePostOrderTraversal object which does a post order traversal in its constructor and stores the results in an internal vector. Iteration over it just reads from the internal vector in reverse order.

The GVN code seems to be unaware of this and iterates over ReversePostOrderTraversal object and makes a copy of the vector into a local vector. (I think at one point in time we used a DFS here instead which would have required the local vector).

The net affect of this is that we have two vectors containing the basic block list. As I didn't want to expose the implementation detail of ReversePostOrderTraversal's constructor to GVN, I've changed the code to do an explicit post order traversal storing into the local vector and then reverse iterate over that.

I've also removed the reserve(256) since the ReversePostOrderTraversal wasn't doing that. I can add it back if we thinks it important. Though it seemed weird that it wasn't based on the size of the function.

Reviewers: davide, anemet, dberlin

Subscribers: llvm-commits

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

llvm-svn: 298191

7 years ago[ValueTracking] Remove deadish code from computeKnownBitsAddSub.
Craig Topper [Sat, 18 Mar 2017 18:21:46 +0000 (18:21 +0000)]
[ValueTracking] Remove deadish code from computeKnownBitsAddSub.

The code assigned to KnownZero, but later code unconditionally assigned over it. I'm pretty sure the later code can handle the same cases and more equally well.

llvm-svn: 298190

7 years agoRemove some dead code from DumpValueObjectOptions::PointerDepth
Tamas Berghammer [Sat, 18 Mar 2017 17:33:00 +0000 (17:33 +0000)]
Remove some dead code from DumpValueObjectOptions::PointerDepth

llvm-svn: 298189

7 years agoNewGVN: Greatly enhance the ability of the NewGVN verifier to detect
Daniel Berlin [Sat, 18 Mar 2017 15:41:40 +0000 (15:41 +0000)]
NewGVN: Greatly enhance the ability of the NewGVN verifier to detect
issues, subsuming previous verifier.

llvm-svn: 298188

7 years agoNewGVN: Fix PHI evaluation bug exposed by new verifier. We were checking whether...
Daniel Berlin [Sat, 18 Mar 2017 15:41:36 +0000 (15:41 +0000)]
NewGVN: Fix PHI evaluation bug exposed by new verifier. We were checking whether the incoming block was reachable instead of whether the specific edge was reachable

llvm-svn: 298187

7 years agoDebugCounters: Add API for setting/unsetting programatically.
Daniel Berlin [Sat, 18 Mar 2017 15:41:13 +0000 (15:41 +0000)]
DebugCounters: Add API for setting/unsetting programatically.
This is required so we can re-set the counter state for verifiers,
etc.

llvm-svn: 298186

7 years agoRevert "Modules: Cache PCMs in memory and avoid a use-after-free"
Renato Golin [Sat, 18 Mar 2017 12:31:32 +0000 (12:31 +0000)]
Revert "Modules: Cache PCMs in memory and avoid a use-after-free"

This reverts commit r298165, as it broke the ARM builds.

llvm-svn: 298185

7 years agoExecutionDepsFix: Let targets specialize the pass; NFC
Matthias Braun [Sat, 18 Mar 2017 05:08:58 +0000 (05:08 +0000)]
ExecutionDepsFix: Let targets specialize the pass; NFC

Let targets specialize the pass with the register class so we can get a
parameterless default constructor and can put the pass into the pass
registry to enable testing with -run-pass=.

llvm-svn: 298184

7 years agoExecutionDepsFix: Normalize names; NFC
Matthias Braun [Sat, 18 Mar 2017 05:05:40 +0000 (05:05 +0000)]
ExecutionDepsFix: Normalize names; NFC

Normalize ExeDepsFix, execution-fix, ExecutionDependencyFix and
ExecutionDepsFix to the last one.

llvm-svn: 298183

7 years agoCodeGen.cpp: Sort alphabetically; NFC
Matthias Braun [Sat, 18 Mar 2017 05:05:32 +0000 (05:05 +0000)]
CodeGen.cpp: Sort alphabetically; NFC

llvm-svn: 298182

7 years agoInitializePasses.h: Cleanup; NFC
Matthias Braun [Sat, 18 Mar 2017 05:05:29 +0000 (05:05 +0000)]
InitializePasses.h: Cleanup; NFC

- Sort alphabetically
- Normalize spaces

llvm-svn: 298181

7 years ago[ValueTracking] Add APInt::setSignBit and use it to replace ORing with getSignBit...
Craig Topper [Sat, 18 Mar 2017 04:01:29 +0000 (04:01 +0000)]
[ValueTracking] Add APInt::setSignBit and use it to replace ORing with getSignBit which will malloc if the bit width is larger than 64.

llvm-svn: 298180

7 years agoMake library calls sensitive to regparm module flag (Fixes PR3997).
Nirav Dave [Sat, 18 Mar 2017 00:44:07 +0000 (00:44 +0000)]
Make library calls sensitive to regparm module flag (Fixes PR3997).

Reviewers: mkuper, rnk

Subscribers: mehdi_amini, jyknight, aemerson, llvm-commits, rengolin

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

llvm-svn: 298179

7 years agoCapitalize ArgListEntry fields. NFC.
Nirav Dave [Sat, 18 Mar 2017 00:43:57 +0000 (00:43 +0000)]
Capitalize ArgListEntry fields. NFC.

llvm-svn: 298178

7 years ago[X86] Add NumRegisterParameters Module Flag.
Nirav Dave [Sat, 18 Mar 2017 00:43:39 +0000 (00:43 +0000)]
[X86] Add NumRegisterParameters Module Flag.

Reviewers: rnk, mkuper

Subscribers: llvm-commits

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

llvm-svn: 298177

7 years ago[LockFileManager] Reduce lock timeout
Bruno Cardoso Lopes [Sat, 18 Mar 2017 00:32:34 +0000 (00:32 +0000)]
[LockFileManager] Reduce lock timeout

Go back to behavior pre-r231309 and reduce the timeout from 8 to ~1.5
min now that we have (a) PCMCache mechanism (r298165) and (b) timeout
that doesn't cause a failure, but actually build the module (r298175).

rdar://problem/30297862

llvm-svn: 298176

7 years ago[Modules] In case of lock timeout, fallback and build module
Bruno Cardoso Lopes [Sat, 18 Mar 2017 00:26:18 +0000 (00:26 +0000)]
[Modules] In case of lock timeout, fallback and build module

Duncan's r298165 introduced the PCMCache mechanism, which guarantees
that locks aren't necessary anymore for correctness but only for
performance, by avoiding building it twice when possible.

Change the logic to avoid an error but actually build the module in case
the timeout happens. Instead of an error, still emit a remark for
debugging purposes.

rdar://problem/30297862

llvm-svn: 298175

7 years agoFix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.
Evgeniy Stepanov [Sat, 18 Mar 2017 00:25:43 +0000 (00:25 +0000)]
Fix sanitizer tests with LLVM_TOOL_LLD_BUILD=OFF.

Only depend on LLD if it is going to be built.

llvm-svn: 298174

7 years ago[asan] Remove gc-sections test with bfd.
Evgeniy Stepanov [Sat, 18 Mar 2017 00:25:40 +0000 (00:25 +0000)]
[asan] Remove gc-sections test with bfd.

It used to be XFAIL: *, but with the new implementation it passes in some cases
and fails in other. There are similar tests for gold and lld that are not
flaky, and a positive test for bfd that makes sure that were are not breaking
existing functionality.

llvm-svn: 298173

7 years ago[AMDGPU] Add address space based alias analysis pass
Stanislav Mekhanoshin [Fri, 17 Mar 2017 23:56:58 +0000 (23:56 +0000)]
[AMDGPU] Add address space based alias analysis pass

This is direct port of HSAILAliasAnalysis pass, just cleaned for
style and renamed.

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

llvm-svn: 298172

7 years ago[BuildLibCalls] emitPutChar should infer function attributes for putchar
Craig Topper [Fri, 17 Mar 2017 23:48:02 +0000 (23:48 +0000)]
[BuildLibCalls] emitPutChar should infer function attributes for putchar

When InstCombine calls into SimplifyLibCalls and it createa putChar calls, we don't infer the attributes. And since SimplifyLibCalls doesn't use InstCombine's IRBuilder the calls doesn't end up in the worklist on this iteration of InstCombine. So it gets picked up on the next iteration where it causes an IR change. This of course causes InstCombine to run another iteration.

So this patch just gets the attributes right the first time. We already did this for puts and some other libcalls.

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

llvm-svn: 298171

7 years ago[index] For C++ constructors/destructors, add references to the parent type where...
Argyrios Kyrtzidis [Fri, 17 Mar 2017 23:41:59 +0000 (23:41 +0000)]
[index] For C++ constructors/destructors, add references to the parent type where its name appears in definitions and declarations

Patch by Nathan Hawes!
https://reviews.llvm.org/D30730

llvm-svn: 298170

7 years ago[asan] Disable globals-gc test with ld.bfd.
Evgeniy Stepanov [Fri, 17 Mar 2017 23:40:50 +0000 (23:40 +0000)]
[asan] Disable globals-gc test with ld.bfd.

Fails on clang-cmake-armv7-a15-full.

llvm-svn: 298169

7 years agoCompute Config member function return values only once.
Rui Ueyama [Fri, 17 Mar 2017 23:29:01 +0000 (23:29 +0000)]
Compute Config member function return values only once.

We had a few Config member functions that returns configuration values.
For example, we had is64() which returns true if the target is 64-bit.
The return values of these functions are constant and never change.

This patch is to compute them only once to make it clear that they'll
never change.

llvm-svn: 298168

7 years agoDefine Config::isLE and Config::wordsize.
Rui Ueyama [Fri, 17 Mar 2017 23:28:41 +0000 (23:28 +0000)]
Define Config::isLE and Config::wordsize.

isLE() return true if the target is little-endian.
wordsize() returns 8 for 64-bit and 4 for 32-bit.

llvm-svn: 298167

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 17 Mar 2017 23:04:18 +0000 (23:04 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 298166

7 years agoModules: Cache PCMs in memory and avoid a use-after-free
Duncan P. N. Exon Smith [Fri, 17 Mar 2017 22:55:13 +0000 (22:55 +0000)]
Modules: Cache PCMs in memory and avoid a use-after-free

Clang's internal build system for implicit modules uses lock files to
ensure that after a process writes a PCM it will read the same one back
in (without contention from other -cc1 commands).  Since PCMs are read
from disk repeatedly while invalidating, building, and importing, the
lock is not released quickly.  Furthermore, the LockFileManager is not
robust in every environment.  Other -cc1 commands can stall until
timeout (after about eight minutes).

This commit changes the lock file from being necessary for correctness
to a (possibly dubious) performance hack.  The remaining benefit is to
reduce duplicate work in competing -cc1 commands which depend on the
same module.  Follow-up commits will change the internal build system to
continue after a timeout, and reduce the timeout.  Perhaps we should
reconsider blocking at all.

This also fixes a use-after-free, when one part of a compilation
validates a PCM and starts using it, and another tries to swap out the
PCM for something new.

The PCMCache is a new type called MemoryBufferCache, which saves memory
buffers based on their filename.  Its ownership is shared by the
CompilerInstance and ModuleManager.

  - The ModuleManager stores PCMs there that it loads from disk, never
    touching the disk if the cache is hot.

  - When modules fail to validate, they're removed from the cache.

  - When a CompilerInstance is spawned to build a new module, each
    already-loaded PCM is assumed to be valid, and is frozen to avoid
    the use-after-free.

  - Any newly-built module is written directly to the cache to avoid the
    round-trip to the filesystem, making lock files unnecessary for
    correctness.

Original patch by Manman Ren; most testcases by Adrian Prantl!

llvm-svn: 298165

7 years ago[x86] regenerate checks; NFC
Sanjay Patel [Fri, 17 Mar 2017 22:47:21 +0000 (22:47 +0000)]
[x86] regenerate checks; NFC

llvm-svn: 298164

7 years agoFix docs-llvm-html build.
Evgeniy Stepanov [Fri, 17 Mar 2017 22:31:13 +0000 (22:31 +0000)]
Fix docs-llvm-html build.

llvm-svn: 298163

7 years ago[Outliner] Add outliner for AArch64
Jessica Paquette [Fri, 17 Mar 2017 22:26:55 +0000 (22:26 +0000)]
[Outliner] Add outliner for AArch64

This commit adds the necessary target hooks for outlining in AArch64. It also
refactors the switch statement used in `getMemOpBaseRegImmOfsWidth` into a
more general function, `getMemOpInfo`. This allows the outliner to share that
code without copying and pasting it.

The AArch64 outliner can be run using -mllvm -enable-machine-outliner, as with
the X86-64 outliner.

The test for this pass verifies that the outliner does, in fact outline
functions, fixes up the stack accesses properly, and can correctly generate a
tail call. In the future, this test should be replaced with a MIR test, so that
we can properly test immediate offset overflows in fixed-up instructions.

llvm-svn: 298162

7 years ago[SCEV] Use const Loop *L instead of Loop *L. NFC
Eli Friedman [Fri, 17 Mar 2017 22:19:52 +0000 (22:19 +0000)]
[SCEV] Use const Loop *L instead of Loop *L. NFC

Use const pointer in the trip count and trip multiple calculations.

Patch by Huihui Zhang <huihuiz@codeaurora.org>

llvm-svn: 298161

7 years ago[Sema] Unbreak GCC -Werror build (enum compare).
Davide Italiano [Fri, 17 Mar 2017 22:19:20 +0000 (22:19 +0000)]
[Sema] Unbreak GCC -Werror build (enum compare).

llvm-svn: 298160

7 years ago[asan] Fix dead stripping of globals on Linux (compiler-rt)
Evgeniy Stepanov [Fri, 17 Mar 2017 22:17:38 +0000 (22:17 +0000)]
[asan] Fix dead stripping of globals on Linux (compiler-rt)

Runtime support for the new instrumentation of globals based on !associated, and a bunch of tests.

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

llvm-svn: 298159

7 years ago[asan] Fix dead stripping of globals on Linux.
Evgeniy Stepanov [Fri, 17 Mar 2017 22:17:29 +0000 (22:17 +0000)]
[asan] Fix dead stripping of globals on Linux.

Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).

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

llvm-svn: 298158

7 years agoAdd !associated metadata.
Evgeniy Stepanov [Fri, 17 Mar 2017 22:17:24 +0000 (22:17 +0000)]
Add !associated metadata.

This is an ELF-specific thing that adds SHF_LINK_ORDER to the global's section
pointing to the metadata argument's section. The effect of that is a reverse dependency
between sections for the linker GC.

!associated does not change the behavior of global-dce. The global
may also need to be added to llvm.compiler.used.

Since SHF_LINK_ORDER is per-section, !associated effectively enables
fdata-sections for the affected globals, the same as comdats do.

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

llvm-svn: 298157

7 years ago[SelectionDAG] Remove redundant stores more aggressively.
Eli Friedman [Fri, 17 Mar 2017 22:15:50 +0000 (22:15 +0000)]
[SelectionDAG] Remove redundant stores more aggressively.

Handle TokenFactors more aggressively in
SDValue::reachesChainWithoutSideEffects.  This isn't really a
very effective change anymore because of other changes to
chain handling, but it's a cheap check, and the expanded
comments are still useful.

It might be possible to loosen the hasOneUse() requirement with a
deeper analysis, but a naive implementation of that check would be
expensive.

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

llvm-svn: 298156

7 years agoELF: Change check(Expected<T>, const Twine &) to call toString instead of converting...
Peter Collingbourne [Fri, 17 Mar 2017 22:06:36 +0000 (22:06 +0000)]
ELF: Change check(Expected<T>, const Twine &) to call toString instead of converting to an error code.

llvm-svn: 298155

7 years ago[ELF] Restore GC handling of LINK_ORDER, C-named sections.
Evgeniy Stepanov [Fri, 17 Mar 2017 22:04:52 +0000 (22:04 +0000)]
[ELF] Restore GC handling of LINK_ORDER, C-named sections.

__start_xxx symbol keeps section xxx alive only if it is not
SHF_LINK_ORDER. Such sections can be used for user metadata, when
__start_xxx is used to iterate over section contents at runtime, and
the liveness is determined solely by the linked (associated) section.

This was earlier implemented in r294592, and broken in r296723.

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

llvm-svn: 298154

7 years agoLTO: Work around libstdc++ version mismatch bug, see D31063 review thread.
Peter Collingbourne [Fri, 17 Mar 2017 21:49:09 +0000 (21:49 +0000)]
LTO: Work around libstdc++ version mismatch bug, see D31063 review thread.

llvm-svn: 298127

7 years agoImplement DR 373 "Lookup on namespace qualified name in using-directive"
Matthias Gehre [Fri, 17 Mar 2017 21:41:20 +0000 (21:41 +0000)]
Implement DR 373 "Lookup on namespace qualified name in using-directive"

Summary:
3.4.6 [basic.lookup.udir] paragraph 1:
In a using-directive or namespace-alias-definition, during the lookup for a namespace-name or for a name in a nested-name-specifier, only namespace names are considered.

Reviewers: rsmith, aaron.ballman

Subscribers: cfe-commits

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

llvm-svn: 298126

7 years agoAMDGPU: Fix broken condition in hazard recognizer
Matt Arsenault [Fri, 17 Mar 2017 21:36:28 +0000 (21:36 +0000)]
AMDGPU: Fix broken condition in hazard recognizer

Fixes bug 32248.

llvm-svn: 298125

7 years agorecommend using llvm-ar when finding undefined references and empty archives
Bob Haarman [Fri, 17 Mar 2017 21:32:49 +0000 (21:32 +0000)]
recommend using llvm-ar when finding undefined references and empty archives

Summary:
When we perform LTO builds with a version of ar that does not
understand LLVM bitcode objects, we end up with undefined references,
because our archive files do not list the bitcode symbols in their
indices. The error messages do not make it clear what the real problem
is. This change adds a note that points out the likely problem and
solution. It is similar in spirit to r282633, but aims to avoid false
positives by only triggering when we see both undefined references and
archives without symbols in their indices.

Fixes PR32281.

Reviewers: davide, ruiu, tejohnson

Subscribers: llvm-commits

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

llvm-svn: 298124

7 years agoallow for specification of compiler/lldb executables basename
Tim Hammerquist [Fri, 17 Mar 2017 21:00:35 +0000 (21:00 +0000)]
allow for specification of compiler/lldb executables basename

llvm-svn: 298123

7 years ago[coverity] Fix uninit variable.
Vassil Vassilev [Fri, 17 Mar 2017 20:58:08 +0000 (20:58 +0000)]
[coverity] Fix uninit variable.

Patch by John Harvey!

llvm-svn: 298122

7 years agoAMDGPU: Fix handling of constant phi input loop conditions
Matt Arsenault [Fri, 17 Mar 2017 20:52:21 +0000 (20:52 +0000)]
AMDGPU: Fix handling of constant phi input loop conditions

If the loop condition was an i1 phi with a constantexpr input, this
would add a loop intrinsic fed by a phi dependent on a call to
if.break in the same block. Insert the call in the loop header.

llvm-svn: 298121

7 years ago[PGO] Change the internal options description. nfc.
Rong Xu [Fri, 17 Mar 2017 20:51:44 +0000 (20:51 +0000)]
[PGO] Change the internal options description. nfc.

llvm-svn: 298120

7 years agoAMDGPU: Cleanup control flow intrinsics
Matt Arsenault [Fri, 17 Mar 2017 20:41:45 +0000 (20:41 +0000)]
AMDGPU: Cleanup control flow intrinsics

Move backend internal intrinsics along with the rest of the
normal intrinsics, and use the Intrinsic::getDeclaration
API instead of manually constructing the type list.

It's surprising this was working before. fdiv.fast had
the wrong number of parameters. The control flow intrinsic
declaration attributes were not being applied, and
their types were inconsistent. The actual IR use types
did not match the declaration, and were closer to the
types used for the patterns. The brcond lowering
was changing the types, so introduce new nodes for those.

llvm-svn: 298119

7 years ago[x86] clean up setcc with negated operand transform and add missing test; NFCI
Sanjay Patel [Fri, 17 Mar 2017 20:29:40 +0000 (20:29 +0000)]
[x86] clean up setcc with negated operand transform and add missing test; NFCI

llvm-svn: 298118

7 years ago[ubsan] Add e2e test for -fsanitize=nullability
Vedant Kumar [Fri, 17 Mar 2017 20:27:33 +0000 (20:27 +0000)]
[ubsan] Add e2e test for -fsanitize=nullability

llvm-svn: 298117

7 years ago[X86] Emit fewer instructions to allocate >16GB stack frames
Reid Kleckner [Fri, 17 Mar 2017 20:25:49 +0000 (20:25 +0000)]
[X86] Emit fewer instructions to allocate >16GB stack frames

Summary:
Use this code pattern when RAX is live, instead of emitting up to 2
billion adjustments:
  pushq %rax
  movabsq +-$Offset+-8, %rax
  addq %rsp, %rax
  xchg %rax, (%rsp)
  movq (%rsp), %rsp

Try to clean this code up a bit while I'm here. In particular, hoist the
logic that handles the entire adjustment with `movabsq $imm, %rax` out
of the loop.

This negates the offset in the prologue and uses ADD because X86 only
has a two operand subtract which always subtracts from the destination
register, which can no longer be RSP.

Fixes PR31962

Reviewers: majnemer, sdardis

Subscribers: llvm-commits

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

llvm-svn: 298116

7 years ago[PGO] Add omitted test cases.
Rong Xu [Fri, 17 Mar 2017 20:05:13 +0000 (20:05 +0000)]
[PGO] Add omitted test cases.

llvm-svn: 298115

7 years ago[CodeGenPrep]Restructure promoting Ext to form ExtLoad
Jun Bum Lim [Fri, 17 Mar 2017 19:05:21 +0000 (19:05 +0000)]
[CodeGenPrep]Restructure promoting Ext to form ExtLoad

Summary:
Instead of just looking for a load which is mergable with Ext to form ExtLoad, trying to promote Exts as long as the cost is acceptable. This change is not a NFC as it continue promoting Exts even after finding a load during promotions; the change in arm64-codegen-prepare-extload.ll described in 2.b might show the case.
This change was motivated from D26524.  Based on this change, I will move the transformation performed in aarch64-type-promotion into CGP.

Reviewers: jmolloy, qcolombet, mcrosier, javed.absar

Reviewed By: qcolombet

Subscribers: rengolin, llvm-commits, aemerson

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

llvm-svn: 298114

7 years agoResubmit r295469 [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write
Rong Xu [Fri, 17 Mar 2017 18:41:33 +0000 (18:41 +0000)]
Resubmit r295469 [PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write

And also r295364 [PGO] remove unintended debug trace. NFC
I removed the test case: it's hard to write synchronized test b/w processes
in this framework. I will revisit the test-case later.

llvm-svn: 298113

7 years agoexecutables should be validated before spawning subprocesses
Tim Hammerquist [Fri, 17 Mar 2017 18:10:58 +0000 (18:10 +0000)]
executables should be validated before spawning subprocesses

dotest.py script doesn't validate executables passed on the command line
before spawning dozens of subprocesses, all of which fail silently,
leaving an empty results file.

We should validate the lldb and compiler executables on
configuration, aborting when given invalid paths, to prevent numerous,
cryptic, and spurious failures.

<rdar://problem/31117272>

llvm-svn: 298111