-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
bugSomething isn't workingSomething isn't working
Description
VAST version
v0.0.66
LLVM version
19
Operating system
MacOS
Description
Vast codegen fails to identify return stmt in the function body because it only looks into the last effective stmt of the scope. Ref:
vast/lib/vast/CodeGen/CodeGenFunction.cpp
Line 258 in 27d3596
| operation get_last_effective_operation(block_t &block) { |
It can be reproduced with following snippet of code
static unsigned int var_error;
static unsigned int var_1;
unsigned int func(void) {
unsigned int local_c;
goto basic_0;
basic_3:
return local_c;
basic_2:
local_c = 0U;
goto basic_3;
basic_0:
if (var_error == 0U)
goto basic_1;
else
goto basic_2;
basic_1:
local_c = var_1;
goto basic_3;
}
Steps to Reproduce
cat << EOF > test.c
static unsigned int var_error;
static unsigned int var_1;
unsigned int func(void) {
unsigned int local_c;
goto basic_0;
basic_3:
return local_c;
basic_2:
local_c = 0U;
goto basic_3;
basic_0:
if (var_error == 0U)
goto basic_1;
else
goto basic_2;
basic_1:
local_c = var_1;
goto basic_3;
}
EOF
// Emit hl mlir
./tools/vast-front/vast-front -vast-emit-mlir=hl test.c -o test.mlir
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working