Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2019 20:38:17 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r343102 - in stable: 11/contrib/llvm/lib/Transforms/Vectorize 12/contrib/llvm/lib/Transforms/Vectorize
Message-ID:  <201901162038.x0GKcHoU088960@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Jan 16 20:38:17 2019
New Revision: 343102
URL: https://svnweb.freebsd.org/changeset/base/343102

Log:
  Pull in r337861 from upstream llvm trunk (by Hideki Saito):
  
    [LV] Fix for PR38110, LV encountered llvm_unreachable()
  
    Summary: truncateToMinimalBitWidths() doesn't handle all Instructions
    and the worst case is compiler crash via llvm_unreachable(). Fix is
    to add a case to handle PHINode and changed the worst case to NO-OP
    (from compiler crash).
  
    Reviewers: sbaranga, mssimpso, hsaito
  
    Reviewed By: hsaito
  
    Subscribers: llvm-commits
  
    Differential Revision: https://reviews.llvm.org/D49461
  
  This should fix "Unhandled instruction type!" (if assertions are
  enabled) or segmentation faults (if assertions are disabled) when
  compiling certain versions of the net-p2p/gtk-gnutella port.
  
  Direct commit to stable/11 and stable/12, since head already has this
  fix.
  
  Reported by:	Jamie Landeg-Jones <jamie@catflap.org>
  PR:		234987

Modified:
  stable/12/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Modified: stable/12/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
==============================================================================
--- stable/12/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp	Wed Jan 16 20:20:38 2019	(r343101)
+++ stable/12/contrib/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp	Wed Jan 16 20:38:17 2019	(r343102)
@@ -4088,7 +4088,7 @@ void InnerLoopVectorizer::truncateToMinimalBitwidths()
             SI->getOperand(1), VectorType::get(ScalarTruncatedTy, Elements1));
 
         NewI = B.CreateShuffleVector(O0, O1, SI->getMask());
-      } else if (isa<LoadInst>(I)) {
+      } else if (isa<LoadInst>(I) || isa<PHINode>(I)) {
         // Don't do anything with the operands, just extend the result.
         continue;
       } else if (auto *IE = dyn_cast<InsertElementInst>(I)) {
@@ -4103,7 +4103,8 @@ void InnerLoopVectorizer::truncateToMinimalBitwidths()
             EE->getOperand(0), VectorType::get(ScalarTruncatedTy, Elements));
         NewI = B.CreateExtractElement(O0, EE->getOperand(2));
       } else {
-        llvm_unreachable("Unhandled instruction type!");
+        // If we don't know what to do, be conservative and don't do anything.
+        continue;
       }
 
       // Lastly, extend the result.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901162038.x0GKcHoU088960>