[llvm] r291673 - [SystemZ] Improve isFoldableMemAccessOffset().
Jonas Paulsson via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 11 06:40:40 PST 2017
Author: jonpa
Date: Wed Jan 11 08:40:39 2017
New Revision: 291673
URL: http://llvm.org/viewvc/llvm-project?rev=291673&view=rev
Log:
[SystemZ] Improve isFoldableMemAccessOffset().
A store of an extracted element or a load which gets inserted into a vector,
will be combined into a vector load/store element instruction.
Therefore, isFoldableMemAccessOffset(), which is called by LSR, should
return false in these cases.
Reviewer: Ulrich Weigand
Modified:
llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
Modified: llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp?rev=291673&r1=291672&r2=291673&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/SystemZISelLowering.cpp Wed Jan 11 08:40:39 2017
@@ -547,8 +547,26 @@ bool SystemZTargetLowering::isFoldableMe
assert (isa<LoadInst>(I) || isa<StoreInst>(I));
Type *MemAccessTy = (isa<LoadInst>(I) ? I->getType() :
I->getOperand(0)->getType());
- if (!isUInt<12>(Offset) &&
- (MemAccessTy->isFloatingPointTy() || MemAccessTy->isVectorTy()))
+ bool IsFPAccess = MemAccessTy->isFloatingPointTy();
+ bool IsVectorAccess = MemAccessTy->isVectorTy();
+
+ // A store of an extracted vector element will be combined into a VSTE type
+ // instruction.
+ if (!IsVectorAccess && isa<StoreInst>(I)) {
+ Value *DataOp = I->getOperand(0);
+ if (isa<ExtractElementInst>(DataOp))
+ IsVectorAccess = true;
+ }
+
+ // A load which gets inserted into a vector element will be combined into a
+ // VLE type instruction.
+ if (!IsVectorAccess && isa<LoadInst>(I) && I->hasOneUse()) {
+ User *LoadUser = *I->user_begin();
+ if (isa<InsertElementInst>(LoadUser))
+ IsVectorAccess = true;
+ }
+
+ if (!isUInt<12>(Offset) && (IsFPAccess || IsVectorAccess))
return false;
return true;
More information about the llvm-commits
mailing list