Commit Graph

148230 Commits

Author SHA1 Message Date
Simon Pilgrim
70ad9d96e1 [SelectionDAG] Pull out repeated getValueType calls. NFCI.
Noticed in D32391.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301308 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 13:39:07 +00:00
Simon Pilgrim
cda4399247 [DAGCombiner] Add vector support for (srl (trunc (srl x, c1)), c2) combine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301305 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 12:40:45 +00:00
Andrew Ng
055a715ed6 [SimplifyLibCalls] Fix infinite loop with fast-math optimization.
One of the fast-math optimizations is to replace calls to standard double
functions with their float equivalents, e.g. exp -> expf. However, this can
cause infinite loops for the following:

  float expf(float val) { return (float) exp((double) val); }

A similar inline declaration exists in the MinGW-w64 math.h header file which
when compiled with -O2/3 and fast-math generates infinite loops.

So this fix checks that the calling function to the standard double function
that is being replaced does not match the float equivalent.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301304 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 12:36:14 +00:00
Simon Pilgrim
5c072c6410 [SelectionDAG] Recognise splat vector isKnownToBeAPowerOfTwo one/sign bit shift cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301303 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 12:29:07 +00:00
Simon Pilgrim
1ef6a945eb [DAGCombiner] Use SDValue::getConstantOperandVal helper where possible. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301300 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 10:47:35 +00:00
Sanjoy Das
390033473c [IVUsers] Don't bail out of normalizing non-affine add recs
Summary:
In a previous change I changed SCEV's normalization / denormalization
to work with non-affine add recs.  So the bailout in IVUsers can be
removed.

Reviewers: atrick, efriedma

Reviewed By: atrick

Subscribers: davide, mcrosier, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301298 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:53:25 +00:00
Craig Topper
3c9711dbf2 [InstCombine] Add test cases for missing commute handling in ((A ^ C) ^ B) & (B ^ A) -> (B ^ A) & ~C
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301297 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:47:49 +00:00
Craig Topper
17d26f1cbf [InstCombine] Add test cases showing failures to handle commuted patterns after tricking the operand complexity sorting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301296 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:22:17 +00:00
Craig Topper
0e5fc34d70 [InstCombine] Use commutable matchers to reduce some code. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301294 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 06:02:11 +00:00
Gil Rapaport
e9d7fd8bfe [LV] Remove redundant basic block split
This patch is part of D28975's breakdown.

Genreating the control-flow to guard predicated instructions modified to
only use SplitBlockAndInsertIfThen() for producing the if-then construct.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301293 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 05:57:22 +00:00
Serge Guelton
42e83493f6 Update doc of the variadic version of getOrInsertFunction
It no longer needs a null terminator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301292 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 05:45:37 +00:00
Xinliang David Li
844c74b49d [CodeExtractor]: Fixup use refs of the old phi.
Differential Revision: http://reviews.llvm.org/D32468


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301291 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 04:51:19 +00:00
Akira Hatanaka
b86291cfa7 [ObjCARC] Do not sink an objc_retain past a clang.arc.use.
We need to do this to prevent a miscompile which sinks an objc_retain
past an objc_release that releases the object objc_retain retains. This
happens because the top-down and bottom-up traversals each determines
the insert point for retain or release individually without knowing
where the other instruction is moved.

For example, when the following IR is fed to the ARC optimizer, the
top-down traversal decides to insert objc_retain right before
objc_release and the bottom-up traversal decides to insert objc_release
right after clang.arc.use.

(IR before ARC optimizer)
%11 = call i8* @objc_retain(i8* %10)
call void (...) @clang.arc.use(%0* %5)
call void @llvm.dbg.value(...)
call void @objc_release(i8* %6)

This reverses the order of objc_release and objc_retain, which causes
the object to be destructed prematurely.

