Commit 0a931164 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Fixed a bug in handling if (expr) node



The code to detect the type is correct in detecting Memref type or not but the below code **always** does a LoadOp.

In the case of non-memref type current value, it's causing seg-fault in LLVM internal code....
Signed-off-by: Nguyen, Thien Minh's avatarThien Nguyen <nguyentm@ornl.gov>
parent aa204568
......@@ -66,14 +66,11 @@ bit ans[9];
uint[8] a_in = 1;
uint[8] b_in = 15;
for i in [0:8] {
// FIXME: not able to do this inline....
bool b1 = bool(a_in[i]);
bool b2 = bool(b_in[i]);
if (b1) {
for i in [0:8] {
if (bool(a_in[i])) {
x a[i];
}
if (b2) {
if (bool(b_in[i])) {
x b[i];
}
}
......
......@@ -307,7 +307,9 @@ antlrcpp::Any qasm3_expression_generator::visitComparsionExpression(
? current_value.getType().cast<mlir::MemRefType>().getElementType()
: current_value.getType();
current_value = builder.create<mlir::LoadOp>(location, current_value);
if (current_value.getType().isa<mlir::MemRefType>()) {
current_value = builder.create<mlir::LoadOp>(location, current_value);
}
// ,
// get_or_create_constant_index_value(0, location, 64, symbol_table,
// builder));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment