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

    <tr>
        <th>Summary</th>
        <td>
            Incorrect tautology diagnostic with native half‑precision
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          codemzs
      </td>
    </tr>
</table>

<pre>
    `-Wunreachable-code` is silent on targets with native FP16 support
----------------------------------------------------------------------------

### Problem
The tautology/contradiction check in **`CheckIncorrectLogicOperator`** fails on targets with **native scalar FP16** (e.g., AArch64 `+fullfp16`).  
It still works on x86‑64, so the lapse went unnoticed.

| Triple | FP16 handling | Warning? |
| ------ | ------------- | -------- |
| `x86_64-unknown-linux-gnu` | `__fp16` / `_Float16` are *promoted* to `float` (extra cast) | ✔️ emitted |
| `aarch64-unknown-linux-gnu +fullfp16` | no promotion (native arithmetic) | ❌ **missing** |

---

### Why promotion hides the bug

#### x86‑64 AST — *warning appears*
```text
BinaryOperator '_Bool' '!='
├─ ImplicitCastExpr 'float' <FloatingCast>
│  └─ ImplicitCastExpr '__fp16' <LValueToRValue>
│     └─ DeclRefExpr '__fp16' ParmVar 'x'
└─ ImplicitCastExpr 'float' <IntegralToFloating>
   └─ IntegerLiteral 'int' 0
```
AArch64 +fullfp16 AST — warning lost
```text
BinaryOperator '_Bool' '!='
├─ ImplicitCastExpr '__fp16' <LValueToRValue>
│  └─ DeclRefExpr '__fp16' ParmVar 'x'
└─ ImplicitCastExpr '__fp16' <IntegralToFloating>
   └─ IntegerLiteral 'int' 0
```
No FloatingCast → operands’ cast chains differ →`Expr::isSameComparisonOperand()` returns false → diagnostic short‑circuits.


</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VlGPmzgQ_jWTFyuRMYTAAw9sdpFWqq5Vu2ofVw4M4KuxkW022fv1JxvSJN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