(IR after ARC optimizer)
call void (...) @clang.arc.use(%0* %5)
call void @objc_release(i8* %6)
call void @llvm.dbg.value(...)
%11 = call i8* @objc_retain(i8* %10)

rdar://problem/30530580

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301289 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 04:06:35 +00:00
Davide Italiano
3c385a613b [SimplifyLibCalls] Remove a cl::opt that's been true for a long time.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301288 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 03:48:47 +00:00
Sanjoy Das
79b9222927 Teach SCEV normalization to de/normalize non-affine add recs
Summary:
Before this change, SCEV Normalization would incorrectly normalize
non-affine add recurrences.  To work around this there was (still is)
a check in place to make sure we only tried to normalize affine add
recurrences.

We recently found a bug in aforementioned check to bail out of
normalizing non-affine add recurrences.  However, instead of fixing
the bailout, I have decided to teach SCEV normalization to work
correctly with non-affine add recurrences, making the bailout
unnecessary (I'll remove it in a subsequent change).

I've also added some unit tests (which would have failed before this
change).

Reviewers: atrick, sunfish, efriedma

Reviewed By: atrick

Subscribers: mcrosier, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301281 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-25 00:09:19 +00:00
Matt Arsenault
d9abaa1e08 InferAddressSpaces: Use reference arguments instead of pointers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301276 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 23:42:41 +00:00
Eugene Zelenko
c581c4ffc9 [Object] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301275 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 23:21:38 +00:00
Matt Arsenault
e6991d24a1 InferAddressSpaces: Remove redundant assert
This is just asserting all the operations are handled in the
switch, which the unreachable already handles.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301270 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 23:02:57 +00:00
Sanjay Patel
9ecbcab4f4 [ARM, x86] add more vector tests for bool math; NFC
I'm proposing a fold for increment-of-sexted-bool in:
https://reviews.llvm.org/D31944
...so we need to know what happens in more cases like these.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301269 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 22:42:34 +00:00
Reid Kleckner
154994d2b5 [git-llvm] Remove CR from middle of svn propget output
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301268 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 22:26:46 +00:00
Reid Kleckner
d2cbf1a6a4 Make getSlotAttributes return an AttributeSet instead of a wrapper list
Remove the temporary, poorly named getSlotSet method which did the same
thing. Also remove getSlotNode, which is a hold-over from when we were
dealing with AttributeSetNode* instead of AttributeSet.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301267 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 22:25:02 +00:00
Reid Kleckner
d403ad1ed0 [git-llvm] Make push work on CRLF files with svn:eol-style=native
Summary:
`git apply` on Windows doesn't work for files that SVN checks out as
CRLF. There is no way to force SVN to check everything out with Unix
line endings on Windows. Files with svn:eol-style=native will always
come out with CRLF, breaking `git apply`, which wants Unix line endings.
My workaround is to list all files with this property set in the change,
and run `dos2unix` on them. SVN doesn't commit a massive line ending
change because the svn:eol-style property indicates that these are text
files.

Tested on r301245.

Reviewers: zturner, jlebar

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301262 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 22:09:08 +00:00
Sanjay Patel
87f63fed93 [InstSimplify] use ConstantRange to simplify more and-of-icmps
We can simplify (and (icmp X, C1), (icmp X, C2)) to one of the icmps in many cases. 
I had to check some of these with Alive to prove to myself it's right, but everything 
seems to check out. Eg, the code in instcombine was completely ignoring predicates with 
mismatched signedness.

Handling or-of-icmps would be a follow-up step.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301260 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 21:52:39 +00:00
Simon Pilgrim
60823da1a9 [DAGCombiner] Use APInt::intersects to avoid tmp variable. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301258 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 21:43:21 +00:00
Matt Arsenault
c6fb348394 AMDGPU: Slightly simplify prolog reserved register handling
Rely on MachineRegisterInfo's knowledge of used physical
registers.

Move flat_scratch initialization earlier, so the uses are visible
when making these decisions.

