<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/75589>75589</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            unexpected output results in fusion using -O1
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Elowen-jjw
      </td>
    </tr>
</table>

<pre>
    For the following two c files, I performed the equivalent transformation of loop from **file1.c** to **file2.c**. I ran these two files respectively using different optimization levels including **-O0**, **-O1**, **-O2**, **-O3**, **-Os**, **-Ofast**. The exact output results(i.e. checksum values) are:
```
                 -O0 -O1             -O2             -O3             -Os             -Ofast 
file1.c         5454B4A4        686D5D8F        686D5D8F        686D5D8F 686D5D8F        686D5D8F     
file2.c         5454B4A4 89CD4121        686D5D8F        686D5D8F        686D5D8F        686D5D8F 
```
 
Please help me to explain why these two files produced different output results when using the same optimization level(i.e. -O1), thank you.

command line:
```
clang <filename.c> <optimization level> -lm -I $CSMITH_HOME/include && ./a.out
```
version: clang+llvm 14.0.0
os: ubuntu 22.04

**file1.c**
```

#include "csmith.h"

static int g_a61[1];
static int64_t g_b61[1];

union U0 {
  signed f0 : 26;
  int64_t f1;
 int16_t f2;
};

static int32_t g_3 = 0x5C6F1BF5L;
static int32_t g_37 = 0x2CE6C1CCL;
static int32_t *g_121 = &g_37;
static int32_t g_168 = 0x896B5751L;
static int32_t **volatile g_217 = &g_121;
static const int32_t *g_258[2][2] = {{&g_168, &g_168}, {&g_168, &g_168}};
static int64_t g_290 = 1L;
static union U0 g_300 = {0x9E01EE1CL};
static union U0 *g_302[2][3][2] = {{{&g_300, &g_300}, {&g_300, &g_300}, {&g_300, &g_300}}, {{&g_300, &g_300}, {&g_300, &g_300}, {&g_300, &g_300}}};
static int64_t *g_455 = &g_290;
static int64_t *volatile *g_454 = &g_455;

static void func_1(void);

static void func_1(void) {
  int i, j, k;
 for (i = 0; i < 2; i++) {
    int ii_1;
    // fusion
    for (j = 0, ii_1 = 0; j < 1; j++, ii_1++) {
      for (k = 0; k < 1; k++) {
 g_a61[ii_1] = (*g_302[1][0][0]).f0 * g_37 - (*g_302[1][2][1]).f0;
 }
    }
    int jj_1;
    for (jj_1 = 0; jj_1 < 1; jj_1++) {
 g_b61[jj_1] = (*g_258[1][1]) * g_a61[jj_1] + (**g_454);
    }
  }
 (*g_217) = &g_3;
}

int main(void) {
  int i;
  int print_hash_value = 0;
  platform_main_begin();
  crc32_gentab();
 func_1();
  transparent_crc(g_3, "g_3", print_hash_value);
 transparent_crc(g_37, "g_37", print_hash_value);
 transparent_crc(g_168, "g_168", print_hash_value);
 transparent_crc(g_290, "g_290", print_hash_value);
  for (i = 0; i < 1; i++) {
    transparent_crc(g_a61[i], "g_a61[i]", print_hash_value);
 }
  for (i = 0; i < 1; i++) {
    transparent_crc(g_b61[i], "g_b61[i]", print_hash_value);
  }
  platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
  return 0;
}

```

**file2.c**
```

#include "csmith.h"

static int g_a61[1];
static int64_t g_b61[1];

union U0 {
  signed f0 : 26;
  int64_t f1;
 int16_t f2;
};

static int32_t g_3 = 0x5C6F1BF5L;
static int32_t g_37 = 0x2CE6C1CCL;
static int32_t *g_121 = &g_37;
static int32_t g_168 = 0x896B5751L;
static int32_t **volatile g_217 = &g_121;
static const int32_t *g_258[2][2] = {{&g_168, &g_168}, {&g_168, &g_168}};
static int64_t g_290 = 1L;
static union U0 g_300 = {0x9E01EE1CL};
static union U0 *g_302[2][3][2] = {{{&g_300, &g_300}, {&g_300, &g_300}, {&g_300, &g_300}}, {{&g_300, &g_300}, {&g_300, &g_300}, {&g_300, &g_300}}};
static int64_t *g_455 = &g_290;
static int64_t *volatile *g_454 = &g_455;

static void func_1(void);

static void func_1(void) {
  int i, j, k;
 for (i = 0; i < 2; i++) {
    int ii_1;
    int jj_1;
    int ij_1;
    // fusion
    for (j = 0, ii_1 = 0, jj_1 = 0, ij_1 = 0; ij_1 <= 1; ij_1++) {
      if (ij_1 <= 1 && j < 1) {
        for (k = 0; k < 1; k++) {
          g_a61[ii_1] = (*g_302[1][0][0]).f0 * g_37 - (*g_302[1][2][1]).f0;
        }
        j++;
        ii_1++;
 }
      if (ij_1 <= 1 && jj_1 < 1) {
        g_b61[jj_1] = (*g_258[1][1]) * g_a61[jj_1] + (**g_454);
        jj_1++;
      }
 }
  }
  (*g_217) = &g_3;
}

int main(void) {
  int i;
 int print_hash_value = 0;
  platform_main_begin();
 crc32_gentab();
  func_1();
  transparent_crc(g_3, "g_3", print_hash_value);
  transparent_crc(g_37, "g_37", print_hash_value);
  transparent_crc(g_168, "g_168", print_hash_value);
  transparent_crc(g_290, "g_290", print_hash_value);
  for (i = 0; i < 1; i++) {
 transparent_crc(g_a61[i], "g_a61[i]", print_hash_value);
  }
  for (i = 0; i < 1; i++) {
    transparent_crc(g_b61[i], "g_b61[i]", print_hash_value);
  }
  platform_main_end(crc32_context ^ 0xFFFFFFFFUL, print_hash_value);
  return 0;
}

```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWVtv4roW_jXmxSKyV0iABx64airNqEc6M8_IJA6YOjEncWh7fv2WnYRcCHRP1e7Rlhoh4sta37pkeeUrZVkm9gnnM-QtkLcasFwfVDpbS_XMk-Hx-DzYqfB1tlEp1geOIyWlehbJHutnhQMcCckzBEv8gE88jVQa89AK8v_l4swkTzTWKUsys8W0UAlWEZZKnXCUqhgjmCOYGxTqBMUEa9VYhmrZwQ84ZYkBz7i1bm3jlGcnHmhx5vIV55lxLRRRxFNjWp20iMX_C8OSn7nMsEgCmYdGrgAePpJiYMKoluj1ElwvuddL2fVSxDJdxfDTpOaFBRqrXJ9ybdzPpc4QTITDHRwcePCU5TE-M5mbzE4xSzly54isEJkjn5QfO8Xda_hI8PCRdtagM3c786wzNw7jwkL5ZC6b3sgbLUbzUTX3J_7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