[PATCH] D87918: [InstCombine][SVE] Skip scalable type for InstCombiner::getFlippedStrictnessPredicateAndConstant.

Huihui Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 18 10:45:13 PDT 2020


huihuiz created this revision.
huihuiz added reviewers: efriedma, sdesmalen, spatel, paulwalker-arm, david-arm.
huihuiz added a project: LLVM.
Herald added subscribers: psnobl, hiraditya, tschuett.
huihuiz requested review of this revision.

We cannot iterate on scalable vector, the number of elements is unknown at compile-time.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87918

Files:
  llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
  llvm/test/Transforms/InstCombine/vscale_cmp.ll


Index: llvm/test/Transforms/InstCombine/vscale_cmp.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/InstCombine/vscale_cmp.ll
@@ -0,0 +1,11 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -instcombine -S | FileCheck %s
+
+define <vscale x 2 x i1> @sge(<vscale x 2 x i8> %x) {
+; CHECK-LABEL: @sge(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp sge <vscale x 2 x i8> [[X:%.*]], zeroinitializer
+; CHECK-NEXT:    ret <vscale x 2 x i1> [[CMP]]
+;
+  %cmp = icmp sge <vscale x 2 x i8> %x, zeroinitializer
+  ret <vscale x 2 x i1> %cmp
+}
Index: llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -5260,8 +5260,8 @@
     // Bail out if the constant can't be safely incremented/decremented.
     if (!ConstantIsOk(CI))
       return llvm::None;
-  } else if (auto *VTy = dyn_cast<VectorType>(Type)) {
-    unsigned NumElts = cast<FixedVectorType>(VTy)->getNumElements();
+  } else if (auto *FVTy = dyn_cast<FixedVectorType>(Type)) {
+    unsigned NumElts = FVTy->getNumElements();
     for (unsigned i = 0; i != NumElts; ++i) {
       Constant *Elt = C->getAggregateElement(i);
       if (!Elt)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87918.292840.patch
Type: text/x-patch
Size: 1384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200918/07ecb6c0/attachment.bin>


More information about the llvm-commits mailing list