[llvm] ValueTracking: introduce llvm::isLanewiseOperation (PR #112011)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 09:30:51 PDT 2024


================
@@ -6947,6 +6947,30 @@ bool llvm::onlyUsedByLifetimeMarkersOrDroppableInsts(const Value *V) {
       V, /* AllowLifetime */ true, /* AllowDroppable */ true);
 }
 
+bool llvm::isLanewiseOperation(const Instruction *I) {
+  if (auto *II = dyn_cast<IntrinsicInst>(I)) {
+    switch (II->getIntrinsicID()) {
+    case Intrinsic::ctlz:
+    case Intrinsic::cttz:
+    case Intrinsic::ctpop:
+    case Intrinsic::umin:
+    case Intrinsic::umax:
+    case Intrinsic::smin:
+    case Intrinsic::smax:
+    case Intrinsic::usub_sat:
+    case Intrinsic::uadd_sat:
+    case Intrinsic::ssub_sat:
+    case Intrinsic::sadd_sat:
----------------
artagnon wrote:

These are technically not all the lanewise operations: they are a subset of the lanewise operations that are okay to speculatively execute.

https://github.com/llvm/llvm-project/pull/112011


More information about the llvm-commits mailing list