Commit Graph

16 Commits

Author SHA1 Message Date
Craig Topper
6752904763 [ScalarizeMaskedMemIntrin] Use MinAlign to calculate alignment for the scalar load/stores to handle element types that are byte-sized but not powers of 2.
This pass doesn't handle non-byte sized types correctly at all, but at least we can make byte sized types work.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343294 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 03:35:37 +00:00
Craig Topper
bcbf6bc493 [ScalarizeMaskedMemIntrin] Fix the alignment calculation for the scalar stores of a masked store expansion.
It should be the minimum of the original alignment and the scalar size.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343284 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-28 01:06:13 +00:00
Craig Topper
f947b53515 [ScalarizeMaskedMemIntrin] Ensure the mask is a vector of ConstantInts before generating the expansion without control flow.
Its possible the mask itself or one of the elements is a ConstantExpr and we shouldn't optimize in that case.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343278 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 22:31:42 +00:00
Craig Topper
5c98f23227 [ScalarizeMaskedMemIntrin] Use cast instead of dyn_cast checked by an assert. Consistently make use of the element type variable we already have. NFCI
cast will take care of asserting internally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343277 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 22:31:40 +00:00
Craig Topper
2122d188d1 [ScalarizeMaskedMemIntrin] When expanding masked gathers, start with the passthru vector and insert the new load results into it.
Previously we started with undef and did a final merge with the passthru at the end.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343273 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 21:28:59 +00:00
Craig Topper
4f95400123 [ScalarizeMaskedMemIntrin] When expanding masked loads, start with the passthru value and insert each conditional load result over their element.
Previously we started with undef and did one final merge at the end with a select.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343271 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 21:28:52 +00:00
Craig Topper
4b75b6ed93 [ScalarizeMaskedMemIntrin] Handle the case where the mask is an all zero vector.
This shouldn't really happen in practice I hope, but we tried to handle other constant cases. We missed this one because we checked for ConstantVector without realizing that zero becomes ConstantAggregateZero instead.

So instead just check for Constant and use getAggregateElement which will do the dirty work for us.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343270 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 21:28:46 +00:00
Craig Topper
1a8d3258e3 [ScalarizeMaskedMemIntrin] Remove some temporary variables that are only used by a single if condition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343268 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 21:28:41 +00:00
Craig Topper
3844ee81e3 [ScalarizeMaskedMemIntrin] Cleanup comments. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343267 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 21:28:39 +00:00
Craig Topper
b41c4e18ff [ScalarizeMaskedMemIntrin] Don't emit 'icmp eq i1 %x, 1' to check mask values. That's just %x so use that directly.
Had we emitted this IR earlier, InstCombine would have removed icmp so I'm going to assume using the i1 directly would be considered canonical.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@343244 91177308-0d34-0410-b5e6-96231b3b80d8
2018-09-27 18:01:48 +00:00
Andrei Elovikov
cefae4fb96 [CodeGen] Do not allow opt-bisect-limit to skip ScalarizeMaskedMemIntrin.
Summary:
The pass is supposed to scalarize such intrinsics if the target does not support
them natively, so if the scalarization does not happen instruction selection
crashes due to inability to lower these intrinsics.

Reviewers: andrew.w.kaylor, craig.topper

Reviewed By: andrew.w.kaylor

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330700 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-24 09:24:29 +00:00
David Blaikie
e3a9b4ce3a Fix a bunch more layering of CodeGen headers that are in Target
All these headers already depend on CodeGen headers so moving them into
CodeGen fixes the layering (since CodeGen depends on Target, not the
other way around).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318490 91177308-0d34-0410-b5e6-96231b3b80d8
2017-11-17 01:07:10 +00:00
Eugene Zelenko
5c883452a8 [CodeGen] Fix some Clang-tidy modernize-use-default-member-init and Include What You Use warnings; other minor fixes (NFC).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314363 91177308-0d34-0410-b5e6-96231b3b80d8
2017-09-27 23:26:01 +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
Matthias Braun
94c4904dc5 CodeGen: Rename DEBUG_TYPE to match passnames
Rename the DEBUG_TYPE to match the names of corresponding passes where
it makes sense. Also establish the pattern of simply referencing
DEBUG_TYPE instead of repeating the passname where possible.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303921 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-25 21:26:32 +00:00
Ayman Musa
eadb58fda7 [X86] Relocate code of replacement of subtarget unsupported masked memory intrinsics to run also on -O0 option.
Currently, when masked load, store, gather or scatter intrinsics are used, we check in CodeGenPrepare pass if the subtarget support these intrinsics, if not we replace them with scalar code - this is a functional transformation not an optimization (not optional).

CodeGenPrepare pass does not run when the optimization level is set to CodeGenOpt::None (-O0).

Functional transformation should run with all optimization levels, so here I created a new pass which runs on all optimization levels and does no more than this transformation.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@303050 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-15 11:30:54 +00:00