[llvm] Select binop with immediates optimization (PR #212163)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 30 09:02:33 PDT 2026


================
@@ -3064,6 +3064,14 @@ class LLVM_ABI TargetLoweringBase {
     return Value == 0;
   }
 
+  /// Return true if the specified immediate is legal immediate operation,
+  /// that is the target has instructions which can perform the operation
+  /// with the immediate without having to materialize the immediate into a
+  /// register.
+  virtual bool isLegalImmediate(unsigned Opc, const SDValue Val) const {
----------------
RKSimon wrote:

At the very least you shouldn't need a SDValue - `bool isLegalImmediate(unsigned Opc, EVT VT, int64_t Value, unsigned OpIdx) const`

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


More information about the llvm-commits mailing list