[instcombine] Do demanded elts last when visiting extractelement
authorPhilip Reames <listmail@philipreames.com>
Thu, 9 Dec 2021 17:54:45 +0000 (09:54 -0800)
committerPhilip Reames <listmail@philipreames.com>
Thu, 9 Dec 2021 18:04:49 +0000 (10:04 -0800)
commit98f5ab6af3eda88e82c93ca05f82485b156d6126
treebd0f3137de926ed6fbb6d518ce174abc76c54704
parent4c7de4fbda03f38514c4aebed34dc2bbfb7e62a5
[instcombine] Do demanded elts last when visiting extractelement

This reorders existing transforms to put demanded elements last. The reasoning here is that when we have an example which can be scalarized or handled via demanded bits, we should prefer scalarization as that doesn't require dropping flags on arithmetic instructions.

This doesn't show major changes in the tests today, but once I add support for fast math flags to dropPoisonGeneratingFlags this becomes glaringly obvious.

Differential Revision: https://reviews.llvm.org/D115394
llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
llvm/test/Transforms/InstCombine/X86/x86-avx512-inseltpoison.ll
llvm/test/Transforms/InstCombine/X86/x86-avx512.ll
llvm/test/Transforms/InstCombine/X86/x86-fma.ll
llvm/test/Transforms/InstCombine/scalarization-inseltpoison.ll
llvm/test/Transforms/InstCombine/scalarization.ll