OSDN Git Service

android-x86/external-llvm.git
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298212 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298211 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298210 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298209 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298207 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298204 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298201 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298199 91177308-0d34-0410-b5e6-96231b3b80d8

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)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298198 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298191 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298190 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298188 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298187 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298186 91177308-0d34-0410-b5e6-96231b3b80d8

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=.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298184 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298183 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298182 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298181 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298180 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298179 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298178 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298176 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298172 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298171 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298166 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298164 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298163 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298162 91177308-0d34-0410-b5e6-96231b3b80d8

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>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298161 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298158 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298157 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298156 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298127 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298125 91177308-0d34-0410-b5e6-96231b3b80d8

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!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298122 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298121 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298120 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298119 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298118 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298116 91177308-0d34-0410-b5e6-96231b3b80d8

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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298115 91177308-0d34-0410-b5e6-96231b3b80d8

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298114 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PGO] Value profile for size of memory intrinsic calls
Rong Xu [Fri, 17 Mar 2017 18:07:26 +0000 (18:07 +0000)]
[PGO] Value profile for size of memory intrinsic calls

This patch annotates the valuesites profile to memory intrinsics.

Differential Revision: http://reviews.llvm.org/D31002

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298110 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Bitcode] Add compatibility test for the 4.0 release
Vedant Kumar [Fri, 17 Mar 2017 17:53:26 +0000 (17:53 +0000)]
[Bitcode] Add compatibility test for the 4.0 release

Fork off compatibility.ll for the 4.0 release. The *.bc file in this
commit was produced using a Release build of the release_40 branch.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298109 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SelectionDAG] Add SelectionDAG.computeKnownBits test support for ISD::ABS
Simon Pilgrim [Fri, 17 Mar 2017 17:45:36 +0000 (17:45 +0000)]
[SelectionDAG] Add SelectionDAG.computeKnownBits test support for ISD::ABS

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298108 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[x86] avoid adc/sbb assert when both sides of add are zexted (PR32316)
Sanjay Patel [Fri, 17 Mar 2017 17:27:31 +0000 (17:27 +0000)]
[x86] avoid adc/sbb assert when both sides of add are zexted (PR32316)

As noted in the comment, we might want to account for this case,
but I didn't look at what that would mean for the asm.

I'm also not sure why this only reproduces with avx512, but I'm
putting a conservative fix in for now to avoid the crash.

Also, if both sides of an add are zexted, shouldn't we shrink that add?

https://bugs.llvm.org/show_bug.cgi?id=32316

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298107 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix wasm build after arg_begin iterator type change
Reid Kleckner [Fri, 17 Mar 2017 17:24:03 +0000 (17:24 +0000)]
Fix wasm build after arg_begin iterator type change

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298106 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoStore Arguments in a flat array instead of an iplist
Reid Kleckner [Fri, 17 Mar 2017 17:16:39 +0000 (17:16 +0000)]
Store Arguments in a flat array instead of an iplist

This saves two pointers from Argument and eliminates some extra
allocations.

Arguments cannot be inserted or removed from a Function because that
would require changing its Type, which LLVM does not allow. Instead,
passes that change prototypes, like DeadArgElim, create a new Function
and copy over argument names and attributes. The primary benefit of
iplist is O(1) random insertion and removal. We just don't need that for
arguments, so don't use it.

Reviewed By: chandlerc

Subscribers: dlj, inglorion, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298105 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoOnly unswitch loops with uniform conditions
Stanislav Mekhanoshin [Fri, 17 Mar 2017 17:13:41 +0000 (17:13 +0000)]
Only unswitch loops with uniform conditions

Loop unswitching can be extremely harmful for a SIMT target. In case
if hoisted condition is not uniform a SIMT machine will execute both
clones of a loop sequentially. Therefor LoopUnswitch checks if the
condition is non-divergent.