This will make it easier to add another reserved register
at the end for the stack pointer rather than handling another
special case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301254 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 21:08:32 +00:00
Galina Kistanova
02ad713833 Cosmetic change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301253 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 21:06:29 +00:00
Saleem Abdulrasool
a2309f79ee ProfileData: clean up some stale declarations (NFC)
These were removed in SVN r300381.  Remove the declarations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301252 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 21:05:05 +00:00
Galina Kistanova
3d88243825 Small addition on how to add a builder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301248 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:48:40 +00:00
Artem Tamazov
0410a6ed65 [AMDGPU][mc][tests][NFC] Bulk ISA tests: update for Gfx7/Gfx8, add for Gfx9.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301247 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:42:27 +00:00
Reid Kleckner
b680aedb53 [Bitcode] Refactor attribute group writing to avoid getSlotAttributes
Summary:
That API creates a temporary AttributeList to carry an index and a
single AttributeSet. We need to carry the index in addition to the set,
because that is how attribute groups are currently encoded.

NFC

Reviewers: pcc

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301245 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:38:30 +00:00
Teresa Johnson
d461dcfa06 Update profile during memory instrinsic optimization
Summary:
Ensure that the new merge BB (which contains the rest of the original BB
after the mem op being optimized) gets a profile frequency, in case
there are additional mem ops later in the BB. Otherwise they get skipped
as the merge BB looks cold.

Reviewers: davidxl, xur

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301244 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:30:42 +00:00
Matt Arsenault
47fbd9bc5d Revert "StructurizeCFG: Directly invert cmp instructions"
This reverts commit r300732. This breaks a few tests.
I think the problem is related to adding more uses of
the condition that don't yet exist at this point.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301242 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:25:01 +00:00
Davide Italiano
6d9bf09a6a [LoopUnroll] Remove spurious newline.
Eli pointed out in the review, but I didn't squash the two commits
correctly. Pointy-hat to me.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301241 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:17:38 +00:00
Frederich Munch
be033a84a4 Revert "Refactor DynamicLibrary so searching for a symbol will have a defined order"
The i686-mingw32-RA-on-linux bot is still having errors.

This reverts commit r301236.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301240 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:16:01 +00:00
Davide Italiano
eb3134a13b [LoopUnroll] Don't try to unroll non canonical loops.
The current Loop Unroll implementation works with loops having a
single latch that contains a conditional branch to a block outside
the loop (the other successor is, by defition of latch, the header).
If this precondition doesn't hold, avoid unrolling the loop as
the code is not ready to handle such circumstances.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301239 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:14:11 +00:00
Sanjoy Das
cf003d753f [LIR] Obey non-integral pointer semantics
Summary: See http://llvm.org/docs/LangRef.html#non-integral-pointer-type

Reviewers: haicheng

Reviewed By: haicheng

Subscribers: mcrosier, mzolotukhin, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301238 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:12:10 +00:00
Saleem Abdulrasool
74d2cb54e4 Avoid unnecessary copies in some for loops
Use constant references rather than `const auto` which will cause the
copy constructor.  These particular cases cause issues for the swift
compiler.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301237 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 20:01:03 +00:00
Frederich Munch
f5d6c7c2d3 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@301236 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:55:16 +00:00
Krzysztof Parzyszek
f3b0bf3070 Move value type list from TargetRegisterClass to TargetRegisterInfo
Differential Revision: https://reviews.llvm.org/D31937


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301234 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:51:12 +00:00
Krzysztof Parzyszek
031e2c7f67 Revert r301231: Accidentally committed stale files
I forgot to commit local changes before commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301232 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:48:51 +00:00
Krzysztof Parzyszek
a23ad66819 Move value type list from TargetRegisterClass to TargetRegisterInfo
Differential Revision: https://reviews.llvm.org/D31937


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301231 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:43:45 +00:00
Matt Arsenault
38bd5524b0 AMDGPU: Select scratch mubuf offsets when pointer is a constant
In call sequence setups, there may not be a frame index base
and the pointer is a constant offset from the frame
pointer / scratch wave offset register.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301230 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:40:59 +00:00
Matt Arsenault
9d3f4cc120 AMDGPU: Set StackGrowsUp in MCAsmInfo
Not sure what this does though.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301229 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:40:51 +00:00
Stanislav Mekhanoshin
49a37e6bb1 [AMDGPU] Merge M0 initializations
Merges equivalent initializations of M0 and hoists them into a common
dominator block. Technically the same code can be used with any
register, physical or virtual.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301228 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:37:54 +00:00
Piotr Padlewski
698667025a Handle invariant.group.barrier in BasicAA
Summary:
llvm.invariant.group.barrier returns pointer that mustalias
pointer it takes. It can't be marked with `returned` attribute,
because it would be remove easily. The other reason is that
only Alias Analysis can know about this, because if any other
pass would know it, then the result would be replaced with it's
argument, which would be invalid.

