[PATCH] D157590: [SCCP] Do not attempt to create constexpr for a scalable vector GEP

Rahul Anand Radhakrishnan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 01:54:57 PDT 2023


rahulana-quic created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
rahulana-quic requested review of this revision.
Herald added subscribers: llvm-commits, alextsao1999.
Herald added a project: LLVM.

Scalable vector GEPs are not constants and trying to create one for
these GEPs causes an assertion failure.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D157590

Files:
  llvm/lib/Transforms/Utils/SCCPSolver.cpp


Index: llvm/lib/Transforms/Utils/SCCPSolver.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -1539,11 +1539,13 @@
     return (void)markOverdefined(&I);
   }
 
-  Constant *Ptr = Operands[0];
-  auto Indices = ArrayRef(Operands.begin() + 1, Operands.end());
-  Constant *C =
-      ConstantExpr::getGetElementPtr(I.getSourceElementType(), Ptr, Indices);
-  markConstant(&I, C);
+  if (!I.getSourceElementType()->isScalableTy()) {
+    Constant *Ptr = Operands[0];
+    auto Indices = ArrayRef(Operands.begin() + 1, Operands.end());
+    Constant *C =
+        ConstantExpr::getGetElementPtr(I.getSourceElementType(), Ptr, Indices);
+    markConstant(&I, C);
+  }
 }
 
 void SCCPInstVisitor::visitStoreInst(StoreInst &SI) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157590.548923.patch
Type: text/x-patch
Size: 839 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230810/76251245/attachment.bin>


More information about the llvm-commits mailing list