Since DivergenceAnalysis adds an expensive PostDominatorTree analysis
not needed for non-SIMT targets a new option is added to avoid unneded
analysis initialization. The method getAnalysisUsage is called when
TargetTransformInfo is not yet available and we cannot use it here.
For that reason a new field DivergentTarget is added to PassManagerBuilder
to control the behavior and set this field from a target.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298104 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Add SelectionDAG.computeKnownBits test showing inability to handle ISD::ABS
Simon Pilgrim [Fri, 17 Mar 2017 16:58:15 +0000 (16:58 +0000)]
[X86] Add SelectionDAG.computeKnownBits test showing inability to handle ISD::ABS

We have to be careful as abs(INT_MIN) == INT_MIN.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298103 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AArch64] Use alias analysis in the load/store optimization pass.
Chad Rosier [Fri, 17 Mar 2017 14:19:55 +0000 (14:19 +0000)]
[AArch64] Use alias analysis in the load/store optimization pass.

This allows the optimization to rearrange loads and stores more aggressively.

Differential Revision: http://reviews.llvm.org/D30903

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298092 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Asm] Don't list '@<type>' in diag when '@' is a comment
Oliver Stannard [Fri, 17 Mar 2017 11:10:17 +0000 (11:10 +0000)]
[Asm] Don't list '@<type>' in diag when '@' is a comment

This fixes https://bugs.llvm.org//show_bug.cgi?id=31280

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298067 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Fix triple format in test branch disassemble test
Andre Vieira [Fri, 17 Mar 2017 09:37:10 +0000 (09:37 +0000)]
[ARM] Fix triple format in test branch disassemble test

Fixing triple format in the tests added for the branch label fix for Thumb
Targets. Also recommitting previously approved patch, see
https://reviews.llvm.org/D30943.

Reviewed by: samparker

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298056 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Make VEX encoded FMA instructions available when AVX512 is enabled regardle...
Craig Topper [Fri, 17 Mar 2017 07:37:31 +0000 (07:37 +0000)]
[AVX-512] Make VEX encoded FMA instructions available when AVX512 is enabled regardless of whether +fma was added on the command line.

We weren't able to handle isel of the 128/256-bit FMA instructions when AVX512F was enabled but VLX and FMA weren't.

I didn't mask FeatureAVX512 imply FeatureFMA as I wasn't sure I wanted disabling FMA to also disable AVX512. Instead we just can't prevent FMA instructions if AVX512 is enabled.

Another option would be to promote 128/256-bit to 512-bit, do the operation and extract it. But that requires a lot of extra isel patterns. Since no CPUs exist that support AVX512, but not FMA just using the VEX instructions seems better.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298051 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Remove unused predicate. NFC
Craig Topper [Fri, 17 Mar 2017 07:37:27 +0000 (07:37 +0000)]
[X86] Remove unused predicate. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298050 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SystemZ] New CodeGen tests for vector compare / select.
Jonas Paulsson [Fri, 17 Mar 2017 07:11:46 +0000 (07:11 +0000)]
[SystemZ]  New CodeGen tests for vector compare / select.

New SystemZ tests for the improved codegen of vector compare and select,
including cases with a logical combination of two compares.

Review: Ulrich Weigand.
https://reviews.llvm.org/D29489

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298049 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd SystemZ to utils/update_llc_test_checks.py.
Jonas Paulsson [Fri, 17 Mar 2017 07:11:42 +0000 (07:11 +0000)]
Add SystemZ to utils/update_llc_test_checks.py.

Extend script for auto-generating CHECK lines so that it works for SystemZ.

This is a pre-commit for the new tests resulting from
https://reviews.llvm.org/D29489

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298048 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SystemZ] Add use of super-reg in splitMove()
Jonas Paulsson [Fri, 17 Mar 2017 06:47:08 +0000 (06:47 +0000)]
[SystemZ]  Add use of super-reg in splitMove()

