|
28 | 28 | #include "llvm/Analysis/TargetTransformInfoImpl.h" |
29 | 29 | #include "llvm/Analysis/ValueTracking.h" |
30 | 30 | #include "llvm/CodeGen/ISDOpcodes.h" |
31 | | -#include "llvm/CodeGen/SelectionDAGNodes.h" |
32 | 31 | #include "llvm/CodeGen/TargetLowering.h" |
33 | 32 | #include "llvm/CodeGen/TargetSubtargetInfo.h" |
34 | 33 | #include "llvm/CodeGen/ValueTypes.h" |
@@ -1246,13 +1245,28 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> { |
1246 | 1245 | unsigned LType = |
1247 | 1246 | ((Opcode == Instruction::ZExt) ? ISD::ZEXTLOAD : ISD::SEXTLOAD); |
1248 | 1247 |
|
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 | + } |
1256 | 1270 | } |
1257 | 1271 | } |
1258 | 1272 | break; |
|
0 commit comments