OSDN Git Service
Hal Finkel [Fri, 23 Oct 2015 20:37:08 +0000 (20:37 +0000)]
Handle non-constant shifts in computeKnownBits, and use computeKnownBits for constant folding in InstCombine/Simplify
First, the motivation: LLVM currently does not realize that:
((2072 >> (L == 0)) >> 7) & 1 == 0
where L is some arbitrary value. Whether you right-shift 2072 by 7 or by 8, the
lowest-order bit is always zero. There are obviously several ways to go about
fixing this, but the generic solution pursued in this patch is to teach
computeKnownBits something about shifts by a non-constant amount. Previously,
we would give up completely on these. Instead, in cases where we know something
about the low-order bits of the shift-amount operand, we can combine (and
together) the associated restrictions for all shift amounts consistent with
that knowledge. As a further generalization, I refactored all of the logic for
all three kinds of shifts to have this capability. This works well in the above
case, for example, because the dynamic shift amount can only be 0 or 1, and
thus we can say a lot about the known bits of the result.
This brings us to the second part of this change: Even when we know all of the
bits of a value via computeKnownBits, nothing used to constant-fold the result.
This introduces the necessary code into InstCombine and InstSimplify. I've
added it into both because:
1. InstCombine won't automatically pick up the associated logic in
InstSimplify (InstCombine uses InstSimplify, but not via the API that
passes in the original instruction).
2. Putting the logic in InstCombine allows the resulting simplifications to become
part of the iterative worklist
3. Putting the logic in InstSimplify allows the resulting simplifications to be
used by everywhere else that calls SimplifyInstruction (inlining, unrolling,
and many others).
And this requires a small change to our definition of an ephemeral value so
that we don't break the rest case from r246696 (where the icmp feeding the
@llvm.assume, is also feeding a br). Under the old definition, the icmp would
not be considered ephemeral (because it is used by the br), but this causes the
assume to remove itself (in addition to simplifying the branch structure), and
it seems more-useful to prevent that from happening.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251146
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Fri, 23 Oct 2015 20:30:02 +0000 (20:30 +0000)]
GVN: don't try to replace instruction with itself.
After some look-ahead PRE was added for GEPs, an instruction could end
up in the table of candidates before it was actually inspected. When
this happened the pass might decide it was the best candidate to
replace itself. This didn't go well.
Should fix PR25291
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251145
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Fri, 23 Oct 2015 20:15:35 +0000 (20:15 +0000)]
Fix the variable names to match the LLVM style.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251143
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 23 Oct 2015 20:09:57 +0000 (20:09 +0000)]
[SCEV] Fix stylistic issue in MatchBinaryAddToConst; NFCI
Instead of checking `(FlagsPresent & ExpectedFlags) != 0`, check
`(FlagsPresent & ExpectedFlags) == ExpectedFlags`. Right now they're
equivalent since `ExpectedFlags` can only be either `FlagNUW` or
`FlagNSW`, but if we ever pass in `ExpectedFlags` as `FlagNUW | FlagNSW`
then checking `(FlagsPresent & ExpectedFlags) != 0` would be wrong.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251142
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 23 Oct 2015 20:09:55 +0000 (20:09 +0000)]
[Inliner] Don't inline through callsites with operand bundles
Summary:
This change teaches the LLVM inliner to not inline through callsites
with unknown operand bundles. Currently all operand bundles are
"unknown" operand bundles but in the near future we will add support for
inlining through some select kinds of operand bundles.
Reviewers: reames, chandlerc, majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14001
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251141
91177308-0d34-0410-b5e6-
96231b3b80d8
Chris Bieneman [Fri, 23 Oct 2015 19:48:17 +0000 (19:48 +0000)]
[CMake] Fixing dependency issue with parallel make when building with LLVM_OPTIMIZED_TABLEGEN.
Patch by Alex Wang
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251138
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Fri, 23 Oct 2015 19:35:38 +0000 (19:35 +0000)]
[X86] Clean up the tail call eligibility logic
Summary:
The logic here isn't straightforward because our support for
TargetOptions::GuaranteedTailCallOpt.
Also fix a bug where we were allowing tail calls to cdecl functions from
fastcall and vectorcall functions. We were special casing thiscall and
stdcall callers rather than checking for any convention that requires
clearing stack arguments before returning.
Reviewers: hans
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14024
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251137
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Fri, 23 Oct 2015 18:46:43 +0000 (18:46 +0000)]
[RuntimeDyld][COFF] Fix a think-o in the handling of the IMAGE_REL_AMD64_ADDR64
relocation that was introduced in r250733.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251135
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Fri, 23 Oct 2015 18:37:58 +0000 (18:37 +0000)]
[libFuzzer] remove some old code; also make __sanitizer_get_total_unique_caller_callee_pairs weak so that newer libFuzzer works with older asan
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251133
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Fri, 23 Oct 2015 18:07:58 +0000 (18:07 +0000)]
AMDGPU: Fix parsing of 32-bit literals with sign bit set
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251132
91177308-0d34-0410-b5e6-
96231b3b80d8
Jonathan Roelofs [Fri, 23 Oct 2015 17:42:51 +0000 (17:42 +0000)]
Fix another reference to in-source builds
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251127
91177308-0d34-0410-b5e6-
96231b3b80d8
Artyom Skrobov [Fri, 23 Oct 2015 17:19:19 +0000 (17:19 +0000)]
[ARM] Renaming +t2dsp feature into +dsp, as discussed on llvm-dev
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251125
91177308-0d34-0410-b5e6-
96231b3b80d8
Oleg Ranevskyy [Fri, 23 Oct 2015 17:17:59 +0000 (17:17 +0000)]
[ARM CodeGen] @llvm.debugtrap call may be removed when restoring callee saved registers
Summary:
When ARMFrameLowering::emitPopInst generates a "pop" instruction to restore the callee saved registers, it checks if the LR register is among them. If so, the function may decide to remove the basic block's terminator and replace it with a "pop" to the PC register instead of LR.
This leads to a problem when the block's terminator is preceded by a "llvm.debugtrap" call. The MI iterator points to the trap in such a case, which is also a terminator. If the function decides to restore LR to PC, it erroneously removes the trap.
Reviewers: asl, rengolin
Subscribers: aemerson, jfb, rengolin, dschuff, llvm-commits
Differential Revision: http://reviews.llvm.org/D13672
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251123
91177308-0d34-0410-b5e6-
96231b3b80d8
Oleg Ranevskyy [Fri, 23 Oct 2015 17:10:44 +0000 (17:10 +0000)]
Test commit: fix typo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251122
91177308-0d34-0410-b5e6-
96231b3b80d8
Davide Italiano [Fri, 23 Oct 2015 16:52:22 +0000 (16:52 +0000)]
[llvm-readobj] Don't cast qualifiers away. Now gcc is happy again.
Reported by: mikael.holmen at ericsson.com
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251117
91177308-0d34-0410-b5e6-
96231b3b80d8
Joseph Tremoulet [Fri, 23 Oct 2015 15:06:05 +0000 (15:06 +0000)]
[CodeGen] Mark setjmp/catchret MBBs address-taken
Summary:
This ensures that BranchFolding (and similar) won't remove these blocks.
Also allow AsmPrinter::EmitBasicBlockStart to process MBBs which are
address-taken but do not have BBs that are address-taken, since otherwise
its call to getAddrLabelSymbolTableToEmit would fail an assertion on such
blocks. I audited the other callers of getAddrLabelSymbolTableToEmit
(and getAddrLabelSymbol); they all have BBs known to be address-taken
except for the call through getAddrLabelSymbol from
WinException::create32bitRef; that call is actually now unreachable, so
I've removed it and updated the signature of create32bitRef.
This fixes PR25168.
Reviewers: majnemer, andrew.w.kaylor, rnk
Subscribers: pgavlin, llvm-commits
Differential Revision: http://reviews.llvm.org/D13774
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251113
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Fri, 23 Oct 2015 14:17:03 +0000 (14:17 +0000)]
[BasicAA] Bugfix for r251016
If the loaded type sizes don't match the element type of the sequential type, all bets are off and the addresses may, indeed, overlap.
Surprisingly, this just got caught in one test, on one builder, out of the 30+ builders testing this change. Congratulations go to http://lab.llvm.org:8011/builders/clang-aarch64-lnt/builds/5205.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251112
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Fri, 23 Oct 2015 10:41:38 +0000 (10:41 +0000)]
Revert "[AArch64]Merge halfword loads into a 32-bit load"
This reverts commit r250719. This introduced a codegen fault in SPEC2000.gcc, when compiled for Cortex-A53.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251108
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 23 Oct 2015 06:57:21 +0000 (06:57 +0000)]
[SCEV] Get rid of an unnecessary lambda; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251099
91177308-0d34-0410-b5e6-
96231b3b80d8
Zlatko Buljan [Fri, 23 Oct 2015 06:39:29 +0000 (06:39 +0000)]
[mips][microMIPS] Implement SHLL.PH, SHLL_S.PH, SHLL.QB, SHLLV.PH, SHLLV_S.PH, SHLLV.QB, SHLLV_S.W, SHLL_S.W, SHRA.QB and SHRA_R.QB instructions
Differential Revision: http://reviews.llvm.org/D13929
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251098
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 23 Oct 2015 06:33:47 +0000 (06:33 +0000)]
[SCEV] Fix a latent bug in `getPreStartForExtend`
I could not come up a way to test this -- I think this bug is latent
today, and will not actually result in a miscompile.
In `getPreStartForExtend`, SCEV constructs `PreStart` as a sum of all of
`SA`'s operands except `Op`. It also uses `SA`'s no-wrap flags, and
this is problematic because removing an element from an add expression
can make it signed-wrap. E.g. if `SA` was `(127 + 1 + -1)`, then it
could safely be `<nsw>` (since `sext(127) + sext(1) + sext(-1)` ==
`sext(127 + 1 + -1)`), but `(127 + 1)` (== `PreStart` if `Op` is `-1`)
is not `<nsw>`.
Transferring `<nuw>` from `SA` to `PreStart` is safe, as far as I can
tell.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251097
91177308-0d34-0410-b5e6-
96231b3b80d8
Dylan McKay [Fri, 23 Oct 2015 06:05:55 +0000 (06:05 +0000)]
[AVR] Add ELF constants to headers
Also adds a 'trivial' ELF file. This was generated by assembling
and linking a file with the symbol main which contains a single
return instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251096
91177308-0d34-0410-b5e6-
96231b3b80d8
Saleem Abdulrasool [Fri, 23 Oct 2015 05:26:03 +0000 (05:26 +0000)]
Support, IR: silence -Wunused-parameter
If this is used outside of LLVM with -Werror, this would cause a failure.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251094
91177308-0d34-0410-b5e6-
96231b3b80d8
Xinliang David Li [Fri, 23 Oct 2015 04:22:58 +0000 (04:22 +0000)]
Add more intrumentation/runtime helper interfaces (NFC)
This patch converts the remaining references to literal
strings for names of profile runtime entites (such as
profile runtime hook, runtime hook use function, profile
init method, register function etc).
Also added documentation for all the new interfaces.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251093
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Fri, 23 Oct 2015 01:28:05 +0000 (01:28 +0000)]
[LangRef] Fix the doc for operand bundles
I accidentally messed this up after a merge conflict in a previous
commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251089
91177308-0d34-0410-b5e6-
96231b3b80d8
Mehdi Amini [Fri, 23 Oct 2015 01:04:45 +0000 (01:04 +0000)]
SLPVectorizer: AllSameOpcode* starts "true" only for instructions
r251085 wasn't as NFC as intended...
From: Mehdi Amini <mehdi.amini@apple.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251087
91177308-0d34-0410-b5e6-
96231b3b80d8
Mehdi Amini [Fri, 23 Oct 2015 00:46:17 +0000 (00:46 +0000)]
SLPVectorizer: refactor reorderInputsAccordingToOpcode (NFC)
This is intended to simplify the changes needed to solve PR25247.
From: Mehdi Amini <mehdi.amini@apple.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251085
91177308-0d34-0410-b5e6-
96231b3b80d8
Davide Italiano [Fri, 23 Oct 2015 00:17:40 +0000 (00:17 +0000)]
[CodeGen] Remove usage of NDEBUG in header.
Moreover, this seems unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251081
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Thu, 22 Oct 2015 23:55:39 +0000 (23:55 +0000)]
[libFuzzer] use the indirect caller-callee counter as an independent search heuristic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251078
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Thu, 22 Oct 2015 22:56:45 +0000 (22:56 +0000)]
[libFuzzer] more refactoring the code that checks the coverage. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251075
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Thu, 22 Oct 2015 22:50:47 +0000 (22:50 +0000)]
[libFuzzer] refactoring the code that checks the coverage. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251074
91177308-0d34-0410-b5e6-
96231b3b80d8
Xinliang David Li [Thu, 22 Oct 2015 21:51:09 +0000 (21:51 +0000)]
Minor bug fix in Profile Name Prefix interface
Exposed in uses by clang FE.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251070
91177308-0d34-0410-b5e6-
96231b3b80d8
Kostya Serebryany [Thu, 22 Oct 2015 21:48:09 +0000 (21:48 +0000)]
[libFuzzer] remove the deprecated 'tokens' feature
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251069
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Thu, 22 Oct 2015 21:31:34 +0000 (21:31 +0000)]
LoopPass: Remove redoLoop, it isn't used. NFC
In r251064 I removed a logically unreachable call to `redoLoop`, and
now there aren't any callers of this API at all. Remove the needless
complexity.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251067
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Thu, 22 Oct 2015 21:21:32 +0000 (21:21 +0000)]
LoopPass: Simplify the API for adding a new loop. NFC
The insertLoop() API is only used to add new loops, and has confusing
ownership semantics. Simplify it by replacing it with addLoop().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251064
91177308-0d34-0410-b5e6-
96231b3b80d8
Chen Li [Thu, 22 Oct 2015 20:48:38 +0000 (20:48 +0000)]
[SimplifyCFG] Extend SimplifyResume to handle phi of trivial landing pad.
Summary: Currently SimplifyResume can convert an invoke instruction to a call instruction if its landing pad is trivial. In practice we could have several invoke instructions with trivial landing pads and share a common rethrow block, and in the common rethrow block, all the landing pads join to a phi node. The patch extends SimplifyResume to check the phi of landing pad and their incoming blocks. If any of them is trivial, remove it from the phi node and convert the invoke instruction to a call instruction.
Reviewers: hfinkel, reames
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13718
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251061
91177308-0d34-0410-b5e6-
96231b3b80d8
Xinliang David Li [Thu, 22 Oct 2015 20:32:12 +0000 (20:32 +0000)]
Add helper functions and remove hard coded references to instProf related name/name-prefixes
This is a clean up patch that defines instr prof section and variable
name prefixes in a common header with access helper functions.
clang FE change will be done as a follow up once this patch is in.
Differential Revision: http://reviews.llvm.org/D13919
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251058
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Thu, 22 Oct 2015 20:29:08 +0000 (20:29 +0000)]
[Sink] Don't check BB.empty()
As an invariant, BasicBlocks cannot be empty when passed to a transform.
This is not the case for MachineBasicBlocks and the Sink pass was ported
from the MachineSink pass which would explain the check's existence.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251057
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 22 Oct 2015 20:07:28 +0000 (20:07 +0000)]
[ASan] Enable instrumentation of dynamic allocas by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251056
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 19:57:41 +0000 (19:57 +0000)]
[SCEV] Remove a test case added in r249168
The test case wasn't testing what it was commented to be testing; and
when I tried to fix the test I noticed that SCEV does not support the
simplification that the test was supposed to test.
This change removes the test case to avoid confusion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251053
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 19:57:38 +0000 (19:57 +0000)]
[SCEV] Commute zero extends through <nuw> additions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251052
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 19:57:34 +0000 (19:57 +0000)]
[SCEV] Opportunistically interpret unsigned constraints as signed
Summary:
An unsigned comparision is equivalent to is corresponding signed version
if both the operands being compared are positive. Teach SCEV to use
this fact when profitable.
Reviewers: atrick, hfinkel, reames, nlewycky
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13687
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251051
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 19:57:29 +0000 (19:57 +0000)]
[SCEV] Teach SCEV some axioms about non-wrapping arithmetic
Summary:
- A s< (A + C)<nsw> if C > 0
- A s<= (A + C)<nsw> if C >= 0
- (A + C)<nsw> s< A if C < 0
- (A + C)<nsw> s<= A if C <= 0
Right now `C` needs to be a constant, but we can later generalize it to
be a non-constant if needed.
Reviewers: atrick, hfinkel, reames, nlewycky
Subscribers: sanjoy, llvm-commits
Differential Revision: http://reviews.llvm.org/D13686
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251050
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 19:57:25 +0000 (19:57 +0000)]
[SCEV] Commute sign extends through nsw additions
Summary: Depends on D13613.
Reviewers: atrick, hfinkel, reames, nlewycky
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13685
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251049
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 19:57:19 +0000 (19:57 +0000)]
[SCEV] Mark AddExprs as nsw or nuw if legal
Summary:
This uses `ScalarEvolution::getRange` and not potentially control
dependent `nsw` and `nuw` bits on the arithmetic instruction.
Reviewers: atrick, hfinkel, nlewycky
Subscribers: llvm-commits, sanjoy
Differential Revision: http://reviews.llvm.org/D13613
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251048
91177308-0d34-0410-b5e6-
96231b3b80d8
Alexey Samsonov [Thu, 22 Oct 2015 19:51:59 +0000 (19:51 +0000)]
[ASan] Minor fixes to dynamic allocas handling:
* Don't instrument promotable dynamic allocas:
We already have a test that checks that promotable dynamic allocas are
ignored, as well as static promotable allocas. Make sure this test will
still pass if/when we enable dynamic alloca instrumentation by default.
* Handle lifetime intrinsics before handling dynamic allocas:
lifetime intrinsics may refer to dynamic allocas, so we need to emit
instrumentation before these dynamic allocas would be replaced.
Differential Revision: http://reviews.llvm.org/D12704
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251045
91177308-0d34-0410-b5e6-
96231b3b80d8
Davide Italiano [Thu, 22 Oct 2015 18:46:27 +0000 (18:46 +0000)]
[ExecutionEngine] Garbage collect some dead (and unsafe) code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251042
91177308-0d34-0410-b5e6-
96231b3b80d8
Igor Laevsky [Thu, 22 Oct 2015 18:35:34 +0000 (18:35 +0000)]
[IntrinsicEmitter] Remove GET_INTRINSIC_MODREF_BEHAVIOR table
There is no need to generate separate table for intrinsics mod ref behaviour.
It can now be determined purely from function attributes.
Differential Revision: http://reviews.llvm.org/D13917
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251040
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 22 Oct 2015 18:32:06 +0000 (18:32 +0000)]
Avoid storing a second copy of each string in StringTableBuilder.
This was only use in the extremely uncommon case of @@@ symbols on ELF.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251039
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthias Braun [Thu, 22 Oct 2015 18:07:38 +0000 (18:07 +0000)]
AArch64: Disable the latency heuristic
It turned out not to improve any of our benchmarks but occasionally led
to increased register pressure and spilling.
Only enabling for the Cyclone CPU as the results on the cortex CPUs
give mixed results.
Differential Revision: http://reviews.llvm.org/D13708
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251038
91177308-0d34-0410-b5e6-
96231b3b80d8
Matthias Braun [Thu, 22 Oct 2015 18:07:31 +0000 (18:07 +0000)]
MachineScheduler: Add a way to disable the 'ReduceLatency' heuristic
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251037
91177308-0d34-0410-b5e6-
96231b3b80d8
Eric Christopher [Thu, 22 Oct 2015 17:55:35 +0000 (17:55 +0000)]
Remove the last traces of X86CompilationCallback as it is completely
unused.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251035
91177308-0d34-0410-b5e6-
96231b3b80d8
Tim Northover [Thu, 22 Oct 2015 17:20:48 +0000 (17:20 +0000)]
CodeGen: increase bits allocated for LegalizeActions
The array handling CondCodes only allocated 2 bits to describe the
desired action for each type. The new addition of a "LibCall" option
overflowed this and caused corruption for Custom actions.
No in-tree targets have a Custom CondCodeAction, so unfortunately it
can't be tested.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251033
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Thu, 22 Oct 2015 17:05:00 +0000 (17:05 +0000)]
Change makeLibCall to take an ArrayRef<SDValue> instead of pointer and size. This removes the need to pass a hardcoded size in many places. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251032
91177308-0d34-0410-b5e6-
96231b3b80d8
Zachary Turner [Thu, 22 Oct 2015 16:42:31 +0000 (16:42 +0000)]
Fix broken build under MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251030
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Thu, 22 Oct 2015 16:35:56 +0000 (16:35 +0000)]
Use ArrayRef instead of pointer and size. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251029
91177308-0d34-0410-b5e6-
96231b3b80d8
Zia Ansari [Thu, 22 Oct 2015 16:14:45 +0000 (16:14 +0000)]
[X86] - Catch extra combine opportunities for redundant imuls.
When we fold "mul ((add x, c1), c1)" -> "add ((mul x, c2), c1*c2)", we bail if (add x, c1) has multiple
users which would result in an extra add instruction.
In such cases, this patch adds a check to see if we can eliminate a multiply instruction in exchange for the extra add.
I also added the capability of doing the existing optimization with non-splatted vectors (splatted also works).
Differential Revision: http://reviews.llvm.org/D13740
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251028
91177308-0d34-0410-b5e6-
96231b3b80d8
Bill Schmidt [Thu, 22 Oct 2015 15:53:44 +0000 (15:53 +0000)]
[PPC] Fix PR24686 by failing assembly for an invalid relocation
PR24686 identifies a problem where a relocation expression is invalid
when not all of the symbols in the expression can be locally
resolved. This causes the compiler to request a PC-relative half16ds
relocation, which is nonsensical for PowerPC. This patch recognizes
this situation and ensures we fail the assembly cleanly.
Test case provided by Anton Blanchard.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251027
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 22 Oct 2015 15:26:35 +0000 (15:26 +0000)]
Avoid hash lookups when finalizing StringTableBuilder. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251024
91177308-0d34-0410-b5e6-
96231b3b80d8
Rafael Espindola [Thu, 22 Oct 2015 15:15:44 +0000 (15:15 +0000)]
Use array_pod_sort. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251023
91177308-0d34-0410-b5e6-
96231b3b80d8
Pirama Arumuga Nainar [Thu, 22 Oct 2015 14:15:00 +0000 (14:15 +0000)]
Fix incorrect target triple in fp16-promote.ll
Summary:
Hyphens were missing from the triple, causing it to be parsed
incorrectly. This patch updates the triple and makes necessary
changes to the expected output.
Patch is from Vinicius Tinti.
Reviewers: ab, tinti
Subscribers: srhines, llvm-commits
Differential Revision: http://reviews.llvm.org/D13792
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251020
91177308-0d34-0410-b5e6-
96231b3b80d8
Daniel Sanders [Thu, 22 Oct 2015 14:01:52 +0000 (14:01 +0000)]
[mips][mips16] Fix typo in FileCheck directive.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251019
91177308-0d34-0410-b5e6-
96231b3b80d8
Asaf Badouh [Thu, 22 Oct 2015 14:01:16 +0000 (14:01 +0000)]
[X86][AVX512] extend vcvtph2ps to support xmm/ymm and sae versions
Differential Revision: http://reviews.llvm.org/D13945
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251018
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Thu, 22 Oct 2015 13:44:26 +0000 (13:44 +0000)]
[GlobalsAA] Loosen an overly conservative bailout
Instead of bailing out when we see loads, analyze them. If we can prove that the loaded-from address must escape, then we can conclude that a load from that address must escape too and therefore cannot alias a non-addr-taken global.
When checking if a Value can alias a non-addr-taken global, if the Value is a LoadInst of a non-global, recurse instead of bailing.
If we can follow a trail of loads up to some base that is captured, we know by inference that all the loads we followed are also captured.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251017
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Thu, 22 Oct 2015 13:28:18 +0000 (13:28 +0000)]
[BasicAA] Non-equal indices in a GEP of a SequentialType don't overlap
If the final indices of two GEPs can be proven to not be equal, and
the GEP is of a SequentialType (not a StructType), then the two GEPs
do not alias.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251016
91177308-0d34-0410-b5e6-
96231b3b80d8
James Molloy [Thu, 22 Oct 2015 13:18:42 +0000 (13:18 +0000)]
[ValueTracking] Add a new predicate: isKnownNonEqual()
isKnownNonEqual(A, B) returns true if it can be determined that A != B.
At the moment it only knows two facts, that a non-wrapping add of nonzero to a value cannot be that value:
A + B != A [where B != 0, addition is nsw or nuw]
and that contradictory known bits imply two values are not equal.
This patch also hooks this up to InstSimplify; InstSimplify had a peephole for the first fact but not the second so this teaches InstSimplify a new trick too (alas no measured performance impact!)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251012
91177308-0d34-0410-b5e6-
96231b3b80d8
Manuel Klimek [Thu, 22 Oct 2015 08:31:46 +0000 (08:31 +0000)]
Fix add_llvm_external_project.
r250835 unintentionally discarded the optional parameter to the
add_llvm_external_project() macro that may point to a path when the said
path is different from ${name}. This should fix it by passing ${ARGN} on
to add_llvm_subdirectory(). The problem manifests itself with e.g.
add_llvm_external_project(clang-tools-extra extra) from
clang/tools/CMakeLists.txt
Patch by Luchesar V. Iliev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251001
91177308-0d34-0410-b5e6-
96231b3b80d8
Pawel Bylica [Thu, 22 Oct 2015 08:12:15 +0000 (08:12 +0000)]
Use range-based for loop in sys::path::append(). NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250999
91177308-0d34-0410-b5e6-
96231b3b80d8
Elena Demikhovsky [Thu, 22 Oct 2015 07:10:29 +0000 (07:10 +0000)]
AVX-512: Fixed a bug in select_cc for i1 type
Fixed faiure:
LLVM ERROR: Cannot select: t33: i1 = select_cc t25, Constant:i32<0>, t45, t42, seteq:ch
added a test
Differential Revision: http://reviews.llvm.org/D13943
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250996
91177308-0d34-0410-b5e6-
96231b3b80d8
Elena Demikhovsky [Thu, 22 Oct 2015 06:20:29 +0000 (06:20 +0000)]
Partially reverted changes from r250686
Clang runtime failure was reported.
Assertion failed: (isExtended() && "Type is not extended!"), function getTypeForEVT
I'll need to add a proper handling for PointerType in masked load/store intrinsics.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250995
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 03:12:57 +0000 (03:12 +0000)]
[IR] Add a `makeNoWrapRegion` method to `ConstantRange`
Summary: This will be used in a future change to ScalarEvolution.
Reviewers: hfinkel, reames, nlewycky
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13612
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250975
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 03:12:51 +0000 (03:12 +0000)]
[OperandBundles] Teach AliasAnalysis about operand bundles
Summary:
If a `CallSite` has operand bundles, then do not peek into the called
function to get a more precise `ModRef` answer.
This is tested using `argmemonly`, `-basicaa` and `-gvn`; but the
functionality is not specific to any of these.
Depends on D13961
Reviewers: reames, chandlerc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13962
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250974
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjoy Das [Thu, 22 Oct 2015 03:12:22 +0000 (03:12 +0000)]
[OperandBundles] Make function attributes conservatively correct
Summary:
This makes attribute accessors on `CallInst` and `InvokeInst` do the
(conservatively) right thing. This essentially involves, in some
cases, *not* falling back querying the attributes on the called
`llvm::Function` when operand bundles are present.
Attributes locally present on the `CallInst` or `InvokeInst` will still
override operand bundle semantics. The LangRef has been amended to
reflect this. Note: this change does not do anything prevent
`-function-attrs` from inferring `CallSite` local attributes after
inspecting the called function -- that will be done as a separate
change.
I've used `-adce` and `-early-cse` to test these changes. There is
nothing special about these passes (and they did not require any
changes) except that they seemed be the easiest way to write the tests.
This change does not add deal with `argmemonly`. That's a later change
because alias analysis requires a related fix before `argmemonly` can be
tested.
Reviewers: reames, chandlerc
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13961
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250973
91177308-0d34-0410-b5e6-
96231b3b80d8
JF Bastien [Thu, 22 Oct 2015 02:32:50 +0000 (02:32 +0000)]
WebAssembly: fix more syntax
br_if shouldn't start with a dot.
div and rem went from prefix u/s to suffix.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250972
91177308-0d34-0410-b5e6-
96231b3b80d8
Pete Cooper [Thu, 22 Oct 2015 01:48:57 +0000 (01:48 +0000)]
Add missing load/store flags to thumb2 instructions.
These were the cause of a verifier error when building 7zip with
-verify-machineinstrs. Running 'make check' with the verifier
triggered the same error on the test here so i've updated the test
to run the verifier on one of its runs instead of adding a new one.
While looking at this code, there was a stale comment that these
instructions were only used for disassembly. This probably used to
be the case, but they are now used in the 'ARM load / store optimization pass' too.
This reapplies r242300 which was reverted in r242428 due to bot failures.
Ultimately those failures were spurious and completely unrelated to this commit. I reverted this
at the time because it was thought to be at fault.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250969
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Thu, 22 Oct 2015 01:46:38 +0000 (01:46 +0000)]
Attempt to fix formatting for operand bundles
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250968
91177308-0d34-0410-b5e6-
96231b3b80d8
David Blaikie [Thu, 22 Oct 2015 01:17:29 +0000 (01:17 +0000)]
Update LangRef for changes to the alias textual IR format to support typeless pointer work
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250967
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 21 Oct 2015 23:20:39 +0000 (23:20 +0000)]
[WinEH] Remove extraneous call to emitEHRegistrationOffsetLabel
It's a relic from the earlier implementation, let's remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250964
91177308-0d34-0410-b5e6-
96231b3b80d8
Justin Bogner [Wed, 21 Oct 2015 22:51:59 +0000 (22:51 +0000)]
[PM]: Fix a doc typo. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250962
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 21 Oct 2015 22:37:51 +0000 (22:37 +0000)]
AMDGPU: Fix adding redundant m0 uses
BuildMI already adds these since they are defined correctly now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250961
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 21 Oct 2015 22:37:50 +0000 (22:37 +0000)]
AMDGPU: Fix verifier error in SIFoldOperands
There may be other use operands that also need their kill flags cleared.
This happens in a few tests when SIFoldOperands is moved after
PeepholeOptimizer.
PeepholeOptimizer rewrites cases that look like:
%vreg0 = ...
%vreg1 = COPY %vreg0
use %vreg1<kill>
%vreg2 = COPY %vreg0
use %vreg2<kill>
to use the earlier source to
%vreg0 = ...
use %vreg0
use %vreg0
Currently SIFoldOperands sees the copied registers, so there is
only one use. So far I haven't managed to come up with a test
that currently has multiple uses of a foldable VGPR -> VGPR copy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250960
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 21 Oct 2015 22:37:46 +0000 (22:37 +0000)]
AMDGPU: Split DiagnosticInfoUnsupported into its own file
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250959
91177308-0d34-0410-b5e6-
96231b3b80d8
Davide Italiano [Wed, 21 Oct 2015 22:12:03 +0000 (22:12 +0000)]
[JIT] Towards a working small memory model.
This commit introduces an option, --preallocate, so that we can get memory
upfront and use it in small memory model tests (in order to get
reliable results).
Differential Revision: http://reviews.llvm.org/D13630
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250956
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 21 Oct 2015 21:51:02 +0000 (21:51 +0000)]
AMDGPU: Simplify VOP3 operand legalization.
This was checking for a variety of situations that should
never happen. This saves a tiny bit of compile time.
We should not be selecting instructions with invalid operands in the
first place. Most of the time for registers copys are inserted
to the correct operand register class.
For VOP3, since all operand types are supported and literal
constants never are, we just need to verify the constant bus
requirements (all immediates should be legal inline ones).
The only possibly tricky case to maybe worry about is if when
legalizing operands in moveToVALU with s_add_i32 and similar
instructions. If the original s_add_i32 had a literal constant
and we need to replace it with v_add_i32_e64 we would have an
unsupported literal operand. However, I don't think we should worry
about that because SIFoldOperands should handle folding literal
constant operands into the SALU instructions based on the uses.
At SIFoldOperands time, the legality and profitability of
operand types is a bit different.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250951
91177308-0d34-0410-b5e6-
96231b3b80d8
Michael Liao [Wed, 21 Oct 2015 21:50:58 +0000 (21:50 +0000)]
[InstCombine] Revise the test case to match full sequene
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250950
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 21 Oct 2015 21:15:01 +0000 (21:15 +0000)]
AMDGPU: Fix not checking implicit operands in verifyInstruction
When verifying constant bus restrictions, this wasn't catching
uses in implicit operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250948
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 21 Oct 2015 21:10:12 +0000 (21:10 +0000)]
Use numeric_limits instead of LLONG_MAX
This is a build fix for configurations where LLONG_MAX is
not defined in system headers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250946
91177308-0d34-0410-b5e6-
96231b3b80d8
Matt Arsenault [Wed, 21 Oct 2015 21:10:10 +0000 (21:10 +0000)]
LegalizeDAG: Implement promote for build_vector
This will be used in future commits for AMDGPU to promote
operations on i64 vectors into operations on 32-bit vector
components.
This will be used / tested in future AMDGPU commits.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250945
91177308-0d34-0410-b5e6-
96231b3b80d8
Vedant Kumar [Wed, 21 Oct 2015 20:33:31 +0000 (20:33 +0000)]
[Verifier] Minor comment update, NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250943
91177308-0d34-0410-b5e6-
96231b3b80d8
Keno Fischer [Wed, 21 Oct 2015 20:22:04 +0000 (20:22 +0000)]
[RuntimeDyld] Ignore ST_FILE symbols when constructing GlobalSymbolTable
Summary: ELF's STT_File symbols may overlap with regular globals in
other files, so we should ignore them here in order to avoid having
bogus entries in the symbol table that confuse us when resolving relocations.
Reviewers: lhames
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D13888
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250942
91177308-0d34-0410-b5e6-
96231b3b80d8
Lang Hames [Wed, 21 Oct 2015 20:13:41 +0000 (20:13 +0000)]
[Orc] Clean up a comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250940
91177308-0d34-0410-b5e6-
96231b3b80d8
Joerg Sonnenberger [Wed, 21 Oct 2015 20:05:01 +0000 (20:05 +0000)]
Drop assert that a call with struct return goes to a function with sret
attribute. Clang incorrectly misses it on __muldc3 and friends and the
type system doesn't include it properly either.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250938
91177308-0d34-0410-b5e6-
96231b3b80d8
Reid Kleckner [Wed, 21 Oct 2015 19:54:40 +0000 (19:54 +0000)]
[WinEH] Add test for llvm.va.start in catchpad
It already works, but we should have a test for it.
This used to be PR23094 in the old model.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250936
91177308-0d34-0410-b5e6-
96231b3b80d8
Teresa Johnson [Wed, 21 Oct 2015 19:25:14 +0000 (19:25 +0000)]
Silence Visual C++ warning in function summary parsing code (NFC)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250929
91177308-0d34-0410-b5e6-
96231b3b80d8
Sanjay Patel [Wed, 21 Oct 2015 18:56:06 +0000 (18:56 +0000)]
[x86] move recursive add match for LEA to helper function; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250926
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaron Keren [Wed, 21 Oct 2015 18:36:52 +0000 (18:36 +0000)]
Revert r250923 as config.h is not an installed header.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250924
91177308-0d34-0410-b5e6-
96231b3b80d8
Yaron Keren [Wed, 21 Oct 2015 18:28:35 +0000 (18:28 +0000)]
Include llvm/Config/config.h in FileSystem.h as it depends upon HAVE_SYS_STAT_H which is defined (or not) in config.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250923
91177308-0d34-0410-b5e6-
96231b3b80d8
David Majnemer [Wed, 21 Oct 2015 18:22:24 +0000 (18:22 +0000)]
[SimplifyCFG] Don't use-after-free an SSA value
SimplifyTerminatorOnSelect didn't consider the possibility that the
condition might be related to one of PHI nodes.
This fixes PR25267.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250922
91177308-0d34-0410-b5e6-
96231b3b80d8
Peter Zotov [Wed, 21 Oct 2015 17:43:02 +0000 (17:43 +0000)]
[OCaml] Expose Llvm.{set_,}unnamed_addr.
Patch by Jacques-Pascal Deplaix <jp.deplaix@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250912
91177308-0d34-0410-b5e6-
96231b3b80d8
Craig Topper [Wed, 21 Oct 2015 17:26:45 +0000 (17:26 +0000)]
[X86] Add AMD mwaitx, monitorx, and clzero instructions to the assembly parser and disassembler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@250911
91177308-0d34-0410-b5e6-
96231b3b80d8