Branch: refs/heads/main
Revision: ffb02f0
Author: mppf
Link: Adjust codegenSizeofLLVM to use DataLayout by mppf · Pull Request #18720 · chapel-lang/chapel · GitHub
Log Message:
Merge pull request #18720 from mppf/update-codegen-sizeof-llvm
Adjust codegenSizeofLLVM to use DataLayout
After PR #18542, we see valgrind errors / assert failures (if LLVM is built with asserts on) for these tests:
[Error matching program output for release/examples/benchmarks/hpcc/ra-atomics]
[Error matching program output for release/examples/benchmarks/hpcc/ra]
[Error matching program output for release/examples/benchmarks/hpcc/variants/ra-cleanloop]
The assertion error is coming from this line in SROA.cpp visitMemSetInst
auto *C = cast<ConstantInt>(II.getLength());
Here, the way we were generating the sizeof for the memset instruction was making a constant expression but not a constant int, causing the failure.
This PR works around the problem by generating a constant int using DataLayout. That might be more straightforward for the optimizers anyway.
- [x] ra-atomics works with valgrind
- [x] ra.chpl works with valgrind
- [x] ra-cleanloop works with valgrind
- [x] full local testing
Reviewed by @daviditen - thanks!
Modified Files:
M compiler/codegen/cg-expr.cpp
M compiler/include/llvmUtil.h
M compiler/llvm/llvmUtil.cpp
Compare: https://github.com/chapel-lang/chapel/compare/983c4bda4583...ffb02f0b4d5c