Commit Graph

148142 Commits

Author SHA1 Message Date
Craig Topper
6a61317c63 [APInt] Make behavior of ashr by BitWidth consistent between single and multi word.
Previously single word would always return 0 regardless of the original sign. Multi word would return all 0s or all 1s based on the original sign. Now single word takes into account the sign as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301159 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 05:38:26 +00:00
Frederich Munch
ccb223e38e Revert "Refactor DynamicLibrary so searching for a symbol will have a defined order.”
The changes are causing the i686-mingw32 build to fail.

This reverts commit r301153, and the changes for a separate warning on i686-mingw32 in r301155  and r301156.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301157 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 03:33:30 +00:00
Frederich Munch
bffb4d4e84 Fix warning converting from boolean to pointer introduced in r301153.
This reverts commit r301155, which was incorrect.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301156 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 03:12:16 +00:00
Frederich Munch
478f822a4d Fix warning converting from void* to boolean introduced in r301153.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301155 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 02:51:40 +00:00
Sanjoy Das
86b13b4b4f Revert "[SCEV] Enable SCEV verification by default in EXPENSIVE_CHECKS builds"
This reverts commit r301150.  It breaks CodeGen/Hexagon/hwloop-wrap2.ll, reverting
while I investigate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301154 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 02:35:19 +00:00
Frederich Munch
545de00b4b Refactor DynamicLibrary so searching for a symbol will have a defined order and
libraries are properly unloaded when llvm_shutdown is called.

Summary:
This was mostly affecting usage of the JIT, where storing the library handles in
a set made iteration unordered/undefined. This lead to disagreement between the
JIT and native code as to what the address and implementation of particularly on
Windows with stdlib functions:

JIT: putenv_s("TEST", "VALUE") // called msvcrt.dll, putenv_s
JIT: getenv("TEST") -> "VALUE" // called msvcrt.dll, getenv
Native: getenv("TEST") -> NULL // called ucrt.dll, getenv

Also fixed is the issue of DynamicLibrary::getPermanentLibrary(0,0) on Windows
not giving priority to the process' symbols as it did on Unix.

Reviewers: chapuni, v.g.vassilev, lhames

Reviewed By: lhames

Subscribers: danalbert, srhines, mgorny, vsk, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301153 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 02:30:12 +00:00
Lang Hames
dd358f5cfd [Orc] Fix a warning by removing an unused lambda capture.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301152 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 01:21:23 +00:00
Sanjoy Das
0e8cd85fc0 Fix unused variables / fields warnings in release builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301151 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 00:46:40 +00:00
Sanjoy Das
57106e7963 [SCEV] Enable SCEV verification by default in EXPENSIVE_CHECKS builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301150 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 00:41:58 +00:00
Sanjoy Das
de62d73fb7 [SCEV] Fix exponential time complexity by caching
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301149 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 00:09:46 +00:00
Xinliang David Li
0cb27bba3d [PartialInine]: add triaging options
There are more bugs (runtime failures) triggered when partial
inlining is turned on. Add options to help triaging problems.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301148 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 23:39:04 +00:00
Lang Hames
1936b28dbf [Orc] Use recursive mutexes for Error serialization.
Errors can be nested, so we need recursive locking for serialization /
deserialization.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301147 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 23:36:13 +00:00
Sanjoy Das
0f49a66c42 [SCEV] Move towards a verifier without false positives
This change reboots SCEV's current (off by default) verification logic
to avoid false failures.  Instead of stringifying trip counts, it maps
old and new trip counts to the same ScalarEvolution "universe" and
asks ScalarEvolution to compute the difference between them.  If the
difference comes out to be a non-zero constant, then (barring some
corner cases) we *know* we messed up.

I've not yet enabled this by default since it hits an exponential time
issue in SCEV, but once I fix that, I'll flip it on by default in
EXPENSIVE_CHECKS builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301146 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 23:04:45 +00:00
Simon Pilgrim
84468c22d8 [X86][AVX] Add scheduling latency/throughput tests for some AVX1 instructions
More instructions will be added in future commits

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301145 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 22:08:17 +00:00
Sanjay Patel
f7a9048833 [InstCombine] add/move folds for [not]-xor
We handled all of the commuted variants for plain xor already,
although they were scattered around and sometimes folded less
efficiently using distributive laws. We had no folds for not-xor.

