[PATCH] D101900: [InstCombine] Fold extractelement + vector GEP with one use

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 12 05:09:31 PDT 2021


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/vec_demanded_elts-inseltpoison.ll:511
 ;
   %gep = getelementptr i32, <2 x i32*> %base, i64 1
   %ee = extractelement <2 x i32*> %gep, i32 1
----------------
david-arm wrote:
> spatel wrote:
> > IIUC, this is 1 of the 2 basic patterns that we want to transform. 
> > 
> > It would be better to use different index values in the test though, so we can verify that the indexes are being translated as expected (for example, make the gep index an argument variable?).
> > 
> > If that is a good suggestion, please commit the test change as a preliminary patch (no review needed), so we just see the functional diff from this patch here.
> Hi @spatel, thanks for taking a look at the patch! I'm just not entirely clear what to do here to be honest - are you suggesting just changing `gep_vbase_w_s_idx` to take a variable index and use that instead of `1`? Or are you thinking of adding another similar test that takes a variable index?
Yes, I'd just change the function to take a variable index. 
That generalizes the test without losing anything AFAICT.


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

https://reviews.llvm.org/D101900



More information about the llvm-commits mailing list