Function const_nuw_sub

Source
pub fn const_nuw_sub(lhs: &ValueRef, rhs: &ValueRef) -> ValueRef
Expand description

Create a NUW (No Unsigned Wrap) subtraction operation on two constant values.

§Details

Creates a new constant integer value representing the subtraction of two constant integer values, with the nuw (No Unsigned Wrap) flag set.

This function wraps the LLVMConstNUWSub function from the LLVM core library, which performs the subtraction of the right-hand side (RHS) constant integer value from the left-hand side (LHS) constant integer value and returns the result as a new constant value. The nuw flag indicates that unsigned overflow is not allowed, and if it occurs, the program’s behavior will be undefined. This allows LLVM to optimize the code under the assumption that overflow does not happen during the subtraction.

§Arguments

  • lhs - A reference to the left-hand side (LHS) constant integer value.
  • rhs - A reference to the right-hand side (RHS) constant integer value.

§Returns

Returns a new constant integer value representing the result of subtracting rhs from lhs with the nuw flag set.