[PATCH] D75327: [VectorCombine] Fix assert on compare extract index

Austin Kerbow via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 27 20:52:17 PST 2020


kerbowa created this revision.
kerbowa added reviewers: arsenm, rampitec, spatel.
Herald added subscribers: llvm-commits, arphaman, hiraditya, wdng.
Herald added a project: LLVM.

Extract index could be a differnet integral type.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75327

Files:
  llvm/lib/Transforms/Vectorize/VectorCombine.cpp


Index: llvm/lib/Transforms/Vectorize/VectorCombine.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VectorCombine.cpp
+++ llvm/lib/Transforms/Vectorize/VectorCombine.cpp
@@ -46,8 +46,9 @@
 static bool isExtractExtractCheap(Instruction *Ext0, Instruction *Ext1,
                                   unsigned Opcode,
                                   const TargetTransformInfo &TTI) {
-  assert(Ext0->getOperand(1) == Ext1->getOperand(1) &&
-         isa<ConstantInt>(Ext0->getOperand(1)) &&
+  assert(isa<ConstantInt>(Ext0->getOperand(1)) &&
+         (cast<ConstantInt>(Ext0->getOperand(1))->getZExtValue() ==
+          cast<ConstantInt>(Ext1->getOperand(1))->getZExtValue()) &&
          "Expected same constant extract index");
 
   Type *ScalarTy = Ext0->getType();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75327.247162.patch
Type: text/x-patch
Size: 826 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200228/9342dc11/attachment.bin>


More information about the llvm-commits mailing list