[llvm] [llubi] Implement intrinsics for integer arithmetic/bit manipulation (PR #193702)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 23 08:39:52 PDT 2026


================
@@ -142,6 +153,110 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
     });
   }
 
+  AnyValue visitIntBinOpWithResult(
+      Instruction &I,
+      function_ref<AnyValue(const APInt &, const APInt &)> ScalarFn) {
+    return computeBinOp(
+        I.getType(), getValue(I.getOperand(0)), getValue(I.getOperand(1)),
+        [&](const AnyValue &LHS, const AnyValue &RHS) -> AnyValue {
+          if (LHS.isPoison() || RHS.isPoison())
+            return AnyValue::poison();
+          return ScalarFn(LHS.asInteger(), RHS.asInteger());
+        });
+  }
+
+  AnyValue visitOverflowIntBinOpWithResult(
+      CallBase &CB,
+      function_ref<std::pair<APInt, bool>(const APInt &, const APInt &)>
+          ScalarFn) {
+    const AnyValue &LHS = getValue(CB.getOperand(0));
+    const AnyValue &RHS = getValue(CB.getOperand(1));
+    if (!LHS.isAggregate())
+      return visitIntBinOpWithResult(
----------------
dtcxzyw wrote:

This is incorrect. When one of the operands is poison, it returns a scalar poison rather than a struct aggregate.


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


More information about the llvm-commits mailing list