<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/152630>152630</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[SDAG][X86] Miscompilation at -O3
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:X86,
miscompilation,
llvm:SelectionDAG,
generated by fuzzer
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
dtcxzyw
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dtcxzyw
</td>
</tr>
</table>
<pre>
Reproducer:
```
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@g_3 = global i8 0
@.str.62 = constant [7 x i8] c"hello\0A\00"
define i32 @main() {
entry:
%load = load i8, ptr @g_3, align 1
%.b3433 = trunc i8 %load to i1
%0 = select i1 %.b3433, i32 0, i32 -1
%conv6.i.i.i = trunc nsw i32 %0 to i8
switch i8 %conv6.i.i.i, label %if.then.i337.i.i [
i8 -1, label %common.ret
i8 0, label %common.ret
]
common.ret: ; preds = %if.then.i337.i.i, %entry, %entry
ret i32 0
if.then.i337.i.i: ; preds = %entry
%call.i3264 = tail call i32 (ptr, ...) @printf(ptr @.str.62)
br label %common.ret
}
declare i32 @printf(ptr, ...)
```
```
> lli reduced.ll
hello
```
llvm version: 3769ce013be2879bf0b329c14a16f5cb766f26ce
Reported in https://github.com/dtcxzyw/llvm-fuzz-service/issues/112.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8VE2P4ygQ_TXkgmzhwsbOwQdnstnTaqXpy95GGCoJOwQsjPvr16_ASbqzrZnEsspF1avHoyg5z-bkEHvS7AiAjur1_e2FAJBmv5FLPPvQX52b0eu3_jtOwetFYSB8IGwggl0fNkQZThipllFa-eaXSAnfUwKAxYXwAYsJWkb4wCG_0mf1-JksUedXYe5GBR3hQwVdcezY1XLZJW7poi6eUhjAB48YzGTx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