summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/IRBuilder.cpp
diff options
context:
space:
mode:
authorAyal Zaks <ayal.zaks@intel.com>2017-07-31 13:21:42 +0000
committerAyal Zaks <ayal.zaks@intel.com>2017-07-31 13:21:42 +0000
commite841b214b15bcc6044ffbe61f60b78b6a7c64492 (patch)
tree12ce2c29244183308707e5b7c36c358e06df95e0 /llvm/lib/IR/IRBuilder.cpp
parent058fdd3d49c6d6640afee628bcf34bebb9738ca1 (diff)
downloadbcm5719-llvm-e841b214b15bcc6044ffbe61f60b78b6a7c64492.tar.gz
bcm5719-llvm-e841b214b15bcc6044ffbe61f60b78b6a7c64492.zip
[LV] Avoid redundant operations manipulating masks
The Loop Vectorizer generates redundant operations when manipulating masks: AND with true, OR with false, compare equal to true. Instead of relying on a subsequent pass to clean them up, this patch avoids generating them. Use null (no-mask) to represent all-one full masks, instead of a constant all-one vector, following the convention of masked gathers and scatters. Preparing for a follow-up VPlan patch in which these mask manipulating operations are modeled using recipes. Differential Revision: https://reviews.llvm.org/D35725 llvm-svn: 309558
Diffstat (limited to 'llvm/lib/IR/IRBuilder.cpp')
-rw-r--r--llvm/lib/IR/IRBuilder.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/IRBuilder.cpp b/llvm/lib/IR/IRBuilder.cpp
index b7fa07c6ffa..89338c8b849 100644
--- a/llvm/lib/IR/IRBuilder.cpp
+++ b/llvm/lib/IR/IRBuilder.cpp
@@ -356,6 +356,7 @@ CallInst *IRBuilderBase::CreateMaskedLoad(Value *Ptr, unsigned Align,
PointerType *PtrTy = cast<PointerType>(Ptr->getType());
Type *DataTy = PtrTy->getElementType();
assert(DataTy->isVectorTy() && "Ptr should point to a vector");
+ assert(Mask && "Mask should not be all-ones (null)");
if (!PassThru)
PassThru = UndefValue::get(DataTy);
Type *OverloadedTypes[] = { DataTy, PtrTy };
@@ -375,6 +376,7 @@ CallInst *IRBuilderBase::CreateMaskedStore(Value *Val, Value *Ptr,
PointerType *PtrTy = cast<PointerType>(Ptr->getType());
Type *DataTy = PtrTy->getElementType();
assert(DataTy->isVectorTy() && "Ptr should point to a vector");
+ assert(Mask && "Mask should not be all-ones (null)");
Type *OverloadedTypes[] = { DataTy, PtrTy };
Value *Ops[] = { Val, Ptr, getInt32(Align), Mask };
return CreateMaskedIntrinsic(Intrinsic::masked_store, Ops, OverloadedTypes);
OpenPOWER on IntegriCloud