[PATCH] D20905: Only attempt to detect AVG if SSE2 is available

Dimitry Andric via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 05:05:50 PDT 2016


dim created this revision.
dim added reviewers: congh, eli.friedman, spatel.
dim added a subscriber: llvm-commits.

In PR29973 I reported an assertion failure when a certain loop was
optimized, for a target without SSE2 support.  It turned out this was
because of the AVG pattern detection introduced in rL253952.

Prevent the assertion failure by bailing out early in
`detectAVGPattern()`, if the target does not support SSE2.

http://reviews.llvm.org/D20905

Files:
  lib/Target/X86/X86ISelLowering.cpp

Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -27842,7 +27842,9 @@
   if (InScalarVT.getSizeInBits() <= ScalarVT.getSizeInBits())
     return SDValue();
 
-  if (Subtarget.hasAVX512()) {
+  if (!Subtarget.hasSSE2())
+    return SDValue();
+  else if (Subtarget.hasAVX512()) {
     if (VT.getSizeInBits() > 512)
       return SDValue();
   } else if (Subtarget.hasAVX2()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20905.59365.patch
Type: text/x-patch
Size: 518 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160602/e34324ae/attachment.bin>


More information about the llvm-commits mailing list