[PATCH] D47216: [LV] Fix to pr37515, FP primary induction crashes LV

Hideki Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 22 12:32:12 PDT 2018


hsaito created this revision.
hsaito added reviewers: Ayal, mkuper, spatel, rengolin.
Herald added a subscriber: llvm-commits.

LV never had an ability to convert FP primary induction to INT primary induction, but it has been lacking an appropriate safety check.
Whether it's legal to convert FP primary induction to INT primary induction and if so under what conditions are debatable, but bailing
out when it's not proven safe (and currently never proven to be safe as far as LV's existing code is concerned) is a valid thing to do.

The bug may be introduced (or exposed depending on how you see it) by FP induction support ( approx. 2yrs ago?).


Repository:
  rL LLVM

https://reviews.llvm.org/D47216

Files:
  lib/Transforms/Vectorize/LoopVectorizationLegality.cpp


Index: lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
===================================================================
--- lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -726,7 +726,7 @@
 
   if (!PrimaryInduction) {
     LLVM_DEBUG(dbgs() << "LV: Did not find one integer induction var.\n");
-    if (Inductions.empty()) {
+    if (Inductions.empty() || !WidestIndTy) {
       ORE->emit(createMissedAnalysis("NoInductionVariable")
                 << "loop induction variable could not be identified");
       return false;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47216.148074.patch
Type: text/x-patch
Size: 606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180522/29e1ce75/attachment.bin>


More information about the llvm-commits mailing list