Handling all of these patterns consistently is part of trying to 
reinstate:
https://reviews.llvm.org/rL300977


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301144 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 22:00:02 +00:00
Xinliang David Li
33d67f1348 [PartialInlining] Add optimization remark support
Differential Revision: http://reviews.llvm.org/D32387


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301143 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 21:40:58 +00:00
Simon Pilgrim
4396307c0e [X86][SSE] Add scheduler class support for SSE42 (PCMPGT) instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301142 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 21:23:27 +00:00
Simon Pilgrim
f8b00dbd59 [X86][SSE] Add scheduling latency/throughput tests for (most) SSE42 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301141 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 21:00:25 +00:00
Sanjay Patel
0acacafc71 [InstCombine] add tests for not-xor and remove redundant tests; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301140 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 20:59:00 +00:00
Xin Tong
fcc344502c [JumpThread] We want to fold (not thread) when all predecessor go to single BB's successor.
Summary:
In case all predecessor go to a single successor of current BB. We want to fold (not thread).

I failed to update the phi nodes properly in the last patch https://reviews.llvm.org/rL300657.

Phi nodes values are per predecessor in LLVM.

Reviewers: sanjoy

Reviewed By: sanjoy

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301139 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 20:56:29 +00:00
Simon Pilgrim
53cfa60675 [X86][SSE] Add scheduling latency/throughput tests for (most) SSE41 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301137 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 20:05:21 +00:00
Simon Pilgrim
83ffc6f261 [X86][SSE] Add missing scheduling latency/throughput test for PINSRW
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301136 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 19:56:49 +00:00
Xin Tong
e8f5facb2f Correct grammar. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301135 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 17:36:25 +00:00
Craig Topper
35b7a4d2d5 [APInt] Make clearUnusedBits branch free.
This makes the WordBits calculation calculate a value between 1 and 64 for the number of bits in the last word. Previously if the BitWidth was a multiple of 64 bits the WordBits value was 0 and we had to bail out early to avoid an undefined shift. Now with a value of 64 we no longer have an undefined shift issue.

This shows a 15-16k reduction in the size of the opt binary on my local x86-64 build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301134 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 17:16:26 +00:00
Craig Topper
7271492c50 [APInt] In sext single word case, use SignExtend64 and let the APInt constructor mask off any excess bits.
The current code is trying to be clever with shifts to avoid needing to clear unused bits. But it looks like the compiler is unable to optimize out the unused bit handling in the APInt constructor. Given this its better to just use SignExtend64 and have more readable code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301133 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 17:16:24 +00:00
Sanjay Patel
a1e90f27e3 [InstCombine] add tests for or-to-xor; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301131 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 16:37:36 +00:00
Sanjay Patel
1261555bf5 [InstCombine] add pattern matches for commuted variants of xor-to-xor
There's probably some better way to write this that eliminates the
code duplication without hurting readability, but at least this
eliminates the logic holes and is hopefully slightly more efficient
than creating new instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301129 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 16:03:00 +00:00
Sanjay Patel
a3562830e9 [InstCombine] add tests for xor-to-xor; NFC
Besides missing 2 commuted patterns, the way we handle these folds is inefficient.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301128 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 14:51:03 +00:00
Simon Pilgrim
a7edbb9c32 [X86][SSE] Add scheduling latency/throughput tests for SSSE3 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301127 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 14:01:55 +00:00
Simon Pilgrim
34a2ffb384 [X86][SSE] Add scheduling latency/throughput tests for SSE3 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301126 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 13:59:29 +00:00
Sanjay Patel
0e32427e0a [InstCombine] add tests for add-to-xor commuted variants; NFC
1 out of the 4 tests commuted the operands, so there's an asymmetry
somewhere under this in how we handle these transforms.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301125 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 13:37:05 +00:00
Renato Golin
d907744fff Revert "[APInt] Fix a few places that use APInt::getRawData to operate within the normal API."
This reverts commit r301105, 4, 3 and 1, as a follow up of the previous
revert, which broke even more bots.

For reference:
Revert "[APInt] Use operator<<= where possible. NFC"
Revert "[APInt] Use operator<<= instead of shl where possible. NFC"
Revert "[APInt] Use ashInPlace where possible."

PR32754.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301111 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 12:15:30 +00:00
Renato Golin
ea7650c4ed Revert "[APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug in the shift by BitWidth handling."
This reverts commit r301094, as it broke all ARM self-hosting bots.