If one of the subregs of the 128 bit reg is undefined when splitMove() splits
a store into two instructions, a use of an undefined physical register
results.

To remedy this, an implicit use of the super register is added onto both new
instructions, along with propagated kill and undef flags.

This was discovered with llvm-stress, and that test case is attached as
test/CodeGen/SystemZ/splitMove_undefReg_mverifier.ll

Thanks to Matthias Braun for helping with a nice explanation.

Review: Ulrich Weigand

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298047 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[AVX-512] Give priority to EVEX encoded scalar FMA instructions when we have FMA...
Craig Topper [Fri, 17 Mar 2017 06:10:37 +0000 (06:10 +0000)]
[AVX-512] Give priority to EVEX encoded scalar FMA instructions when we have FMA, AVX512 and no VLX.

We were giving priority if VLX was enabled.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298046 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Use update_llc_test_checks.py to regenerate a test and add command lines to...
Craig Topper [Fri, 17 Mar 2017 06:00:01 +0000 (06:00 +0000)]
[X86] Use update_llc_test_checks.py to regenerate a test and add command lines to demonstrate that we don't pick EVEX encoded instruction when AVX512 and FMA3 are both enabled.

This bug only exists on the scalar llvm.fma instrinsics. Looks like we don't test the llvm.fma intrinsics very thoroughly. In fact I don't see any tests for the vector versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298045 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Use update_llc_test_checks.py to regenerate a test.
Craig Topper [Fri, 17 Mar 2017 05:59:57 +0000 (05:59 +0000)]
[X86] Use update_llc_test_checks.py to regenerate a test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298044 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86] Cleanup the AddedComplexity values on move immediate instructions. NFC
Craig Topper [Fri, 17 Mar 2017 05:59:54 +0000 (05:59 +0000)]
[X86] Cleanup the AddedComplexity values on move immediate instructions. NFC

This makes the values a little more consistent between similar instruction and reduces the values some. This results in better grouping in the isel table saving a few bytes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298043 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] inline the code of __sanitizer_cov_trace_pc_guard into it
Kostya Serebryany [Fri, 17 Mar 2017 01:45:15 +0000 (01:45 +0000)]
[libFuzzer] inline the code of __sanitizer_cov_trace_pc_guard into it

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298032 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] Experimenting with dictionary minimization.
Kostya Serebryany [Fri, 17 Mar 2017 01:40:09 +0000 (01:40 +0000)]
[libFuzzer] Experimenting with dictionary minimization.

Summary:
Tracking issue: https://github.com/google/oss-fuzz/issues/331

Reviewers: kcc

Reviewed By: kcc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298031 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libFuzzer] add a test with two different bugs
Kostya Serebryany [Fri, 17 Mar 2017 01:33:16 +0000 (01:33 +0000)]
[libFuzzer] add a test with two different bugs

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298030 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[RSForGC] Handle vector GEPs
Sanjoy Das [Fri, 17 Mar 2017 00:55:53 +0000 (00:55 +0000)]
[RSForGC] Handle vector GEPs

We were not handling getelemenptr instructions of vector type before.
Since getelemenptr instructions for vector types follow the same rule as
getelementptr instructions for non-vector types, we can just handle them
in the same way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298028 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "Make NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]"
Zachary Turner [Fri, 17 Mar 2017 00:46:42 +0000 (00:46 +0000)]
Revert "Make NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]"

For some reason this is causing ANSI color codes to be printed
even when run through FileCheck.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298026 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSplitKit: Correctly implement partial subregister copies
Matthias Braun [Fri, 17 Mar 2017 00:41:39 +0000 (00:41 +0000)]
SplitKit: Correctly implement partial subregister copies

- This fixes a bug where subregister incompatible with the vregs register
  class where used.
- Implement the case where multiple copies are necessary to cover a
  given lanemask.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298025 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoVirtRegMap: Correctly deal with bundles when deleting identity copies.
