Closed hooneecho closed 3 days ago
and reproduce them in compiler explore (left the links below.) (FAIL) with "-arch=spir64 -physical-storage-buffers": https://godbolt.org/z/s4o1jYjPh (SUCCESS) without "-arch=spir64 -physical-storage-buffers": https://godbolt.org/z/a5zseMbbx
when running CLSPV debug version to see the call-stack closely, GV->eraseFromParent();
was seen at lib/LongVectorLoweringPass.cpp:1972 at the very end of the CLSPV.
So, I tested again after fixing as below as a workaround, based on just a gut feeling and refering an old issue(https://github.com/google/clspv/pull/1108), and finally the compilation succeeded and the whole test passed.
diff --git a/lib/LongVectorLoweringPass.cpp b/lib/LongVectorLoweringPass.cpp
index 51c30cf4..1a12af07 100644
--- a/lib/LongVectorLoweringPass.cpp
+++ b/lib/LongVectorLoweringPass.cpp
@@ -1969,6 +1969,8 @@ void clspv::LongVectorLoweringPass::cleanDeadGlobals() {
for (auto const &Mapping : GlobalVariableMap) {
auto *GV = Mapping.first;
GV->removeDeadConstantUsers();
- GV->eraseFromParent();
+ if (GV->getNumUses() == 0) {
+ GV->eraseFromParent();
+ }
}
}
Working on the above fix by myself
I came across a compile failure while running one of the OpenCL-CTS suites (./test_vectors vec_align_struct). I was supposed to run it with 64 bit physical address support as below options, but I met an assertion during clBuildProgram.
A kernel which occured the error is like,