PR32754.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301110 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 12:02:07 +00:00
Ayman Musa
af17b264e1 [X86][MPX] Add load & store instructions of bnd values to getLoadStoreRegOpcode function.
This is needed for a follow up patch that generates the memory folding tables.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301109 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 08:28:42 +00:00
Ayman Musa
e67d6dd3e8 [X86] Convert test checks to generated checks of update_llc_test_checks.py. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301107 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 07:41:40 +00:00
Artyom Skrobov
2a7f4178e4 [ARM] ScheduleDAGRRList::DelayForLiveRegsBottomUp must consider OptionalDefs
Summary:
D30400 has enabled tADC and tSBC instructions to be unglued, thereby allowing CPSR to remain live between Thumb1 scheduling units.

Most Thumb1 instructions have an OptionalDef for CPSR; but the scheduler ignored the OptionalDefs, and could unwittingly insert a flag-setting instruction in between an ADDS and the corresponding ADC.

Reviewers: javed.absar, atrick, MatzeB, t.p.northover, jmolloy, rengolin

Reviewed By: javed.absar

Subscribers: rogfer01, efriedma, aemerson, rengolin, llvm-commits, MatzeB

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301106 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 06:58:08 +00:00
Craig Topper
aeda136605 [APInt] Fix a few places that use APInt::getRawData to operate within the normal API.
getRawData exposes the internal type of the APInt class directly to its users. Ideally we wouldn't expose such an implementation detail.

This patch fixes a few of the easy cases by using truncate, extract, or a rotate.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301105 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 06:41:11 +00:00
Craig Topper
e3ba850127 [APInt] Use operator<<= where possible. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301104 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 05:43:02 +00:00
Craig Topper
5e17d2e85c [APInt] Use operator<<= instead of shl where possible. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301103 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 05:18:31 +00:00
Davide Italiano
49f1a751ec [ThinLTO/Summary] Rename anonymous globals as last action ...
... in the per-TU -O0 pipeline.
The problem is that there could be passes registered using
`addExtensionsToPM()` introducing unnamed globals.
Asan is an example, but there may be others. Building cppcheck
with `-flto=thin` and `-fsanitize=address` triggers an assertion
while we're reading bitcode (in lib/LTO), as the BitcodeReader
assumes there are no unnamed globals (because the namer has run).
Unfortunately I wasn't able to find an easy way to test this.
I added a comment in the hope nobody moves this again.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301102 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 04:49:34 +00:00
Craig Topper
1ea7b69466 [APInt] Use ashInPlace where possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301101 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 03:45:59 +00:00
Adrian Prantl
b48f5b7b50 Revert "Use DW_OP_stack_value when reconstructing variable values with arithmetic."
This reverts commit r301093 while investigating stage2 bot breakage.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301099 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-23 00:44:40 +00:00
Jonathan Roelofs
5807fd2aba Fix testcase: s/CHECKNEXT/CHECK-NEXT/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301098 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 23:43:44 +00:00
Sanjay Patel
7c9ed78e22 [InstCombine] clean up tests and regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301097 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 23:36:47 +00:00
Craig Topper
0d0472f857 [APInt] Add ashrInPlace method and implement ashr using it. Also fix a bug in the shift by BitWidth handling.
For single word, shift by BitWidth was always returning 0, but for multiword it was based on original sign. Now single word matches multi word.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301094 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 22:00:03 +00:00
Adrian Prantl
702614a330 Use DW_OP_stack_value when reconstructing variable values with arithmetic.
When the location description of a source variable involves arithmetic
on the value itself, it needs to be marked with DW_OP_stack_value since it
is not describing the variable's location, but rather its value.

This is a follow-up to r297971 and fixes the source testcase quoted in
the comment in debuginfo-dce.ll.

rdar://problem/30725338

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301093 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 20:54:06 +00:00
Simon Pilgrim
14a80cdb01 [X86] Regenerate TLS tests
Use the correct check prefix for X86/X32/X64 target types.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301092 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 20:13:58 +00:00
Craig Topper
e14494685b [APInt] Remove unnecessary min with BitWidth from countTrailingOnesSlowCase.
The unused upper bits are guaranteed to be 0 so we don't need to worry about accidentally counting them.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301091 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 19:59:11 +00:00
Xinliang David Li
db0b3ce4eb [PartialInlining] Using existing hasAddressTaken interface to legality check/NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301090 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 19:24:19 +00:00
Sanjay Patel
56bf04cfa4 [InstCombine] use 'match' to reduce code; NFCI
The later uses of dyn_castNotVal in this block are either
incomplete (doesn't handle vector constants) or overstepping
(shouldn't handle constants at all), but this first use is
just unnecessary. 'I' is obviously not a constant, and it 
can't be a not-of-a-not because that would already be
instsimplified.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301088 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-22 18:05:35 +00:00