[PATCH] D136227: [LoopVectorize] Fix crash on "Cannot dereference end iterator!"(PR56627)

Dave Green via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 06:15:41 PDT 2022


dmgreen requested changes to this revision.
dmgreen added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6562
   if (match(RetI, m_ZExtOrSExt(m_Value()))) {
-    if (!RetI->hasOneUser())
+    if (!match(RetI, m_OneUse(m_Value())))
       return None;
----------------
This is very deliberately OneUser, not OneUse. It needs to match `mul(zext(x), zext(x))`


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:6567
+
+  if (match(RetI, m_Mul(m_Value(), m_Value()))) {
+    if (!match(RetI, m_OneUse(m_Value())))
----------------
Mul is probably OK with OneUse. Can it use `if (match(RetI, m_OneUse(m_Mul(m_Value(), m_Value())))) {`


================
Comment at: llvm/test/Transforms/LoopVectorize/AArch64/pr56627.ll:1
+; RUN: opt < %s -S -passes=loop-vectorize -force-vector-width=2 | FileCheck %s
+
----------------
I think you need to remove -force-vector-width=2 to reproduce the original issue.


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

https://reviews.llvm.org/D136227



More information about the llvm-commits mailing list