llvm-project/llvm/lib/Transforms/Vectorize
Max Kazantsev b07369651e [LV] Do not create SCEVs on broken IR in emitTransformedIndex. PR39160
At the point when we perform `emitTransformedIndex`, we have a broken IR (in
particular, we have Phis for which not every incoming value is properly set). On
such IR, it is illegal to create SCEV expressions, because their internal
simplification process may try to prove some predicates and break when it
stumbles across some broken IR.

The only purpose of using SCEV in this particular place is attempt to simplify
the generated code slightly. It seems that the result isn't worth it, because
some trivial cases (like addition of zero and multiplication by 1) can be
handled separately if needed, but more generally InstCombine is able to achieve
the goals we want to achieve by using SCEV.

This patch fixes a functional crash described in PR39160, and as side-effect it
also generates a bit smarter code in some simple cases. It also may cause some
optimality loss (i.e. we will now generate `mul` by power of `2` instead of
shift etc), but there is nothing what InstCombine could not handle later. In
case of dire need, we can support more trivial cases just in place.

Note that this patch only fixes one particular case of the general problem that
LV misuses SCEV, attempting to create SCEVs or prove predicates on invalid IR.
The general solution, however, seems complex enough.

Differential Revision: https://reviews.llvm.org/D52881
Reviewed By: fhahn, hsaito

llvm-svn: 343954
2018-10-08 05:46:29 +00:00
..
CMakeLists.txt [VPlan] Add VPInstruction to VPRecipe transformation. 2018-06-18 18:28:49 +00:00
LLVMBuild.txt
LoadStoreVectorizer.cpp LSV: Fix adjust alloca alignment trick for AMDGPU 2018-09-18 02:05:44 +00:00
LoopVectorizationLegality.cpp [LV][LAA] Vectorize loop invariant values stored into loop invariant address 2018-09-25 20:57:20 +00:00
LoopVectorizationPlanner.h [VPlan] Move recipe construction to VPRecipeBuilder. 2018-06-08 17:30:45 +00:00
LoopVectorize.cpp [LV] Do not create SCEVs on broken IR in emitTransformedIndex. PR39160 2018-10-08 05:46:29 +00:00
SLPVectorizer.cpp SLPVectorizer: Fix assert with different sized address spaces 2018-08-31 14:34:53 +00:00
VPRecipeBuilder.h [VPlan] Move recipe construction to VPRecipeBuilder. 2018-06-08 17:30:45 +00:00
VPlan.cpp Fix for the buildbot failure http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/23635 2018-09-14 02:02:57 +00:00
VPlan.h Fix for the buildbot failure http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/23635 2018-09-14 02:02:57 +00:00
VPlanDominatorTree.h [VPlan] Introduce VPlan-based dominator analysis. 2018-07-30 21:33:31 +00:00
VPlanHCFGBuilder.cpp [VPlan] Introduce VPLoopInfo analysis. 2018-07-31 01:57:29 +00:00
VPlanHCFGBuilder.h [VPlan] Introduce VPlan-based dominator analysis. 2018-07-30 21:33:31 +00:00
VPlanHCFGTransforms.cpp Fix for the buildbot failure http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/23635 2018-09-14 02:02:57 +00:00
VPlanHCFGTransforms.h [VPlan] Add VPInstruction to VPRecipe transformation. 2018-06-18 18:28:49 +00:00
VPlanLoopInfo.h [VPlan] Introduce VPLoopInfo analysis. 2018-07-31 01:57:29 +00:00
VPlanValue.h [VPlan] Implement initial vector code generation support for simple outer loops. 2018-09-14 00:36:00 +00:00
VPlanVerifier.cpp [VPlan][LV] Introduce condition bit in VPBlockBase 2018-07-09 15:57:09 +00:00
VPlanVerifier.h [VPlan] Reland r332654 and silence unused func warning 2018-05-21 18:14:23 +00:00
Vectorize.cpp [LLVM-C] [OCaml] Remove LLVMAddBBVectorizePass 2018-05-28 16:58:10 +00:00