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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 10 02:15:05 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SCCPSolver.cpp:1542-1548
+  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);
+  }
----------------
I think this would be cleaner. It should gracefully handle scalable vectors and also make the folding DL-aware.


================
Comment at: llvm/test/Transforms/SCCP/vscale-gep.ll:2
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt < %s -passes=sccp,verify -S | FileCheck %s
+
----------------
verify is unnecessary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157590/new/

https://reviews.llvm.org/D157590



More information about the llvm-commits mailing list