[PATCH] D86460: [InstCombine] improve demanded element analysis for vector insert-of-extract

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 08:21:14 PDT 2020


spatel added a subscriber: bkramer.
spatel added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp:1155
 
     simplifyAndSetOp(I, 0, PreInsertDemandedElts, UndefElts);
 
----------------
There's a logic bug with this patch as committed (and subsequently reverted - thanks @bkramer). 

We are recursively calling SimplifyDemandedVectorElts() here and that can change UndefElts to a value that does not correspond to the value that we are returning in the block of code added with this patch.

The fix is to try the PreInsertDemandedElts fold first (just re-order the code). The existing fold below that removes the insertelt seems to be immune to that problem, but I might move that too to be safer.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86460



More information about the llvm-commits mailing list