Matthias Braun [Fri, 17 Mar 2017 00:41:33 +0000 (00:41 +0000)]
VirtRegMap: Correctly deal with bundles when deleting identity copies.

This fixes two problems when VirtRegMap encounters bundles:

- When substituting a vreg subregister def with an actual register the
  internal read flag must be cleared.
- Removing an identity COPY from a bundle needs to use
  removeFromBundle() and a newly introduced function to update
  SlotIndexes.

No testcase here, because none of the in-tree targets trigger this,
however an upcoming commit of mine will need this and the testcase there
will trigger this.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298024 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove LessPreciseFPMADOption from TargetOptions along with all of the
Eric Christopher [Fri, 17 Mar 2017 00:38:03 +0000 (00:38 +0000)]
Remove LessPreciseFPMADOption from TargetOptions along with all of the
associated command line options and functions - it's currently unused
in all of llvm and clang other than being set and reset.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298023 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Use alias analysis in ARMPreAllocLoadStoreOpt.
Eli Friedman [Fri, 17 Mar 2017 00:34:26 +0000 (00:34 +0000)]
[ARM] Use alias analysis in ARMPreAllocLoadStoreOpt.

This allows the optimization to rearrange loads and stores more
aggressively. This doesn't really affect performance, but it helps
codesize.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298021 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoLTO: Fix a potential race condition in the caching API.
Peter Collingbourne [Fri, 17 Mar 2017 00:34:07 +0000 (00:34 +0000)]
LTO: Fix a potential race condition in the caching API.

After the call to sys::fs::exists succeeds, indicating a cache hit, we call
AddFile and the client will open the file using the supplied path. If the
client is using cache pruning, there is a potential race between the pruner
and the client. To avoid this, change the caching API so that it provides
a MemoryBuffer to the client, and have clients use that MemoryBuffer where
possible.

This scheme won't work with the gold plugin because the plugin API expects a
file path. So we have the gold plugin use the buffer identifier as a path and
live with the race for now. (Note that the gold plugin isn't actually affected
by the problem at the moment because it doesn't support cache pruning.)

This effectively reverts r279883 modulo the change to use the existing path
in the gold plugin.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298020 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSmallString doesn't have implicit conversion from const char*.
Zachary Turner [Fri, 17 Mar 2017 00:28:23 +0000 (00:28 +0000)]
SmallString doesn't have implicit conversion from const char*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298019 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDon't rely on an implicit std::tuple constructor.
Zachary Turner [Fri, 17 Mar 2017 00:16:21 +0000 (00:16 +0000)]
Don't rely on an implicit std::tuple constructor.

Apparently it doesn't have one, so using an initializer list
doesn't work correctly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298018 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[pdb] Fix an uninitialized read, and add a test for it.
Zachary Turner [Fri, 17 Mar 2017 00:15:55 +0000 (00:15 +0000)]
[pdb] Fix an uninitialized read, and add a test for it.

This was originally reported in pr32249, uncovered by PTVS-Studio.
There was no code coverage for this path because it was
difficult to construct odd-case PDB files that were not generated
by cl.

Now that we can write construct minimal PDB files from YAML,
it's easy to construct fragments that generate whatever we want.

In this patch I add a test that creates 2 type records.  One
with a unique name, and one without.  I verify that we can go
from PDB to Yaml with no errors.  In a future patch I'd like
to add something like llvm-pdbdump raw -lookup-type that will
just dump one record and nothing else, which should make it
a bit cleaner to find this kind of thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298017 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] It is not an error getting the "Invalid" Annotation opcode.
Zachary Turner [Fri, 17 Mar 2017 00:15:27 +0000 (00:15 +0000)]
[PDB] It is not an error getting the "Invalid" Annotation opcode.

The linker can insert invalid opcodes to indicate padding
bytes, and we should not fail in this case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298016 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclean Lanai namespace
Jacques Pienaar [Thu, 16 Mar 2017 23:22:10 +0000 (23:22 +0000)]
clean Lanai namespace

