================ @@ -428,6 +431,85 @@ Value *VPInstruction::generatePerPart(VPTransformState &State, unsigned Part) { {PredTy, ScalarTC->getType()}, {VIVElem0, ScalarTC}, nullptr, Name); } + case VPInstruction::AliasLaneMask: { + // Given a pointer A that is being stored to, and pointer B that is being + // read from, both with unknown lengths, create a mask that disables + // elements which could overlap across a loop iteration. For example, if A + // is X and B is X + 2 with VF being 4, only the final two elements of the + // loaded vector can be stored since they don't overlap with the stored + // vector. %b.vec = load %b ; = [s, t, u, v] + // [...] + // store %a, %b.vec ; only u and v can be stored as their addresses don't + // overlap with %a + (VF - 1) + Value *ReadPtr = State.get(getOperand(0), VPIteration(Part, 0)); + Value *StorePtr = State.get(getOperand(1), VPIteration(Part, 0)); + unsigned ElementSize = 0; + + // We expect the operands to the alias mask to be ptrtoint. Sometimes it's + // an add of a ptrtoint. + auto *ReadInsn = cast<Instruction>(ReadPtr); + auto *ReadCast = dyn_cast<CastInst>(ReadPtr); + 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()) { ---------------- fhahn wrote:
Execution should avoid inspecting the original IR or generated IR values. can the necessary info be encoded in the recipe? 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