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: default avatarThien Nguyen <nguyentm@ornl.gov>
parent aa204568
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -67,13 +67,10 @@ 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) {
  if (bool(a_in[i])) {
    x a[i];
  }
  if (b2) {
  if (bool(b_in[i])) {
    x b[i];
  }
}
+3 −1
Original line number Diff line number Diff line
@@ -307,7 +307,9 @@ antlrcpp::Any qasm3_expression_generator::visitComparsionExpression(
            ? current_value.getType().cast<mlir::MemRefType>().getElementType()
            : current_value.getType();

    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));