History log of /llvm-project/llvm/lib/Analysis/ConstantFolding.cpp (Results 1 – 25 of 635)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init
# 19bd2d61 20-Jan-2025 Kshitij Paranjape <kshitijvparanjape@gmail.com>

[ConstantFolding] Add ilogb in isMathLibCallNoop (#122582)

ilogb libcall was not being constant folded correctly. This patch adds
ilogb case in isMathLibCallNoop with correct error condition.

F

[ConstantFolding] Add ilogb in isMathLibCallNoop (#122582)

ilogb libcall was not being constant folded correctly. This patch adds
ilogb case in isMathLibCallNoop with correct error condition.

Fixes #101873

show more ...


# cea92446 16-Jan-2025 Lewis Crawford <lcrawford@nvidia.com>

[NVPTX] Constant fold NVVM fmin and fmax (#121966)

Add constant-folding for nvvm float/double fmin + fmax intrinsics,
including all combinations of xorsign.abs, nan-propagation, and ftz.


# 1e53f952 15-Jan-2025 Fangrui Song <i@maskray.me>

[CMake] Remove some always-true HAVE_XXX_H

These are unneeded even on AIX, PURE_WINDOWS, and ZOS (per #104706)

* HAVE_ERRNO_H: introduced by 1a93330ffa2ae2aa0b49461f05e6f0d51e8443f8 (2009) but unne

[CMake] Remove some always-true HAVE_XXX_H

These are unneeded even on AIX, PURE_WINDOWS, and ZOS (per #104706)

* HAVE_ERRNO_H: introduced by 1a93330ffa2ae2aa0b49461f05e6f0d51e8443f8 (2009) but unneeded.
The guarded ABI is unconditionally used by lldb.
* HAVE_FCNTL_H
* HAVE_FENV_H
* HAVE_SYS_STAT_H

Pull Request: https://github.com/llvm/llvm-project/pull/123087

show more ...


Revision tags: llvmorg-19.1.7
# a629d9e1 07-Jan-2025 Lewis Crawford <lcrawford@nvidia.com>

[NVPTX] Constant-folding for f2i, d2ui, f2ll etc. (#118965)

Add constant-folding support for the NVVM intrinsics for converting
float/double to signed/unsigned int32/int64 types, including all
rou

[NVPTX] Constant-folding for f2i, d2ui, f2ll etc. (#118965)

Add constant-folding support for the NVVM intrinsics for converting
float/double to signed/unsigned int32/int64 types, including all
rounding-modes and ftz modifiers.

show more ...


# 45c01e8a 19-Dec-2024 Finn Plummer <50529406+inbelic@users.noreply.github.com>

[NFC][TargetTransformInfo][VectorUtils] Consolidate `isVectorIntrinsic...` api (#117635)

- update `VectorUtils:isVectorIntrinsicWithScalarOpAtArg` to use TTI for
all uses, to allow specifiction of

[NFC][TargetTransformInfo][VectorUtils] Consolidate `isVectorIntrinsic...` api (#117635)

- update `VectorUtils:isVectorIntrinsicWithScalarOpAtArg` to use TTI for
all uses, to allow specifiction of target specific intrinsics
- add TTI to the `isVectorIntrinsicWithStructReturnOverloadAtField` api
- update TTI api to provide `isTargetIntrinsicWith...` functions and
consistently name them
- move `isTriviallyScalarizable` to VectorUtils

- update all uses of the api and provide the TTI parameter

Resolves #117030

show more ...


Revision tags: llvmorg-19.1.6
# 3654f1ba 10-Dec-2024 Paul Walker <paul.walker@arm.com>

[LLVM][IR] Add support for vector ConstantInt/FP to ConstandFolding:FoldBitCast. (#117163)


# 10f315dc 09-Dec-2024 Nikita Popov <npopov@redhat.com>

[ConstantFolding] Infer getelementptr nuw flag (#119214)

Infer nuw from nusw and nneg. This is the constant expression variant of
https://github.com/llvm/llvm-project/pull/111144.

Proof: https:/

[ConstantFolding] Infer getelementptr nuw flag (#119214)

Infer nuw from nusw and nneg. This is the constant expression variant of
https://github.com/llvm/llvm-project/pull/111144.

Proof: https://alive2.llvm.org/ce/z/ihztLy

show more ...


# 24561f44 09-Dec-2024 Benjamin Maxwell <benjamin.maxwell@arm.com>

Reland "[InstSimplify] Add basic constant folding for `llvm.sincos`" (#119192)

This calls into the existing constant folding for `llvm.sin` and
`llvm.cos`, which currently does not fold for any non

Reland "[InstSimplify] Add basic constant folding for `llvm.sincos`" (#119192)

This calls into the existing constant folding for `llvm.sin` and
`llvm.cos`, which currently does not fold for any non-finite values, so
most tests are negative tests at the moment.

Note: The constant folding does not consider the `afn` fast-math flag
and will produce the same result regardless of if the flag is set.

This is a reland of #114527 that updates the syntax of one of the tests
from: `<float 1.000000e+00, float 1.000000e+00>` to `splat (float
1.000000e+00)`.

show more ...


# c4aa67e8 08-Dec-2024 Benjamin Maxwell <benjamin.maxwell@arm.com>

Revert "[InstSimplify] Add basic constant folding for `llvm.sincos`" (#119149)

Reverts llvm/llvm-project#114527

Reverting due to buildbot failures (e.g.
https://lab.llvm.org/buildbot/#/builders/

Revert "[InstSimplify] Add basic constant folding for `llvm.sincos`" (#119149)

Reverts llvm/llvm-project#114527

Reverting due to buildbot failures (e.g.
https://lab.llvm.org/buildbot/#/builders/180/builds/9685)

show more ...


# 47df46b1 08-Dec-2024 Benjamin Maxwell <benjamin.maxwell@arm.com>

[InstSimplify] Add basic constant folding for `llvm.sincos` (#114527)

This calls into the existing constant folding for `llvm.sin` and
`llvm.cos`, which currently does not fold for any non-finite v

[InstSimplify] Add basic constant folding for `llvm.sincos` (#114527)

This calls into the existing constant folding for `llvm.sin` and
`llvm.cos`, which currently does not fold for any non-finite values, so
most tests are negative tests at the moment.

Note: The constant folding does not consider the `afn` fast-math flag
and will produce the same result regardless of if the flag is set.

show more ...


# 0d1e762d 04-Dec-2024 Pedro Lobo <pedro.lobo@tecnico.ulisboa.pt>

[InstSimplify] Refine `abs(min/undef, true)` to `poison` (#118669)

Calls to `@llvm.abs(undef, i1 true)` and `@llvm.abs(INT_MIN, i1 true)`
can be optimized to `poison` instead of `undef`.

[Alive2

[InstSimplify] Refine `abs(min/undef, true)` to `poison` (#118669)

Calls to `@llvm.abs(undef, i1 true)` and `@llvm.abs(INT_MIN, i1 true)`
can be optimized to `poison` instead of `undef`.

[Alive2](https://alive2.llvm.org/ce/z/Hg-2ug)

show more ...


# a88653a2 04-Dec-2024 Paul Walker <paul.walker@arm.com>

[LLVM][IR] When evaluating GEP offsets don't assume ConstantInt is a scalar. (#117162)


Revision tags: llvmorg-19.1.5, llvmorg-19.1.4
# cd88bfcb 13-Nov-2024 Matt Arsenault <Matthew.Arsenault@amd.com>

ConstantFolding: Do not fold fcmp of denormal without known mode (#115407)

Fixes #114947


# 5091a359 03-Nov-2024 Hubert Tong <hubert.reinterpretcast@gmail.com>

[ConstantFold] Special case log1p +/-0.0 (#114635)

C's Annex F specifies that log1p +/-0.0 returns the input value;
however, this behavior is optional and host C libraries may behave
differently.

[ConstantFold] Special case log1p +/-0.0 (#114635)

C's Annex F specifies that log1p +/-0.0 returns the input value;
however, this behavior is optional and host C libraries may behave
differently. This change applies the Annex F behavior to constant
folding by LLVM.

show more ...


# cf0b6cc7 01-Nov-2024 c8ef <c8ef@outlook.com>

Revert "[ConstantFold] Fold `tgamma` and `tgammaf` when the input parameter is a constant value." (#114496)

Reverts llvm/llvm-project#114065


# 1f07f995 01-Nov-2024 c8ef <c8ef@outlook.com>

[ConstantFold] Fold `tgamma` and `tgammaf` when the input parameter is a constant value. (#114065)

This patch adds support for constant folding for the `tgamma` and
`tgammaf` libc functions.


Revision tags: llvmorg-19.1.3
# b90ea5ca 22-Oct-2024 c8ef <c8ef@outlook.com>

[ConstantFold] Fold `erf` and `erff` when the input parameter is a constant value. (#113079)

This patch adds support for constant folding for the `erf` and `erff`
libc functions.


# a18dd290 21-Oct-2024 Nikita Popov <npopov@redhat.com>

[ConstantFolding] Set signed/implicitTrunc when handling GEP offsets

GEP offsets have sext_or_trunc semantics. We were already doing
this for the outer-most GEP, but not for the inner ones.

I belie

[ConstantFolding] Set signed/implicitTrunc when handling GEP offsets

GEP offsets have sext_or_trunc semantics. We were already doing
this for the outer-most GEP, but not for the inner ones.

I believe one of the sanitizer buildbot failures was due to this,
but I did not manage to reproduce the issue or come up with a
test case. Usually the problematic case will already be folded
away due to index type canonicalization.

show more ...


# 1336e3d0 20-Oct-2024 c8ef <c8ef@outlook.com>

[ConstantFold] Fold `ilogb` and `ilogbf` when the input parameter is a constant value. (#113014)

This patch adds support for constant folding for the `ilogb` and
`ilogbf` libc functions.


# 721b7968 18-Oct-2024 Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>

[llvm] prefer isa_and_nonnull over v && isa (#112541)

Use `isa_and_nonnull<T>(v)` instead of `v && isa<T>(v)`, where `v` is
evaluated twice in the latter.


# 255a99c2 17-Oct-2024 Nikita Popov <npopov@redhat.com>

[APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (#80309)

This fixes all the places that hit the new assertion added in
https://github.com/llvm/llvm-project/pull/106524 in t

[APInt] Fix APInt constructions where value does not fit bitwidth (NFCI) (#80309)

This fixes all the places that hit the new assertion added in
https://github.com/llvm/llvm-project/pull/106524 in tests. That is,
cases where the value passed to the APInt constructor is not an N-bit
signed/unsigned integer, where N is the bit width and signedness is
determined by the isSigned flag.

The fixes either set the correct value for isSigned, set the
implicitTrunc flag, or perform more calculations inside APInt.

Note that the assertion is currently still disabled by default, so this
patch is mostly NFC.

show more ...


# 47a6da2d 15-Oct-2024 c8ef <c8ef@outlook.com>

[ConstantFold] Fold `log1p` and `log1pf` when the input parameter is a constant value. (#112113)

This patch adds support for constant folding for the `log1p` and
`log1pf` libc functions.


Revision tags: llvmorg-19.1.2
# 923566a6 09-Oct-2024 c8ef <c8ef@outlook.com>

[ConstantFold] Fold `logb` and `logbf` when the input parameter is a constant value. (#111232)

This patch adds support for constant folding for the `logb` and `logbf`
libc functions.


# 87cdc832 08-Oct-2024 Paul Walker <paul.walker@arm.com>

[LLVM][ConstFolds] Verify a scalar src before attempting scalar->vector bitcast transformation. (#111149)

It was previously safe to assume isa<Constant{Int,FP}> meant a scalar
value. This is not tr

[LLVM][ConstFolds] Verify a scalar src before attempting scalar->vector bitcast transformation. (#111149)

It was previously safe to assume isa<Constant{Int,FP}> meant a scalar
value. This is not true when use-constant-##-for-###-splat are enabled.

show more ...


Revision tags: llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4
# 3ef64f7a 24-Aug-2024 NAKAMURA Takumi <geek4civic@gmail.com>

Revert "Enable logf128 constant folding for hosts with 128bit long double (#104929)"

ConstantFolding behaves differently depending on host's `HAS_IEE754_FLOAT128`.
LLVM should not change the behavio

Revert "Enable logf128 constant folding for hosts with 128bit long double (#104929)"

ConstantFolding behaves differently depending on host's `HAS_IEE754_FLOAT128`.
LLVM should not change the behavior depending on host configurations.

This reverts commit 14c7e4a1844904f3db9b2dc93b722925a8c66b27.
(llvmorg-20-init-3262-g14c7e4a18449 and llvmorg-20-init-3498-g001e423ac626)

show more ...


12345678910>>...26