Summary: This patch cleans the namespace of the Lanai target.

Reviewers: jpienaar

Reviewed By: jpienaar

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298015 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix unit test.
Zachary Turner [Thu, 16 Mar 2017 23:19:40 +0000 (23:19 +0000)]
Fix unit test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298014 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove getArgumentList() in favor of arg_begin(), args(), etc
Reid Kleckner [Thu, 16 Mar 2017 22:59:15 +0000 (22:59 +0000)]
Remove getArgumentList() in favor of arg_begin(), args(), etc

Users often call getArgumentList().size(), which is a linear way to get
the number of function arguments. arg_size(), on the other hand, is
constant time.

In general, the fact that arguments are stored in an iplist is an
implementation detail, so I've removed it from the Function interface
and moved all other users to the argument container APIs (arg_begin(),
arg_end(), args(), arg_size()).

Reviewed By: chandlerc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298010 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove dead F parameter from Argument constructor
Reid Kleckner [Thu, 16 Mar 2017 22:58:56 +0000 (22:58 +0000)]
Remove dead F parameter from Argument constructor

When Function creates its argument list, it does the ilist push_back
itself. No other caller passes in a parent function, so this is dead,
and it uses the soon-to-be-deleted getArgumentList accessor.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298009 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix linux build.
Zachary Turner [Thu, 16 Mar 2017 22:34:18 +0000 (22:34 +0000)]
Fix linux build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298007 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]
Adrian McCarthy [Thu, 16 Mar 2017 22:28:39 +0000 (22:28 +0000)]
Make NativeExeSymbol a concrete subclass of NativeRawSymbol [PDB]

This moves exe symbol-specific method implementations out of NativeRawSymbol
into a concrete subclass. Also adds implementations for hasCTypes and
hasPrivateSymbols and a simple test to ensure the native reader can access
the summary information for the executable from the PDB.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298005 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Support] Support both Windows and Posix paths on both platforms.
Zachary Turner [Thu, 16 Mar 2017 22:28:04 +0000 (22:28 +0000)]
[Support] Support both Windows and Posix paths on both platforms.

Previously which path syntax we supported dependend on what
platform we were compiling LLVM on.  While this is normally
desirable, there are situations where we need to be able to
handle a path that we know was generated on a remote host.
Remote debugging, for example, or parsing debug info.

