Issue 243730
Summary [UpdateTestChecks] unwrap_lit_if mishandles mid-line %if and %else
Labels ClangIR
Assignees
Reporter iamvickynguyen
    `unwrap_lit_if` in `llvm/utils/UpdateTestChecks/common.py`, added in #238255, ignores the `%if` condition and replaces the entire `RUN` line with the contents of the first `%{ ... %}` block.

This works for the common form where `%if` wraps the whole command, but produces incorrect results in the following cases:

### 1. `%if` appears in the middle of a command

The rest of the line is lost.

```
// RUN: %clang_cc1 %if cir-enabled %{ -fclangir %} -emit-llvm %s -o - | FileCheck %s
```

**Actual:** `-fclangir` 
**Expected:** `%clang_cc1 -fclangir -emit-llvm %s -o - | FileCheck %s`

### 2. `%else` is ignored

```
// RUN: %if cir-enabled %{ %clang_cc1 -fclangir -emit-cir %s -o - | FileCheck %s --check-prefix=CIR %} \
// RUN:   %else %{ %clang_cc1 -emit-llvm %s -o - | FileCheck %s --check-prefix=OGCG %}
```

The CIR branch is always returned, so the OGCG checks are never generated.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to