[llvm] [SelectionDAG] Move SelectionDAG::getAllOnesConstant out of line. NFC (PR #102995)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 01:13:26 PDT 2024


================
@@ -675,10 +675,7 @@ class SelectionDAG {
                       bool isTarget = false, bool isOpaque = false);
 
   SDValue getAllOnesConstant(const SDLoc &DL, EVT VT, bool IsTarget = false,
-                             bool IsOpaque = false) {
-    return getConstant(APInt::getAllOnes(VT.getScalarSizeInBits()), DL, VT,
----------------
nikic wrote:

No, constants in LLVM are zero extended by default. They only get sign extended to 64 bit as a result of normal integer promotion rules. Some APIs have a flag to switch to sign extension instead, and everyone always forgets to set it when necessary, because things look like they work correctly for small integer types. (See also https://github.com/llvm/llvm-project/pull/80309.)

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


More information about the llvm-commits mailing list