[llvm] [SelectionDAG] Introduce ISD::PTRADD (PR #140017)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri May 16 01:03:06 PDT 2025


================
@@ -469,9 +470,13 @@ class TargetMachine {
   }
 
   /// True if target has some particular form of dealing with pointer arithmetic
-  /// semantics. False if pointer arithmetic should not be preserved for passes
-  /// such as instruction selection, and can fallback to regular arithmetic.
-  virtual bool shouldPreservePtrArith(const Function &F) const { return false; }
+  /// semantics for pointers with the given value type. False if pointer
+  /// arithmetic should not be preserved for passes such as instruction
+  /// selection, and can fallback to regular arithmetic.
----------------
arsenm wrote:

Fundamentally I don't see why we would want this. We should just always useptr add. Is the plan to remove this when more code handles ptradd? Should document that 

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


More information about the llvm-commits mailing list