================
@@ -2778,6 +2808,60 @@ void VPWidenPointerInductionRecipe::print(raw_ostream 
&O, const Twine &Indent,
 }
 #endif
 
+void VPAliasLaneMaskRecipe::execute(VPTransformState &State) {
+  IRBuilderBase Builder = State.Builder;
+  Value *SinkValue = State.get(getSinkValue(), 0, true);
+  Value *SourceValue = State.get(getSourceValue(), 0, true);
+
+  unsigned ElementSize = 0;
+  auto *ReadInsn = cast<Instruction>(SourceValue);
+  auto *ReadCast = dyn_cast<CastInst>(SourceValue);
+  if (ReadInsn->getOpcode() == Instruction::Add)
+    ReadCast = dyn_cast<CastInst>(ReadInsn->getOperand(0));
+
+  if (ReadCast && ReadCast->getOpcode() == Instruction::PtrToInt) {
+    Value *Ptr = ReadCast->getOperand(0);
+    for (auto *Use : Ptr->users()) {
+      if (auto *GEP = dyn_cast<GetElementPtrInst>(Use)) {
+        auto *EltVT = GEP->getSourceElementType();
+        if (EltVT->isArrayTy())
+          ElementSize = EltVT->getArrayElementType()->getScalarSizeInBits() *
+                        EltVT->getArrayNumElements();
+        else
+          ElementSize = GEP->getSourceElementType()->getScalarSizeInBits() / 8;
+        break;
+      }
+    }
+  }
+  assert(ElementSize > 0 && "Couldn't get element size from pointer");
----------------
huntergr-arm wrote:

This assert fires when compiling 
`MicroBenchmarks/ImageProcessing/Dilate/CMakeFiles/Dilate.dir/dilateKernel.c` 
from the test suite, so that needs fixing at least.

But I think we shouldn't be trying to figure out the element size at recipe 
execution time; it should be determined when trying to build the recipe and the 
value stored as part of the class. If we can't find the size then we stop 
trying to build the recipe and fall back to normal RT checks. Does that sound 
sensible to you?

https://github.com/llvm/llvm-project/pull/100579
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to