39 Commits

Author SHA1 Message Date
Joey Gouly
94a41692b4 [InferAddressSpaces] Fix fallthrough error
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354580 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 13:10:37 +00:00
Joey Gouly
1730d3775c [InferAddressSpaces] Fix crash on select of non-ptr operands
Check the operands of a select are pointers, to determine if it is an address
expression or not.

https://reviews.llvm.org/D58226


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354576 91177308-0d34-0410-b5e6-96231b3b80d8
2019-02-21 12:31:36 +00:00
Chandler Carruth
6b547686c5 Update the file headers across all of the LLVM projects in the monorepo
to reflect the new license.

We understand that people may be surprised that we're moving the header
entirely to discuss the new license. We checked this carefully with the
Foundation's lawyer and we believe this is the correct approach.

Essentially, all code in the project is now made available by the LLVM
project under our new license, so you will see that the license headers
include that license only. Some of our contributors have contributed
code under our old license, and accordingly, we have retained a copy of
our old license notice in the top-level files in each project and
repository.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351636 91177308-0d34-0410-b5e6-96231b3b80d8
2019-01-19 08:50:56 +00:00
David Blaikie
8325fb20d4 Move Analysis/Utils/Local.h back to Transforms
Review feedback from r328165. Split out just the one function from the
file that's used by Analysis. (As chandlerc pointed out, the original
change only moved the header and not the implementation anyway - which
was fine for the one function that was used (since it's a
template/inlined in the header) but not in general)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333954 91177308-0d34-0410-b5e6-96231b3b80d8
2018-06-04 21:23:21 +00:00
Nicola Zaghen
0818e789cb Rename DEBUG macro to LLVM_DEBUG.
The DEBUG() macro is very generic so it might clash with other projects.
The renaming was done as follows:
- git grep -l 'DEBUG' | xargs sed -i 's/\bDEBUG\s\?(/LLVM_DEBUG(/g'
- git diff -U0 master | ../clang/tools/clang-format/clang-format-diff.py -i -p1 -style LLVM
- Manual change to APInt
- Manually chage DOCS as regex doesn't match it.

In the transition period the DEBUG() macro is still present and aliased
to the LLVM_DEBUG() one.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@332240 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-14 12:53:11 +00:00
Adrian Prantl
26b584c691 Remove \brief commands from doxygen comments.
We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

  for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331272 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-01 15:54:18 +00:00
David Blaikie
283527b390 Fix a couple of layering violations in Transforms
Remove #include of Transforms/Scalar.h from Transform/Utils to fix layering.

Transforms depends on Transforms/Utils, not the other way around. So
remove the header and the "createStripGCRelocatesPass" function
declaration (& definition) that is unused and motivated this dependency.

Move Transforms/Utils/Local.h into Analysis because it's used by
Analysis/MemoryBuiltins.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@328165 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-21 22:34:23 +00:00
Daniel Neilson
0f44c538fb [InferAddressSpaces] Update uses of IRBuilder memory intrinsic creation to new API
Summary:
This change is part of step five in the series of changes to remove alignment argument from
memcpy/memmove/memset in favour of alignment attributes. In particular, this changes the
InferAddressSpaces pass to cease using:
1) The old getAlignment() API of MemoryIntrinsic in favour of getting source & dest specific
alignments through the new API.
2) The old IRBuilder CreateMemCpy/CreateMemMove single-alignment APIs in favour of the new
API that allows setting source and destination alignments independently.

Steps:
Step 1) Remove alignment parameter and create alignment parameter attributes for
memcpy/memmove/memset. ( rL322965, rC322964, rL322963 )
Step 2) Expand the IRBuilder API to allow creation of memcpy/memmove with differing
source and dest alignments. ( rL323597 )
Step 3) Update Clang to use the new IRBuilder API. ( rC323617 )
Step 4) Update Polly to use the new IRBuilder API. ( rL323618 )
Step 5) Update LLVM passes that create memcpy/memmove calls to use the new IRBuilder API,
and those that use use MemIntrinsicInst::[get|set]Alignment() to use [get|set]DestAlignment()
and [get|set]SourceAlignment() instead. ( rL323886, rL323891, rL324148, rL324273, rL324278,
rL324384 )
Step 6) Remove the single-alignment IRBuilder API for memcpy/memmove, and the
MemIntrinsicInst::[get|set]Alignment() methods.

