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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 12 06:33:39 PDT 2024


================
@@ -3629,26 +3629,11 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
   //  * The intrinsic is speculatable.
   //  * The select condition is not a vector, or the intrinsic does not
   //    perform cross-lane operations.
-  switch (IID) {
-  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:
+  if (isSafeToSpeculativelyExecute(&CI) && isLanewiseOperation(II))
----------------
nikic wrote:

Should use isSafeToSpeculativelyExecuteWithVariableReplaced here.

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


More information about the llvm-commits mailing list