aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorSlava Gurevich <sgurevich@gmail.com>2025-10-25 20:35:34 -0700
committerGitHub <noreply@github.com>2025-10-25 20:35:34 -0700
commit5dcf82d3da1ff449ca3b19aed56a76112ae6c735 (patch)
tree7860890a15dae725a0621b1c7f9910cd788bb7a7 /clang/lib/CodeGen/CodeGenModule.cpp
parentc05ce9b0057c9b1413bee964bb2d400ffbddede5 (diff)
downloadllvm-5dcf82d3da1ff449ca3b19aed56a76112ae6c735.zip
llvm-5dcf82d3da1ff449ca3b19aed56a76112ae6c735.tar.gz
llvm-5dcf82d3da1ff449ca3b19aed56a76112ae6c735.tar.bz2
[MLIR] Fix use-after-move for DEBUG builds, and broken assert logic. (#164763)
These issues affect only Debug builds, and Release builds with asserts enabled. 1. In `SparseTensor.h` a variable is moved-from within an assert, introducing a side effect that alters its subsequent use, and causes divergence between Debug and Release builds (with asserts disabled). 2. In `IterationGraphSorter.cpp`, the class constructor arguments are moved-from to initialize class member variables via the initializer list. Because both the arguments and class members are identically named, there's a naming collision where the arguments shadow their identically-named member variables counterparts inside the constructor body. In the original code, unqualified names inside the asserts, referred to the constructor arguments. This is wrong, because these have already been moved-from. It's not just a UB, but is broken. These SmallVector types when moved-from are reset i.e. the size resets to 0. This actually renders the affected asserts ineffective, since the comparisons operate on two hollowed-out objects and always succeed. This name ambiguity is fixed by using 'this->' to correctly refer to the initialized member variables carrying the relevant state. 3. While the fix 2 above made the asserts act as intended, it also unexpectedly broke one mlir test: `llvm-lit -v mlir/test/Dialect/SparseTensor/sparse_scalars.mlir` This required fixing the assert logic itself, which likely has never worked and went unnoticed all this time due to the bug 2. Specifically, in the failing test that uses `mlir/test/Dialect/SparseTensor/sparse_scalars.mlir` the '%argq' of 'ins' is defined as 'f32' scalar type, but the original code inside the assert had no support for scalar types as written, and was breaking the test. Testing: ``` ninja check-mlir llvm-lit -v mlir/test/Dialect/SparseTensor/sparse_scalars.mlir ```
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions