[PATCH] D136832: [VectorUtils] Add getShuffleDemandedElts helper
    Sanjay Patel via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Oct 30 06:35:19 PDT 2022
    
    
  
spatel added inline comments.
================
Comment at: llvm/lib/Analysis/VectorUtils.cpp:432-434
+bool llvm::getShuffleDemandedElts(int SrcWidth, ArrayRef<int> Mask,
+                                  const APInt &DemandedElts, APInt &DemandedLHS,
+                                  APInt &DemandedRHS, bool AllowUndefElts) {
----------------
RKSimon wrote:
> spatel wrote:
> > Can we assert that SrcWidth == DemandedLHS.getBitWidth() == DemandedRHS.getBitWidth() ?
> Many of the the use cases we have we could technically get away with them being entirely uninitialized upon calling getShuffleDemandedElts - (a couple still initialize before calling getShuffleDemandedElts but its unnecessary).  Which do you think is better? TBH I have no preference.
Ah, I missed that this is now init'ing with getZero(). 
That looks good. So remove init from the callers if it's still there, and add a line to the header comment to make it explicit that the LHS/RHS outputs are initialized by this function.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136832/new/
https://reviews.llvm.org/D136832
    
    
More information about the llvm-commits
mailing list