99% of the code in LLVM for handling paths was platform
agnostic and literally just a few branches were gated behind
pre-processor checks, so this changes those sites to use
runtime checks instead, and adds a flag to every path
API that allows one to override the host native syntax.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298004 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake Argument::getArgNo() constant time, not O(#args)
Reid Kleckner [Thu, 16 Mar 2017 22:25:45 +0000 (22:25 +0000)]
Make Argument::getArgNo() constant time, not O(#args)

getArgNo is actually hot in LLVM, because its how we check for
attributes on arguments:
  bool Argument::hasNonNullAttr() const {
    if (!getType()->isPointerTy()) return false;
    if (getParent()->getAttributes().
          hasAttribute(getArgNo()+1, Attribute::NonNull))
      return true;

It actually shows up as the 23rd hottest leaf function in a 13s sample
of LTO of llc.

This grows Argument by four bytes, but I have another pending patch to
shrink it by removing its ilist_node base.

Reviewed By: chandlerc

Subscribers: inglorion, llvm-commits, mehdi_amini

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298003 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove eol-style:native from Path.h
Zachary Turner [Thu, 16 Mar 2017 22:24:19 +0000 (22:24 +0000)]
Remove eol-style:native from Path.h

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298002 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: BlockPlacement: Adjust test case so it covers rL297925. NFC
Kyle Butt [Thu, 16 Mar 2017 21:33:29 +0000 (21:33 +0000)]
CodeGen: BlockPlacement: Adjust test case so it covers rL297925. NFC

I had ajusted the test case before when testing a chain of length 2, and then
reverted it with rL296845 when I switched to 3 triangles. After running
benchmarks and examining generated code at length 2 I forgot to put the test
back.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298000 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoResubmit r297897: [PGO] Value profile for size of memory intrinsic calls
Rong Xu [Thu, 16 Mar 2017 21:15:48 +0000 (21:15 +0000)]
Resubmit r297897: [PGO] Value profile for size of memory intrinsic calls

R297897 inadvertently enabled annotation for memop profiling. This new patch
fixed it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297996 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSalvage debug info from instructions about to be deleted
Adrian Prantl [Thu, 16 Mar 2017 21:14:09 +0000 (21:14 +0000)]
Salvage debug info from instructions about to be deleted

[Reapplies r297971 and punting on finding a better API for findDbgValues()]

This patch improves debug info quality in InstCombine by looking at
values that are about to be deleted, checking whether there are any
dbg.value instrinsics referring to them, and potentially encoding the
semantics of the deleted instruction into the dbg.value's
DIExpression.

In the example in the testcase (which was extracted from XNU) there is a sequence of

 %4 = load %struct.entry*, %struct.entry** %next2, align 8, !dbg !41
 %5 = bitcast %struct.entry* %4 to i8*, !dbg !42
 %add.ptr4 = getelementptr inbounds i8, i8* %5, i64 -8, !dbg !43
 %6 = bitcast i8* %add.ptr4 to %struct.entry*, !dbg !44
 call void @llvm.dbg.value(metadata %struct.entry* %6, i64 0, metadata !20, metadata !21), !dbg 34

When these instructions are eliminated by instcombine one after
another, we can still salvage the otherwise dead debug info:

- Bitcasts have no effect, so have the dbg.value point to operand(0)
- Loads can be expressed via a DW_OP_deref
- Constant gep instructions can be replaced by DWARF expression arithmetic

The API introduced by this patch is not specific to instcombine and
can be useful in other places, too.

rdar://problem/30725338

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297994 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[LoopUnroll] Don't peel loops where the latch isn't the exiting block
Michael Kuperstein [Thu, 16 Mar 2017 21:07:48 +0000 (21:07 +0000)]
[LoopUnroll] Don't peel loops where the latch isn't the exiting block

Peeling assumed this doesn't happen, but didn't check it.
This fixes PR32178.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297993 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[SCEV] Compute affine range in another way to avoid bitwidth extending.
Michael Zolotukhin [Thu, 16 Mar 2017 21:07:38 +0000 (21:07 +0000)]
[SCEV] Compute affine range in another way to avoid bitwidth extending.

Summary:
This approach has two major advantages over the existing one:
1. We don't need to extend bitwidth in our computations. Extending
bitwidth is a big issue for compile time as we often end up working with
APInts wider than 64bit, which is a slow case for APInt.
2. When we zero extend a wrapped range, we lose some information (we
replace the range with [0, 1 << src bit width)). Thus, avoiding such
extensions better preserves information.

Correctness testing:
I ran 'ninja check' with assertions that the new implementation of
getRangeForAffineAR gives the same results as the old one (this
functionality is not present in this patch). There were several failures
- I inspected them manually and found out that they all are caused by
the fact that we're returning more accurate results now (see bullet (2)
above).
Without such assertions 'ninja check' works just fine, as well as
SPEC2006.

Compile time testing:
CTMark/Os:
 - mafft/pairlocalalign -16.98%
 - tramp3d-v4/tramp3d-v4 -12.72%
 - lencod/lencod -11.51%
 - Bullet/bullet -4.36%
 - ClamAV/clamscan -3.66%
 - 7zip/7zip-benchmark -3.19%
 - sqlite3/sqlite3 -2.95%
 - SPASS/SPASS -2.74%
 - Average -5.81%

Performance testing:
The changes are expected to be neutral for runtime performance.

Reviewers: sanjoy, atrick, pete

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297992 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[WebAssembly] Fix some broken type encodings in wasm binary
Derek Schuff [Thu, 16 Mar 2017 20:49:48 +0000 (20:49 +0000)]
[WebAssembly] Fix some broken type encodings in wasm binary

A recent change switch the in-memory wasm value types
to be signed integers, but I missing a few cases where
these were being writing to the binary.

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

Patch by Sam Clegg

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297991 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSilence -Wcovered-switch-default warning.
Zachary Turner [Thu, 16 Mar 2017 20:45:11 +0000 (20:45 +0000)]
Silence -Wcovered-switch-default warning.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297990 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] avoid breaking up bitcasted vector min/max patterns (PR32306)
Sanjay Patel [Thu, 16 Mar 2017 20:42:45 +0000 (20:42 +0000)]
[InstCombine] avoid breaking up bitcasted vector min/max patterns (PR32306)

As the related tests show, we're not canonicalizing to this form for scalars or vectors yet,
but this solves the immediate problem in:
https://bugs.llvm.org/show_bug.cgi?id=32306

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297989 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoClarify a comment about mapped_iterator. NFC
Jonathan Roelofs [Thu, 16 Mar 2017 20:37:59 +0000 (20:37 +0000)]
Clarify a comment about mapped_iterator. NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297988 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoArchiveWriter: Remove unused variables. NFC.
Peter Collingbourne [Thu, 16 Mar 2017 20:35:07 +0000 (20:35 +0000)]
ArchiveWriter: Remove unused variables. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297987 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[InstCombine] add tests for PR32306 and missed min/max canonicalization; NFC
Sanjay Patel [Thu, 16 Mar 2017 20:31:38 +0000 (20:31 +0000)]
[InstCombine] add tests for PR32306 and missed min/max canonicalization; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297986 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCreate msbuild only when using MSVC
Reid Kleckner [Thu, 16 Mar 2017 20:24:14 +0000 (20:24 +0000)]
Create msbuild only when using MSVC

Summary:
I could be wrong but it seems to have no use for MinGW.

Related diff: https://reviews.llvm.org/D29772

Reviewers: chandlerc, rnk

Reviewed By: rnk

Patch by: Mateusz MikuĊ‚a

Subscribers: rnk, llvm-commits, mgorny

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297985 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[PDB] Add support for parsing Flags from PDB Stream.
Zachary Turner [Thu, 16 Mar 2017 20:19:11 +0000 (20:19 +0000)]
[PDB] Add support for parsing Flags from PDB Stream.

This was discovered when running `llvm-pdbdump diff` against
two files, the second of which was generated by running the
first one through pdb2yaml and then yaml2pdb.

The second one was missing some bytes from the PDB Stream, and
tracking this down showed that at the end of the PDB Stream were
some additional bytes that we were ignoring.  Looking back
to the reference code, these seem to specify some additional
flags that indicate whether the PDB supports various optional
features.

This patch adds support for reading, writing, and round-tripping
these flags through YAML and the raw dumper, and updates the
tests accordingly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297984 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[llvm-pdbdump] Add support for diffing the PDB Stream.
Zachary Turner [Thu, 16 Mar 2017 20:18:41 +0000 (20:18 +0000)]
[llvm-pdbdump] Add support for diffing the PDB Stream.

In doing so I discovered that we completely ignore some bytes
of the PDB Stream after we "finish" loading it.  These bytes
seem to specify some additional information about what kind
of data is present in the PDB.  A subsequent patch will add
code to read in those fields and store their values.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297983 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert commit r297971 because of issues reported by msan.
Adrian Prantl [Thu, 16 Mar 2017 20:11:54 +0000 (20:11 +0000)]
Revert commit r297971 because of issues reported by msan.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297982 91177308-0d34-0410-b5e6-96231b3b80d8