Reference
   http://lists.llvm.org/pipermail/llvm-dev/2015-August/089384.html
   http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20151109/312083.html

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@324395 91177308-0d34-0410-b5e6-96231b3b80d8
2018-02-06 20:33:36 +00:00
Daniil Fukalov
0869ae1027 [AMDGPU] fix LDS f32 intrinsics
- using qualified pointer addrspace in intrinsics class to avoid .f32 mangling
- changed too common atomic mangling to ds
- added missing intrinsics to AMDGPUTTIImpl::getTgtMemIntrinsic

Reviewed by: b-sumner

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323516 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-26 11:09:38 +00:00
Daniil Fukalov
a520636d37 [AMDGPU] add LDS f32 intrinsics
added llvm.amdgcn.atomic.{add|min|max}.f32 intrinsics
to allow generate ds_{add|min|max}[_rtn]_f32 instructions
needed for OpenCL float atomics in LDS

Reviewed by: arsenm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@322656 91177308-0d34-0410-b5e6-96231b3b80d8
2018-01-17 14:05:05 +00:00
Yaxun Liu
2bd22dfce7 InferAddressSpaces: Fix bug about replacing addrspacecast
InferAddressSpaces assumes the pointee type of addrspacecast
is the same as the operand, which is not always true and causes
invalid IR.

This bug cause build failure in HCC.

This patch fixes that.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316957 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-30 21:19:41 +00:00
Eugene Zelenko
16267f1cbc [Transforms] 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@316724 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-27 01:09:08 +00:00
Artem Belevich
c79e8ba6d6 [NVPTX] allow address space inference for volatile loads/stores.
If particular target supports volatile memory access operations, we can
avoid AS casting to generic AS. Currently it's only enabled in NVPTX for
loads and stores that access global & shared AS.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@316495 91177308-0d34-0410-b5e6-96231b3b80d8
2017-10-24 20:31:44 +00:00
Reid Kleckner
6619121492 Sink some IntrinsicInst.h and Intrinsics.h out of llvm/include
Many of these uses can get by with forward declarations. Hopefully this
speeds up compilation after adding a single intrinsic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312759 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-07 23:27:44 +00:00
Yaxun Liu
d0585d352f [InferAddressSpaces] Fix assertion about null pointer
InferAddressSpaces does not check address space in collectFlatAddressExpressions,
which causes values with non flat address space put into Postorder and causes
assertion in cloneValueWithNewAddressSpace.

This patch fixes assertion in OpenCL 2.0 conformance test generic_address_space
subtest for amdgcn target.

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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307349 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-07 02:40:13 +00:00
Craig Topper
6dbd34d261 [Constants] If we already have a ConstantInt*, prefer to use isZero/isOne/isMinusOne instead of isNullValue/isOneValue/isAllOnesValue inherited from Constant. NFCI
Going through the Constant methods requires redetermining that the Constant is a ConstantInt and then calling isZero/isOne/isMinusOne.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307292 91177308-0d34-0410-b5e6-96231b3b80d8
2017-07-06 18:39:47 +00:00
Nirav Dave
d2492e7267 InferAddressSpaces: Avoid assertion failure with replacing identical
cloned constexpr

Have cloneConstantExprWithNewAddressSpaces return nullptr when
returning initial ConstantExpr.

Reviewers: arsenm

Subscribers: jholewinski, wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304975 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-08 13:20:55 +00:00
Chandler Carruth
e3e43d9d57 Sort the remaining #include lines in include/... and lib/....
I did this a long time ago with a janky python script, but now
clang-format has built-in support for this. I fed clang-format every
line with a #include and let it re-sort things according to the precise
LLVM rules for include ordering baked into clang-format these days.

