[mlir:bazel] Expose "expsensive pattern API checks" as build flag. (#216673)
This PR exposes the `MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS`
definition as a build flag in the Bazel build. This makes it more easy
to run these expensive checks as a CI task. The new flag can be used as
follows:
```
bazelisk build \
--@llvm-project//mlir:enable_expensive_pattern_api_checks \
${BUILD_TARGETS}
```
Signed-off-by: Ingo Müller <ingomueller at google.com>
[mlir] Remove dead declaration populateSparseTensorRewriting (#216942)
The corresponding function definition was removed on July 15, 2022 in
commit 28ebb0b61d110e4b108fc1ebcbc43d50fff8f087.
[SCEV] Make operand use flags part of expression's identity. (#216604)
Update hashing for SCEVNodes to include the use-specific operand flags.
This makes sure expression with different operand flags distinct. Going
forward, this ensures that various maps that cache SCEV expressions
handle use-specific operands correctly.
PR: https://github.com/llvm/llvm-project/pull/216604
[PromoteMemToReg] Insert store undef when removing lifetime markers (#191909)
The `lifetime.start` and `lifetime.end` can help avoid the creation of
spurious phi-node.
For example, when a local struct/array is declared in a loop, Clang
will generate a `alloca` outside the loop (required) and annotate
the loop body with `lifetime.start` and `lifetime.end` to remember
that there are no loop-carried live values. It is currently mostly
used by stack coloring, but we can use it to improve SSA too.
In particular, `sroa` and `mem2reg` did not leverage those lifetime
informations and will sometimes create spurious phi-nodes that
are not always cleaned-up later on (see unit test).
As `mem2reg` simply deletes the lifetime intrinsic before promoting
to SSA, it forgets the lifetime information completely. We improve this
by inserting a `store undef` in place of each
`lifetime.start`/`lifetime.end`
[5 lines not shown]
[AMDGPU] Fix miscompile folding math calls with poison/undef vector lanes (#216971)
A poison or undef lane made evaluateCall ConstantDataVector cast fail,
and evaluateScalarMathFunc silently treated the missing operand as 0.0,
producing wrong results instead of bailing out
[AMDGPU] Fix miscompile from stale value cache in LowerBufferFatPointers (#216962)
ConvertedForStore cached a p7->int conversion per Value across the whole
function, so a second store of the same fat pointer in a non-dominating
block reused an instruction from the first block, breaking dominance
[AMDGPU] Fix crash folding cos/sin table lookups on poison/undef vector lanes (#216972)
TDOFold cast the lane directly to ConstantFP, which aborts under
assertions when a lane is poison or undef instead of a table lookup
failure
[SPIR-V] Patch invoke/callbr call sites when legalizing function signatures (#217000)
Only CallInst was patched before RAUW, leaving invoke/callbr with a
stale FunctionType and a broken verifier
follow up change for https://github.com/llvm/llvm-project/pull/216638
[AMDGPU] Fix poison result on inttoptr a narrow integer to ptr addrspace(7) in LowerBufferFatPointers (#216966)
The unconditional shift by BufferOffsetWidth overshifted for narrower
sources, folding to poison instead of the correctly zero-extended null
resource half