[PATCH] D78203: [VP,Integer,#2] ExpandVectorPredication pass

Simon Moll via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 8 01:03:03 PDT 2020


simoll planned changes to this revision.
simoll marked an inline comment as done.
simoll added a comment.

Will rephrase this patch with `VPIntrinsic` instead of `PredicatedInstruction` since the purpose of the latter will only become clear with generalized pattern matching/lifting optimizations to VP.



================
Comment at: llvm/include/llvm/IR/PredicatedInst.h:34
+
+class PredicatedInstruction : public User {
+public:
----------------
craig.topper wrote:
> simoll wrote:
> > craig.topper wrote:
> > > simoll wrote:
> > > > craig.topper wrote:
> > > > > Can this inherit from Instruction? Its a little surprising that it has Instruction in its name but has to be casted to Instruction.
> > > > Conceptually, `PredicatedInstruction` is a super class of `Instruction`: An `Instruction` is a `PredicatedInstruction` with the mask/evl parameters hard-wired to "all lanes true". That's why we can't make Instruction an ancestor of this one.
> > > > I'll clarify this with a comment.
> > > But a VPIntrinsic is also an Instruction isn't it? At least the CallInst for the vp intrinsic is an Instruction.
> > The whole reason for having the `PredicatedInstruction` class is that we want to add a new perspective on the IR where all instructions may be predicated (through a mask and evl). There are no VPIntrinsics in that perspective.
> > 
> > In the standard IR perspective, using the `Instruction` type, VPIntrinsics are just regular `CallInst`s calling intrinsics.
> I was just wanting to get rid of the need to cast to Instruction in copyIRFlags and getParent and replaceOperation etc. Everything this class represents must be an Instruction whether its predicated or not. No type safety comes from this class inheriting from User instead of Instruction since a CallInst to a VP intrinsic is also an Instruction.
That's exactly the point: a `PredicatedInstruction` cannot implicitly cast to an `Instruction` because that would be an implicit change of perspective.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78203/new/

https://reviews.llvm.org/D78203





More information about the llvm-commits mailing list