Skip to content

Commit 63a5187

Browse files
Fix problem causing AArch masked_ldst.ll fail
1 parent 8f51e32 commit 63a5187

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "llvm/Analysis/TargetTransformInfoImpl.h"
2929
#include "llvm/Analysis/ValueTracking.h"
3030
#include "llvm/CodeGen/ISDOpcodes.h"
31-
#include "llvm/CodeGen/SelectionDAGNodes.h"
3231
#include "llvm/CodeGen/TargetLowering.h"
3332
#include "llvm/CodeGen/TargetSubtargetInfo.h"
3433
#include "llvm/CodeGen/ValueTypes.h"
@@ -1246,13 +1245,28 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
12461245
unsigned LType =
12471246
((Opcode == Instruction::ZExt) ? ISD::ZEXTLOAD : ISD::SEXTLOAD);
12481247

1249-
if (I && isa<LoadInst>(I->getOperand(0))) {
1250-
auto *LI = cast<LoadInst>(I->getOperand(0));
1251-
1252-
if (DstLT.first == SrcLT.first &&
1253-
TLI->isLoadExtLegal(LType, ExtVT, LoadVT,
1254-
LI->getPointerAddressSpace()))
1255-
return 0;
1248+
if (I) {
1249+
if (auto *LI = dyn_cast<LoadInst>(I->getOperand(0))) {
1250+
if (DstLT.first == SrcLT.first &&
1251+
TLI->isLoadExtLegal(LType, ExtVT, LoadVT,
1252+
LI->getPointerAddressSpace()))
1253+
return 0;
1254+
} else if (auto *II = dyn_cast<IntrinsicInst>(I->getOperand(0))) {
1255+
switch (II->getIntrinsicID()) {
1256+
case Intrinsic::masked_load: {
1257+
auto *PtrType = II->getArgOperand(0)->getType();
1258+
assert(PtrType->isPointerTy());
1259+
1260+
if (DstLT.first == SrcLT.first &&
1261+
TLI->isLoadExtLegal(LType, ExtVT, LoadVT,
1262+
PtrType->getPointerAddressSpace()))
1263+
return 0;
1264+
1265+
break;
1266+
}
1267+
default: break;
1268+
}
1269+
}
12561270
}
12571271
}
12581272
break;

0 commit comments

Comments
 (0)