I've reverted a number of files where the results of sorting includes
isn't healthy. Either places where we have legacy code relying on
particular include ordering (where possible, I'll fix these separately)
or where we have particular formatting around #include lines that
I didn't want to disturb in this patch.

This patch is *entirely* mechanical. If you get merge conflicts or
anything, just ignore the changes in this patch and run clang-format
over your #include lines in the files.

Sorry for any noise here, but it is important to keep these things
stable. I was seeing an increasing number of patches with irrelevant
re-ordering of #include lines because clang-format was used. This patch
at least isolates that churn, makes it easy to skip when resolving
conflicts, and gets us to a clean baseline (again).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304787 91177308-0d34-0410-b5e6-96231b3b80d8
2017-06-06 11:49:48 +00:00
Sanjoy Das
399b4d037d Rename WeakVH to WeakTrackingVH; NFC
This relands r301424.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301812 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 17:07:49 +00:00
Matt Arsenault
754511fb00 InferAddressSpaces: Search constant expressions for addrspacecasts
These are pretty common when using local memory, and the 64-bit generic
addressing is much more expensive to compute.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301711 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 22:52:41 +00:00
Matt Arsenault
e91b6db85f InferAddressSpaces: Avoid looking up deleted values
While looking at pure addressing expressions, it's possible
for the value to appear later in Postorder.

I haven't been able to come up with a testcase where this
exhibits an actual issue, but if you insert a dump before
the value map lookup, a few testcases crash.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301705 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 22:18:19 +00:00
Matt Arsenault
afc9030f67 InferAddressSpaces: Infer from just addrspacecasts
Eliminates some more cases where some subset of the addressing
computation remains flat. Some cases with addrspacecasts
in nested constant expressions are still left behind however.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301704 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-28 22:18:08 +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
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
Matt Arsenault
cfadbaaf1a InferAddressSpaces: Infer for just GEPs
Fixes leaving intermediate flat addressing computations
where a GEP instruction's source is a constant expression.

Still leaves behind a trivial addrspacecast + gep pair that
instcombine is able to handle, which ideally could be folded
here directly.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301044 91177308-0d34-0410-b5e6-96231b3b80d8
2017-04-21 21:35:04 +00:00
Matt Arsenault
3c1dcddf86 AMDGPU: Add all atomicrmw fields to atomic.inc/dec
Add scope, order, isVolatile

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299122 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-30 22:21:40 +00:00
Matt Arsenault
e67c4a1dbe Bug 31948: Fix assertion when bitcasting constantexpr pointers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295387 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-17 00:32:19 +00:00
Matt Arsenault
b324cd9254 InferAddressSpaces: Handle more cases with constant select operands
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293859 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 03:37:22 +00:00
Matt Arsenault
2eab96a48c InferAddressSpaces: clang-format some things
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293843 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-02 00:28:25 +00:00
Matt Arsenault
40fe3a93e9 InferAddressSpaces: Handle select
This fails to handle some cases where one of the inputs is
a constant to be fixed in a later commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293723 91177308-0d34-0410-b5e6-96231b3b80d8
2017-02-01 00:08:53 +00:00
Matt Arsenault
adb43778a7 InferAddressSpaces: Remove dead declaration
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293720 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 23:57:20 +00:00
Matt Arsenault
08e88e4167 InferAddressSpaces: Avoid double map lookup
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293719 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 23:48:44 +00:00
Matt Arsenault
34a0d5fe90 InferAddressSpaces: Fix broken casting of constants
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293718 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 23:48:40 +00:00
Matt Arsenault
6a569f5700 InferAddressSpaces: Rename constant
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293594 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 02:17:41 +00:00
Matt Arsenault
1394a16b28 InferAddressSpaces: Handle icmp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293593 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 02:17:32 +00:00
Matt Arsenault
35b092a75f InferAddressSpaces: Support memory intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293587 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 01:56:57 +00:00
Matt Arsenault
6be67912a8 InferAddressSpaces: Support atomics
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293584 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 01:40:38 +00:00
Matt Arsenault
de6cb7e695 InferAddressSpaces: Don't replace volatile users
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293582 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 01:30:16 +00:00
Matt Arsenault
9be098398c NVPTX: Move InferAddressSpaces to generic code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@293579 91177308-0d34-0410-b5e6-96231b3b80d8
2017-01-31 01:10:58 +00:00