We can think about returned pointer as something that mustalias, but
it doesn't have to be bitwise the same as the argument.

Reviewers: dberlin, chandlerc, hfinkel, sanjoy

Subscribers: reames, nlewycky, rsmith, anna, amharc

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301227 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:37:17 +00:00
Evgeniy Stepanov
759e22a147 [asan] Let the frontend disable gc-sections optimization for asan globals.
Also extend -asan-globals-live-support flag to all binary formats.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301226 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:34:13 +00:00
Mandeep Singh Grang
ba1627c465 [SimplifyCFG] Fix for non-determinism in codegen
Summary: This patch fixes issues in codegen uncovered due to https://reviews.llvm.org/D26718

Reviewers: majnemer, chenli, davide

Reviewed By: davide

Subscribers: davide, arsenm, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301222 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 19:20:45 +00:00
Krzysztof Parzyszek
36d7c2b2e5 Move size and alignment information of regclass to TargetRegisterInfo
1. RegisterClass::getSize() is split into two functions:
   - TargetRegisterInfo::getRegSizeInBits(const TargetRegisterClass &RC) const;
   - TargetRegisterInfo::getSpillSize(const TargetRegisterClass &RC) const;
2. RegisterClass::getAlignment() is replaced by:
   - TargetRegisterInfo::getSpillAlignment(const TargetRegisterClass &RC) const;

This will allow making those values depend on subtarget features in the
future.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301221 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 18:55:33 +00:00
Dimitry Andric
2b8b0a5695 Don't test setting sticky bits on files for modern BSDs
Summary: In rL297945, jhenderson added methods for setting permissions
to sys::fs, but some of the unittests that attempt to set sticky bits
(01000) on files fail on modern BSDs, such as FreeBSD, NetBSD and
OpenBSD.  This is because those systems do not allow regular users to
set sticky bits on files, only on directories.  Fix it by disabling
these particular tests on modern BSDs.

Reviewers: emaste, brad, jhenderson

Reviewed By: jhenderson

Subscribers: joerg, krytarowski, llvm-commits

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301220 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 18:54:48 +00:00
Adrian Prantl
83092adef9 Don't emit CFI instructions at the end of a function
When functions are terminated by unreachable instructions, the last
instruction might trigger a CFI instruction to be generated. However,
emitting it would be be illegal since the function (and thus the FDE
the CFI is in) has already ended with the previous instruction.

Darwin's dwarfdump --verify --eh-frame complains about this and the
specification supports this.
Relevant bits from the DWARF 5 standard (6.4 Call Frame Information):

"[The] address_range [field in an FDE]: The number of bytes of
 program instructions described by this entry."

"Row creation instructions: [...]
 The new location value is always greater than the current one."
The first quotation implies that a CFI cannot describe a target
address outside of the enclosing FDE's range.

rdar://problem/26244988

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301219 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-24 18:45:59 +00:00