As an instruction is replaced in optimizeTransposes RAUW will replace it in                                                                                                                                                              
the ShapeMap (ShapeMap is ValueMap so that uses are updated).  In                                                                                                                                                                        
finalizeLowering however we skip updating uses if they are in the ShapeMap                                                                                                                                                               
since they will be lowered separately at which point we pick up the lowered                                                                                                                                                              
operands.
In the testcase what happened was that since we replaced the doubled-transpose                                                                                                                                                           
with the shuffle, it ended up in the ShapeMap.  As we lowered the                                                                                                                                                                        
columnwise-load the use in the shuffle was not updated.  Then as we removed                                                                                                                                                              
the original columnwise-load we changed that to an undef.  I.e. we ended up                                                                                                                                                              
with:
%shuf = shufflevector <8 x double> undef, <8 x double> poison, <6 x i32>                                                                                                                                                                 
                                   ^^^^^                                                                                                                                                                                                 
                                  <i32 0, i32 1, i32 2, i32 4, i32 5, i32 6>Besides the fix itself, I have fortified this last bit.  As we change uses to                                                                                                                                                            
undef when removing instruction we track the undefed instruction to make sure                                                                                                                                                            
we eventually remove those too.  This would have caught the issue at compile                                                                                                                                                             
time.
Is this to fix a separate issue? The changes seem unrelated to the ShapeInfo issue.