LLVM: VectorSlice Class Reference (original) (raw)
Helper class for "break large PHIs" (visitPHINode).
This represents a slice of a PHI's incoming value, which is made up of:
- The type of the slice (Ty)
- The index in the incoming value's vector where the slice starts (Idx)
- The number of elements in the slice (NumElts). It also keeps track of the NewPHI node inserted for this particular slice.
Slice examples: <4 x i64> -> Split into four i64 slices. -> [i64, 0, 1], [i64, 1, 1], [i64, 2, 1], [i64, 3, 1] <5 x i16> -> Split into 2 <2 x i16> slices + a i16 tail. -> [<2 x i16>, 0, 2], [<2 x i16>, 2, 2], [i16, 4, 1]
Definition at line 1669 of file AMDGPUCodeGenPrepare.cpp.
Slice Inc according to the information contained within this slice.
This is cached, so if called multiple times for the same BB & Inc pair, it returns the same Sliced value as well.
Note this intentionally does not return the same value for, say, [bb.0, %0] & [bb.1, %0] as:
- It could cause issues with dominance (e.g. if bb.1 is seen first, then the value in bb.1 may not be reachable from bb.0 if it's its predecessor.)
- We also want to make our extract instructions as local as possible so the DAG has better chances of folding them out. Duplicating them like that is beneficial in that regard.
This is both a minor optimization to avoid creating duplicate instructions, but also a requirement for correctness. It is not forbidden for a PHI node to have the same [BB, Val] pair multiple times. If we returned a new value each time, those previously identical pairs would all have different incoming values (from the same block) and it'd cause a "PHI node has multiple entries for the same basic block with different incoming values!" verifier error.
Definition at line 1699 of file AMDGPUCodeGenPrepare.cpp.
References B(), llvm::dyn_cast(), llvm::BasicBlock::getTerminator(), Idx, and NumElts.