History log of /llvm-project/llvm/lib/IR/DIExpressionOptimizer.cpp (Results 1 – 2 of 2)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# dc087d1a 18-Nov-2024 Tom Honermann <tom.honermann@intel.com>

Avoid undefined behavior in shift operators during constant folding of DIExpressions. (#116466)

Bit shift operations with a shift operand greater than or equal to the bit width
of the (promoted) va

Avoid undefined behavior in shift operators during constant folding of DIExpressions. (#116466)

Bit shift operations with a shift operand greater than or equal to the bit width
of the (promoted) value type result in undefined behavior according to C++
[expr.shift]p1. This change adds checking for this situation and avoids attempts
to constant fold DIExpressions that would otherwise provoke such behavior.
An existing test that presumably intended to exercise shifts at the UB boundary
has been updated; it now checks for shifts of 64 bits instead of 65. This issue
was reported by a static analysis tool; no actual cases of shift operations that
would result in undefined behavior in practice have been identified.

show more ...


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7
# b12f81b5 29-May-2024 Shubham Sandeep Rastogi <srastogi22@apple.com>

Introduce DIExpression::foldConstantMath() (#71718)

DIExpressions can get very long and have a lot of redundant operations.
This function uses simple pattern matching to fold constant math that
ca

Introduce DIExpression::foldConstantMath() (#71718)

DIExpressions can get very long and have a lot of redundant operations.
This function uses simple pattern matching to fold constant math that
can be evaluated at compile time.

The hope is that other people can contribute other patterns as well.

I also couldn't see a good way of combining this with
`DIExpression::constantFold` so it stands alone.

This is part of a stack of patches and comes after
https://github.com/llvm/llvm-project/pull/69768
https://github.com/llvm/llvm-project/pull/71717

show more ...