Asiri Rathnayake [Mon, 19 Oct 2015 11:44:24 +0000 (11:44 +0000)]
Fix mapping of @llvm.arm.ssat/usat intrinsics to ssat/usat instructions
The mapping of these two intrinsics in ARMInstrInfo.td had a small
omission which lead to their operands not being validated/transformed
before being lowered into usat and ssat instructions. This can cause
incorrect instructions to be emitted.
I've also added tests for the remaining two saturating arithmatic
intrinsics @llvm.arm.qadd and @llvm.arm.qsub as they are missing
codegen tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250697
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Mon, 19 Oct 2015 08:54:59 +0000 (08:54 +0000)]
[GlobalsAA] Fix a really horrible iterator invalidation bug
We were keeping a reference to an object in a DenseMap then mutating it. At the end of the function we were attempting to clone that reference into other keys in the DenseMap, but DenseMap may well decide to resize its hashtable which would invalidate the reference!
It took an extremely complex testcase to catch this - many thanks to Zhendong Su for catching it in PR25225.
This fixes PR25225.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250692
91177308-0d34-0410-b5e6-
96231b3b80d8
Elena Demikhovsky [Mon, 19 Oct 2015 07:43:38 +0000 (07:43 +0000)]
Removed parameter "Consecutive" from isLegalMaskedLoad() / isLegalMaskedStore().
Originally I planned to use the same interface for masked gather/scatter and set isConsecutive to "false" in this case.
Now I'm implementing masked gather/scatter and see that the interface is inconvenient. I want to add interfaces isLegalMaskedGather() / isLegalMaskedScatter() instead of using the "Consecutive" parameter in the existing interfaces.
Differential Revision: http://reviews.llvm.org/D13850
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250686
91177308-0d34-0410-b5e6-
96231b3b80d8
Zlatko Buljan [Mon, 19 Oct 2015 07:16:26 +0000 (07:16 +0000)]
[mips][microMIPS] Implement ADDQ.PH, ADDQ_S.W, ADDQH.PH, ADDQH.W, ADDSC, ADDU.PH, ADDU_S.QB, ADDWC and ADDUH.QB instructions
Differential Revision: http://reviews.llvm.org/D13130
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250685
91177308-0d34-0410-b5e6-
96231b3b80d8
Zlatko Buljan [Mon, 19 Oct 2015 06:34:44 +0000 (06:34 +0000)]
[mips][microMIPS] Implement ABSQ.QB, ABSQ_S.PH, ABSQ_S.W, ABSQ_S.QB, INSV, MADD, MADDU, MSUB, MSUBU, MULT and MULTU instructions
Differential Revision: http://reviews.llvm.org/D13721
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250683
91177308-0d34-0410-b5e6-
96231b3b80d8
Xinliang David Li [Mon, 19 Oct 2015 04:17:10 +0000 (04:17 +0000)]
[PGO] Eliminate prof data register calls on FreeBSD platform
This is a follow up patch of r250199 after verifying the start/stop
section symbols work as spected on FreeBSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250679
91177308-0d34-0410-b5e6-
96231b3b80d8
Jakub Staszak [Sun, 18 Oct 2015 19:34:10 +0000 (19:34 +0000)]
Preserve CFG in MergedLoadStoreMotion. This fixes PR24426.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250660
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Sun, 18 Oct 2015 14:04:56 +0000 (14:04 +0000)]
Add hashing and DenseMapInfo for ArrayRef
Sometimes it is more natural to use a ArrayRef<uint8_t> than a StringRef to
represent a range of bytes that is not, semantically, a string.
This will be used in lld in a sec.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250658
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 18 Oct 2015 12:54:37 +0000 (12:54 +0000)]
[X86][SSE] Add vector bit rotation tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250656
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 18 Oct 2015 12:33:54 +0000 (12:33 +0000)]
Use SDValue bool check. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250653
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sun, 18 Oct 2015 11:47:23 +0000 (11:47 +0000)]
Move one-use variable inside test. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250651
91177308-0d34-0410-b5e6-
96231b3b80d8
Asaf Badouh [Sun, 18 Oct 2015 11:04:38 +0000 (11:04 +0000)]
[X86][AVX512DQ] add scalar fpclass
Differential Revision: http://reviews.llvm.org/D13769
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250650
91177308-0d34-0410-b5e6-
96231b3b80d8
Igor Breger [Sun, 18 Oct 2015 09:56:39 +0000 (09:56 +0000)]
AVX512: Lowering i8/i16 vector CTLZ using the dword LZCNT vector instruction
Differential Revision: http://reviews.llvm.org/D13632
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250649
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 18 Oct 2015 05:29:05 +0000 (05:29 +0000)]
[Sparc] Use MCPhysReg instead of unsigned to size static arrays of registers. Should reduce the table size.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250644
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 18 Oct 2015 05:15:38 +0000 (05:15 +0000)]
Use array_lengthof. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250643
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sun, 18 Oct 2015 05:15:34 +0000 (05:15 +0000)]
Make a bunch of static arrays const.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250642
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Sun, 18 Oct 2015 01:41:37 +0000 (01:41 +0000)]
[RuntimeDyld] Add support for absolute symbols.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250639
91177308-0d34-0410-b5e6-
96231b3b80d8
Xinliang David Li [Sun, 18 Oct 2015 01:02:29 +0000 (01:02 +0000)]
Minor Instr PGO code restructuring
1. Key constant values (version, magic) and data structures related to raw and
indexed profile format are moved into one centralized file: InstrProf.h.
2. Utility function such as MD5Hash computation is also moved to the common
header to allow sharing with other components in the future.
3. A header data structure is introduced for Indexed format so that the reader
and writer can always be in sync.
4. Added some comments to document different places where multiple definition
of the data structure must be kept in sync (reader/writer, runtime, lowering
etc). No functional change is intended.
Differential Revision: http://reviews.llvm.org/D13758
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250638
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Sun, 18 Oct 2015 00:29:27 +0000 (00:29 +0000)]
[SCEV] Fix whitespace issues and remove extra braces; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250636
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Sun, 18 Oct 2015 00:29:23 +0000 (00:29 +0000)]
[SCEV] Use std::all_of and std::any_of; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250635
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Sun, 18 Oct 2015 00:29:20 +0000 (00:29 +0000)]
[SCEV] Use auto where it helps remove line breaks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250634
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Sun, 18 Oct 2015 00:29:16 +0000 (00:29 +0000)]
[SCEV] Use range for loops; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250633
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 17 Oct 2015 21:32:28 +0000 (21:32 +0000)]
Use std::find instead of manual loop.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250624
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 17 Oct 2015 21:32:26 +0000 (21:32 +0000)]
Use std::is_sorted to replace a custom version. Also replace a comparison predicate struct with a lambda.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250623
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 17 Oct 2015 19:04:24 +0000 (19:04 +0000)]
[X86][XOP] Add VPROT instruction opcodes
Added X86ISD opcodes for VPROT vector rotate by variable and by immediate.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250620
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 17 Oct 2015 18:22:46 +0000 (18:22 +0000)]
Remove unnecessary 'const' pointed out by David Blaikie.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250619
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 17 Oct 2015 18:21:53 +0000 (18:21 +0000)]
[X86][XOP] Add VPROT rotate by immediate intrinsics tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250618
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 17 Oct 2015 16:49:43 +0000 (16:49 +0000)]
[DAG] Ensure vector constant folding uses correct scalar undef types
Minor fix to D13665 found during post-commit review.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250616
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 17 Oct 2015 16:37:13 +0000 (16:37 +0000)]
Replace a custom table sort check with std::is_sorted. Change a function to take ArrayRef instead of pointer and length. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250615
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 17 Oct 2015 16:37:11 +0000 (16:37 +0000)]
Use std::begin/end and std::is_sorted to simplify some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250614
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Sat, 17 Oct 2015 16:37:09 +0000 (16:37 +0000)]
Use binary search in isCPUStringValid since the array is sorted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250613
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 17 Oct 2015 13:23:38 +0000 (13:23 +0000)]
[CostModel] Fixed AVX integer shift costs
Targets with AVX but without AVX2 were incorrectly reporting costs of 256-bit integer shifts.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250611
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 17 Oct 2015 13:04:42 +0000 (13:04 +0000)]
[X86][FastISel] Teach how to select SSE4A nontemporal stores.
Add FastISel support for SSE4A scalar float / double non-temporal stores
Follow up to D13698
Differential Revision: http://reviews.llvm.org/D13773
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250610
91177308-0d34-0410-b5e6-
96231b3b80d8
Simon Pilgrim [Sat, 17 Oct 2015 11:40:05 +0000 (11:40 +0000)]
[InstCombine] SSE4A constant folding and conversion to shuffles.
This patch improves support for combining the SSE4A EXTRQ(I) and INSERTQ(I) intrinsics:
1 - Converts INSERTQ/EXTRQ calls to INSERTQI/EXTRQI if the 'bit index' and 'length' operands are constant
2 - Converts INSERTQI/EXTRQI calls to shufflevector if the bit index/length are both byte aligned (we can already lower shuffles to INSERTQI/EXTRQI if its useful)
3 - Constant folding support
4 - Add zeroinitializer handling
Differential Revision: http://reviews.llvm.org/D13348
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250609
91177308-0d34-0410-b5e6-
96231b3b80d8
Davide Italiano [Sat, 17 Oct 2015 06:36:46 +0000 (06:36 +0000)]
[JIT/Examples] Fix Fibonacci so that it runs again.
The old JIT is (long) gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250604
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Sat, 17 Oct 2015 04:38:26 +0000 (04:38 +0000)]
[libFuzzer] add -shuffle flag
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250603
91177308-0d34-0410-b5e6-
96231b3b80d8
Colin LeMahieu [Sat, 17 Oct 2015 01:58:51 +0000 (01:58 +0000)]
[Hexagon] Reverting test file change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250601
91177308-0d34-0410-b5e6-
96231b3b80d8
Colin LeMahieu [Sat, 17 Oct 2015 01:33:04 +0000 (01:33 +0000)]
[Hexagon] Adding skeleton of HVX extension instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250600
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthias Braun [Sat, 17 Oct 2015 01:03:44 +0000 (01:03 +0000)]
RegisterPressure: Unify the sparse sets in LiveRegsSet; NFC
Also do some cleanups comment improvements.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250598
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthias Braun [Sat, 17 Oct 2015 00:46:57 +0000 (00:46 +0000)]
RegisterPressure: allocatable physreg uses are always kills
This property was already used in the code path when no liveness
intervals are present. Unfortunately the code path that uses liveness
intervals tried to query a cached live interval for an allocatable
physreg, those are usually not computed so a conservative default was
used.
This doesn't affect any of the lit testcases. This is a foreclosure to
upcoming changes which should be NFC but without this patch this tidbit
wouldn't be NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250596
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthias Braun [Sat, 17 Oct 2015 00:35:59 +0000 (00:35 +0000)]
RegisterPressure: Remove 0 entries from PressureChange
This should not change behaviour because as far as I can see all code
reading the pressure changes has no effect if the PressureInc is 0.
Removing these entries however does avoid unnecessary computation, and
results in a more stable debug output. I want the stable debug output to
check that some upcoming changes are indeed NFC and identical even at
the debug output level.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250595
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Sat, 17 Oct 2015 00:25:38 +0000 (00:25 +0000)]
WebAssembly: don't omit dead vregs from locals
Summary:
This is a temporary hack until we get around to remapping the vreg
numbers to local numbers. Dead vregs cause bad numbering and make
consumers sad.
We could also just look at debug info an use named locals instead, but
vregs have to work properly anyways so there!
Reviewers: binji, sunfish
Subscribers: jfb, llvm-commits, dschuff
Differential Revision: http://reviews.llvm.org/D13839
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250594
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Sat, 17 Oct 2015 00:12:29 +0000 (00:12 +0000)]
WebAssembly: fix the syntax for comparisons
Summary: It has also slightly changed.
Reviewers: binji
Subscribers: jfb, dschuff, llvm-commits, sunfish
Differential Revision: http://reviews.llvm.org/D13837
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250591
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthias Braun [Sat, 17 Oct 2015 00:08:48 +0000 (00:08 +0000)]
RegisterPressure: Hide non-const iterators of PressureDiff
It is too easy to accidentally violate the ordering requirements when
modifying the PressureDiff entries through iterators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250590
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthias Braun [Sat, 17 Oct 2015 00:08:45 +0000 (00:08 +0000)]
StreamWriter: List basic types instead of derived ones in HexNumber
This avoids problems with different (u)intXX definition on different
platforms. Specifically this fixes a case on OS/X which had uint64_t
defined as unsigned long long.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250589
91177308-0d34-0410-b5e6-
96231b3b80d8
Joseph Tremoulet [Sat, 17 Oct 2015 00:08:08 +0000 (00:08 +0000)]
[WinEH] Fix eh.exceptionpointer intrinsic lowering
Summary:
Some shared code for handling eh.exceptionpointer and eh.exceptioncode
needs to not share the part that truncates to 32 bits, which is intended
just for exception codes.
Reviewers: rnk
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13747
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250588
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 16 Oct 2015 23:56:14 +0000 (23:56 +0000)]
Disable a test relying on symbol demangling on non-Windows platforms
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250587
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 16 Oct 2015 23:53:12 +0000 (23:53 +0000)]
Speculative fix for GCC build
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250585
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 16 Oct 2015 23:43:27 +0000 (23:43 +0000)]
[WinEH] Fix stack alignment in funclets and ParentFrameOffset calculation
Our previous value of "16 + 8 + MaxCallFrameSize" for ParentFrameOffset
is incorrect when CSRs are involved. We were supposed to have a test
case to catch this, but it wasn't very rigorous.
The main effect here is that calling _CxxThrowException inside a
catchpad doesn't immediately crash on MOVAPS when you have an odd number
of CSRs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250583
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 16 Oct 2015 23:43:22 +0000 (23:43 +0000)]
[llvm-symbolizer] Use the export table if no symbols are present
This lets us make guesses about symbols in third party DLLs without
debug info, like MSVCR120.dll or kernel32.dll. dbghelp does the same
thing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250582
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthias Braun [Fri, 16 Oct 2015 23:25:09 +0000 (23:25 +0000)]
RegisterPressure: Use range based for, cleanup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250579
91177308-0d34-0410-b5e6-
96231b3b80d8
Davide Italiano [Fri, 16 Oct 2015 23:19:01 +0000 (23:19 +0000)]
[llvm-readobj] Teach ELFDumper about symbol versioning.
Differential Revision: http://reviews.llvm.org/D13824
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250575
91177308-0d34-0410-b5e6-
96231b3b80d8
Xinliang David Li [Fri, 16 Oct 2015 23:17:34 +0000 (23:17 +0000)]
Instroduce a template file to define InstrPGO core data structures.
Changing PGO data format layout can be a pain. Many different places need
to be touched and kept in sync. Failing to do so usually results in errors
very time consuming to debug.
This file is intended to be the master file that defines the layout of the
core runtime data structures. Currently only two structure is covered: Per
function ProfData structure and the function record structure used in
coverage mapping.
No client code has been made yet, so this commit is NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250574
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Bieneman [Fri, 16 Oct 2015 23:17:13 +0000 (23:17 +0000)]
[CMake] Cleaning up and generalizing the LLVMInstallSymlink script so that it can be used for libraries too.
In order to resolve PR25059, we're going to need to be able to generate symlinks to libraries manually, so I need this code to be reusable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250573
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Fri, 16 Oct 2015 23:04:31 +0000 (23:04 +0000)]
[libFuzzer] print a stack trace on timeout
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250571
91177308-0d34-0410-b5e6-
96231b3b80d8
Benjamin Kramer [Fri, 16 Oct 2015 23:00:29 +0000 (23:00 +0000)]
Revert "This is a follow-up to the discussion in D12882."
Breaks clang selfhost, see PR25222. This reverts commits r250527 and r250528.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250570
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Fri, 16 Oct 2015 22:47:20 +0000 (22:47 +0000)]
[libFuzzer] reduce the size of artifacts printed on the screen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250565
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Fri, 16 Oct 2015 22:41:47 +0000 (22:41 +0000)]
[libFuzzer] When -test_single_input crashes the test it is not necessary to write crash-file because input is already known to the user. Patch by Mike Aizatsky
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250564
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Fri, 16 Oct 2015 22:14:12 +0000 (22:14 +0000)]
[x86] promote 'add nsw' to a wider type to allow more combines
The motivation for this patch starts with PR20134:
https://llvm.org/bugs/show_bug.cgi?id=20134
void foo(int *a, int i) {
a[i] = a[i+1] + a[i+2];
}
It seems better to produce this (14 bytes):
movslq %esi, %rsi
movl 0x4(%rdi,%rsi,4), %eax
addl 0x8(%rdi,%rsi,4), %eax
movl %eax, (%rdi,%rsi,4)
Rather than this (22 bytes):
leal 0x1(%rsi), %eax
cltq
leal 0x2(%rsi), %ecx
movslq %ecx, %rcx
movl (%rdi,%rcx,4), %ecx
addl (%rdi,%rax,4), %ecx
movslq %esi, %rax
movl %ecx, (%rdi,%rax,4)
The most basic problem (the first test case in the patch combines constants) should also be fixed in InstCombine,
but it gets more complicated after that because we need to consider architecture and micro-architecture. For
example, AArch64 may not see any benefit from the more general transform because the ISA solves the sexting in
hardware. Some x86 chips may not want to replace 2 ADD insts with 1 LEA, and there's an attribute for that:
FeatureSlowLEA. But I suspect that doesn't go far enough or maybe it's not getting used when it should; I'm
also not sure if FeatureSlowLEA should also mean "slow complex addressing mode".
I see no perf differences on test-suite with this change running on AMD Jaguar, but I see small code size
improvements when building clang and the LLVM tools with the patched compiler.
A more general solution to the sext(add nsw(x, C)) problem that works for multiple targets is available
in CodeGenPrepare, but it may take quite a bit more work to get that to fire on all of the test cases that
this patch takes care of.
Differential Revision: http://reviews.llvm.org/D13757
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250560
91177308-0d34-0410-b5e6-
96231b3b80d8
Jim Grosbach [Fri, 16 Oct 2015 22:07:59 +0000 (22:07 +0000)]
MC: Don't crash after issuing a diagnostic.
Crashing is bad, m'kay? Fixing a 4 year old bug of my own creation.
Adding the testcase now which I should have added then which would have
long since caught this.
The problem is that printMessage() will display the diagnostic but not
set HadError to true, resulting in the assembler continuing on its way
and trying to create relocations for things that may not allow them or
otherwise get itself into trouble. Using the Error() helper function
here rather than calling printMessage() directly resolves this.
rdar://
23133240
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250557
91177308-0d34-0410-b5e6-
96231b3b80d8
Joseph Tremoulet [Fri, 16 Oct 2015 21:22:54 +0000 (21:22 +0000)]
[WinEH] Fix CatchRetSuccessorColorMap accounting
Summary:
We now use the block for the catchpad itself, rather than its normal
successor, as the funclet entry.
Putting the normal successor in the map leads downstream funclet
membership computations to erroneous results.
Reviewers: majnemer, rnk
Subscribers: rnk, llvm-commits
Differential Revision: http://reviews.llvm.org/D13798
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250552
91177308-0d34-0410-b5e6-
96231b3b80d8
Andrew Kaylor [Fri, 16 Oct 2015 20:39:20 +0000 (20:39 +0000)]
Fix assertion failure with fp128 to unsigned i64 conversion
Patch by Mitch Bodart
Differential Revision: http://reviews.llvm.org/D13780
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250550
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Fri, 16 Oct 2015 20:38:54 +0000 (20:38 +0000)]
[Hexagon] Split double registers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250549
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Fri, 16 Oct 2015 19:59:52 +0000 (19:59 +0000)]
[WinEH] Remove dead code/includes from WinEHPrepare
No functionality change is intended.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250545
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Fri, 16 Oct 2015 19:51:53 +0000 (19:51 +0000)]
[Hexagon] Delete lib/Target/Hexagon/HexagonRemoveSZExtArgs.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250543
91177308-0d34-0410-b5e6-
96231b3b80d8
Krzysztof Parzyszek [Fri, 16 Oct 2015 19:43:56 +0000 (19:43 +0000)]
[Hexagon] Merge adjacent stores
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250542
91177308-0d34-0410-b5e6-
96231b3b80d8
Diego Novillo [Fri, 16 Oct 2015 18:54:35 +0000 (18:54 +0000)]
Sample profiles - Re-arrange binary format to emit head samples only on top functions.
The number of samples collected at the head of a function only make
sense for top-level functions (i.e., those actually called as opposed to
being inlined inside another).
Head samples essentially count the time spent inside the function's
prologue. This clearly doesn't make sense for inlined functions, so we
were always emitting 0 in those.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250539
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Fri, 16 Oct 2015 18:24:42 +0000 (18:24 +0000)]
WebAssembly: fix load/store syntax
Summary: The syntax has changed a bit recently.
Reviewers: binji
Subscribers: llvm-commits, jfb, sunfish, dschuff
Differential Revision: http://reviews.llvm.org/D13821
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250535
91177308-0d34-0410-b5e6-
96231b3b80d8
Joseph Tremoulet [Fri, 16 Oct 2015 18:08:16 +0000 (18:08 +0000)]
[WinEH] Fix endpad coloring/numbering
Summary:
When a cleanup's cleanupendpad or cleanupret targets a catchendpad, stop
trying to propagate the cleanup's parent's color to the catchendpad, since
what's needed is the cleanup's grandparent's color and the catchendpad
will get that color from the catchpad linkage already. We already had
this exclusion for invokes, but were missing it for
cleanupendpad/cleanupret.
Also add a missing line that tags cleanupendpads' states in the
EHPadStateMap, without with lowering invokes that target cleanupendpads
which unwind to other handlers (and so don't have the -1 state) will fail.
This fixes the reduced IR repro in PR25163.
Reviewers: majnemer, andrew.w.kaylor, rnk
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13797
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250534
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaron Keren [Fri, 16 Oct 2015 17:50:47 +0000 (17:50 +0000)]
Fix typo, NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250529
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Fri, 16 Oct 2015 17:18:07 +0000 (17:18 +0000)]
move test case to x86 directory because it specifies an x86 target
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250528
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Fri, 16 Oct 2015 16:54:30 +0000 (16:54 +0000)]
This is a follow-up to the discussion in D12882.
Ideally, we would like SimplifyCFG to be able to form select instructions even when the operands
are expensive (as defined by the TTI cost model) because that may expose further optimizations.
However, we would then like a later pass like CodeGenPrepare to undo that transformation if the
target would likely benefit from not speculatively executing an expensive op (this patch).
Once we have this safety mechanism in place, we can adjust SimplifyCFG to restore its
select-formation behavior that changed with r248439.
Differential Revision: http://reviews.llvm.org/D13297
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250527
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Fri, 16 Oct 2015 16:35:49 +0000 (16:35 +0000)]
WebAssembly: relooper analysis pass
Summary: Make the relooper an analysis pass, to convert CFG to AST.
Reviewers: sunfish
Subscribers: jfb, dschuff
Differential Revision: http://reviews.llvm.org/D12744
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250524
91177308-0d34-0410-b5e6-
96231b3b80d8
Charlie Turner [Fri, 16 Oct 2015 15:38:25 +0000 (15:38 +0000)]
[AArch64] Implement vector splitting on UADDV.
Summary: Fixes PR25056.
Reviewers: mcrosier, junbuml, jmolloy
Subscribers: aemerson, rengolin, llvm-commits
Differential Revision: http://reviews.llvm.org/D13466
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250520
91177308-0d34-0410-b5e6-
96231b3b80d8
Diego Novillo [Fri, 16 Oct 2015 13:54:52 +0000 (13:54 +0000)]
Sample Profiling - Remove useless asserts. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250513
91177308-0d34-0410-b5e6-
96231b3b80d8
Zlatko Buljan [Fri, 16 Oct 2015 13:03:10 +0000 (13:03 +0000)]
Commited two test files which are forgotten during commit of patch for reviews.llvm.org/D13376
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250512
91177308-0d34-0410-b5e6-
96231b3b80d8
Hrvoje Varga [Fri, 16 Oct 2015 12:24:58 +0000 (12:24 +0000)]
[mips][microMIPS] Implement LB, LBE, LBU and LBUE instructions
Differential Revision: http://reviews.llvm.org/D11633
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250511
91177308-0d34-0410-b5e6-
96231b3b80d8
Pawel Bylica [Fri, 16 Oct 2015 10:11:07 +0000 (10:11 +0000)]
Fix path::home_directory() unit test.
It turns out that constructing std::string from null pointer is not the very best idea.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250506
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Fri, 16 Oct 2015 09:40:01 +0000 (09:40 +0000)]
SupportTests::HomeDirectory: Don't try tests when $HOME is undefined.
Lit sanitizes env vars. $HOME is not exported in Lit tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250505
91177308-0d34-0410-b5e6-
96231b3b80d8
NAKAMURA Takumi [Fri, 16 Oct 2015 09:38:49 +0000 (09:38 +0000)]
Reformat.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250504
91177308-0d34-0410-b5e6-
96231b3b80d8
Pawel Bylica [Fri, 16 Oct 2015 09:08:59 +0000 (09:08 +0000)]
Use Windows Vista API to get the user's home directory
Summary: This patch replaces usage of deprecated SHGetFolderPathW with SHGetKnownFolderPath. The usage of SHGetKnownFolderPath is wrapped to allow queries for other "known" folders in the near future.
Reviewers: aaron.ballman, gbedwell
Subscribers: chapuni, llvm-commits
Differential Revision: http://reviews.llvm.org/D13753
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250501
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Fri, 16 Oct 2015 06:03:09 +0000 (06:03 +0000)]
[X86] Add fxsr feature flag for fxsave/fxrestore instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250497
91177308-0d34-0410-b5e6-
96231b3b80d8
Dylan McKay [Fri, 16 Oct 2015 03:10:30 +0000 (03:10 +0000)]
Initial migration of AVR backend
This patch adds the underlying infrastructure for an AVR backend to be included into LLVM. It is the first of a series of patches aimed at moving the out-of-tree AVR backend into the tree.
It consists of adding a new`Triple` target 'avr'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250492
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 16 Oct 2015 02:41:23 +0000 (02:41 +0000)]
[RS4GC] Dont' propagate call attrs related to patchable statepoints
The `"statepoint-id"` and `"statepoint-num-patch-bytes"` attributes are
used solely to determine properties of the `gc.statepoint` being
created. Once the `gc.statepoint` is in place, these should be removed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250491
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 16 Oct 2015 02:41:11 +0000 (02:41 +0000)]
[RS4GC] Bring legalizeCallAttributes up to LLVM coding style; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250490
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 16 Oct 2015 02:41:00 +0000 (02:41 +0000)]
[RS4GC] Use "deopt" operand bundles
Summary:
This is a step towards using operand bundles to carry deopt state till
RewriteStatepointsForGC. The change adds a flag to
RewriteStatepointsForGC that teaches it to pick up deopt state from a
`"deopt"` operand bundle attached to the `call` or `invoke` it is
wrapping.
The command line flag added, `-rs4gc-use-deopt-bundles`, will only exist
for a short while. Once we are able to pipe deopt bundle state through
the full optimization pipeline without problems, we will "constant fold"
`-rs4gc-use-deopt-bundles` to `true`.
Reviewers: swaroop.sridhar, reames
Subscribers: llvm-commits, sanjoy
Differential Revision: http://reviews.llvm.org/D13372
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250489
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 16 Oct 2015 01:00:50 +0000 (01:00 +0000)]
[IndVars] Rename getExtend; NFC
Rename `IndVarSimplify::getExtend` to `IndVarSimplify::createExtendInst`
to make it obvious that it creates `llvm::Instruction` s.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250484
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 16 Oct 2015 01:00:47 +0000 (01:00 +0000)]
[IndVars] Have `cloneArithmeticIVUser` guess better
Summary:
`cloneArithmeticIVUser` currently trips over expression like `add %iv,
-1` when `%iv` is being zero extended -- it tries to construct the
widened use as `add %iv.zext, zext(-1)` and (correctly) fails to prove
equivalence to `zext(add %iv, -1)` (here the SCEV for `%iv` is
`{1,+,1}`).
This change teaches `IndVars` to try sign extending the non-IV operand
if that makes the newly constructed IV use equivalent to the widened
narrow IV use.
Reviewers: atrick, hfinkel, reames
Subscribers: sanjoy, llvm-commits
Differential Revision: http://reviews.llvm.org/D13717
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250483
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 16 Oct 2015 01:00:44 +0000 (01:00 +0000)]
[IndVars] Extract out a few local variables; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250482
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 16 Oct 2015 01:00:39 +0000 (01:00 +0000)]
[IndVars] Split `WidenIV::cloneIVUser`; NFC
Summary:
This NFC splitting is intended to make a later diff easier to follow.
It just tail duplicates `cloneIVUser` into `cloneArithmeticIVUser` and
`cloneBitwiseIVUser`.
Reviewers: atrick, hfinkel, reames
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13716
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250481
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Fri, 16 Oct 2015 00:53:49 +0000 (00:53 +0000)]
WebAssembly: update syntax
Summary:
Follow the same syntax as for the spec repo. Both have evolved slightly
independently and need to converge again.
This, along with wasmate changes, allows me to do the following:
echo "int add(int a, int b) { return a + b; }" > add.c
./out/bin/clang -O2 -S --target=wasm32-unknown-unknown add.c -o add.wack
./experimental/prototype-wasmate/wasmate.py add.wack > add.wast
./sexpr-wasm-prototype/out/sexpr-wasm add.wast -o add.wasm
./sexpr-wasm-prototype/third_party/v8-native-prototype/v8/v8/out/Release/d8 -e "print(WASM.instantiateModule(readbuffer('add.wasm'), {print:print}).add(42, 1337));"
As you'd expect, the d8 shell prints out the right value.
Reviewers: sunfish
Subscribers: jfb, llvm-commits, dschuff
Differential Revision: http://reviews.llvm.org/D13712
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250480
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Fri, 16 Oct 2015 00:44:01 +0000 (00:44 +0000)]
Add emacs c++ mode hint.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250479
91177308-0d34-0410-b5e6-
96231b3b80d8
Davide Italiano [Thu, 15 Oct 2015 22:04:55 +0000 (22:04 +0000)]
[llvm-readobj/ELF] Dump DT_VERDEF/DT_VERDEFNUM correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250464
91177308-0d34-0410-b5e6-
96231b3b80d8
Evgeniy Stepanov [Thu, 15 Oct 2015 21:26:49 +0000 (21:26 +0000)]
Revert "[safestack] Fast access to the unsafe stack pointer on AArch64/Android."
Breaks the hexagon buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250461
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Thu, 15 Oct 2015 20:58:55 +0000 (20:58 +0000)]
Replace a forward declaration with an #include.
When building with modules the forward-declared inner class
DebugLocStream::ListBuilder causes clang to fall over.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250459
91177308-0d34-0410-b5e6-
96231b3b80d8
Evgeniy Stepanov [Thu, 15 Oct 2015 20:50:16 +0000 (20:50 +0000)]
[safestack] Fast access to the unsafe stack pointer on AArch64/Android.
Android libc provides a fixed TLS slot for the unsafe stack pointer,
and this change implements direct access to that slot on AArch64 via
__builtin_thread_pointer() + offset.
This change also moves more code into TargetLowering and its
target-specific subclasses to get rid of target-specific codegen
in SafeStackPass.
This change does not touch the ARM backend because ARM lowers
builting_thread_pointer as aeabi_read_tp, which is not available
on Android.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250456
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Bieneman [Thu, 15 Oct 2015 20:12:08 +0000 (20:12 +0000)]
[CMake] Adding LLVM_CREATE_XCODE_TOOLCHAIN to the CMake documentation page.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250451
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Bieneman [Thu, 15 Oct 2015 20:09:01 +0000 (20:09 +0000)]
[CMake] [Darwin] Add support for generating Xcode-compatible toolchains that xcodebuild and xcrun can search
Summary:
Sometimes you want to install a custom compiler and use it like the system compiler without overriding the system compiler. This patch lets you create xctoolchains that the darwin command line tools can use.
To use this patch set LLVM_CREATE_XCODE_TOOLCHAIN=On in your CMake invocation and build the `install-code-toolchain` target.
After installation you can set the envar EXTERNAL_TOOLCHAINS_DIR to your installed Toolchains directory, and the TOOLCHAINS envar to the toolchain identifier (ex org.llvm.3.8.0svn). This will then cause /usr/bin/clang to call your newly installed clang.
Reviewers: Bigcheese, bogner
Subscribers: tobiasfar, llvm-commits
Differential Revision: http://reviews.llvm.org/D13605
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250450
91177308-0d34-0410-b5e6-
96231b3b80d8
Adrian Prantl [Thu, 15 Oct 2015 19:41:54 +0000 (19:41 +0000)]
Add a missing include of cstddef needed for size_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250446
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Thu, 15 Oct 2015 18:24:52 +0000 (18:24 +0000)]
x86: preserve flags when folding atomic operations
D4796 taught LLVM to fold some atomic integer operations into a single
instruction. The pattern was unaware that the instructions clobbered
flags. I fixed some of this issue in D13680 but had missed INC/DEC.
This patch adds the missing EFLAGS definition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250438
91177308-0d34-0410-b5e6-
96231b3b80d8