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

    <tr>
        <th>Summary</th>
        <td>
            [SDAG] Miscompile at O3
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            miscompilation,
            llvm:SelectionDAG
      </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"

@b = dso_local local_unnamed_addr global i64 4073709551615, align 8
@c = dso_local global i8 0, align 1
@e = dso_local local_unnamed_addr global ptr @c, align 8
@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1

define i32 @main() {
entry:
  %0 = load ptr, ptr @e, align 8
  %1 = load i8, ptr %0, align 1
  %tobool.not.i = icmp eq i8 %1, 0
  %2 = load i64, ptr @b, align 8
 %and.i = shl i64 %2, 48
  %sub.i.i = and i64 %and.i, 5098637728136822784
 %sext.i = add i64 %sub.i.i, 1688849860263936
  %conv3.i = lshr i64 %sext.i, 48
  %and4.i = and i64 %conv3.i, %2
  %conv = trunc i64 %and4.i to i32
 %call1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %conv)
  ret i32 0
}

declare noundef i32 @printf(ptr noundef readonly captures(none), ...)
```
```
> ./bin/lli test.ll
2080507592
> ./bin/lli -fast-isel test.ll
1736
> ./llubi --max-steps 1000000 test.ll
1736
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyMVc2S4yYXfRq8oaRCF_3ghRea8edvlUpV5gG6kLiySTAogHrcefoUWHK3e3qRLhXNzznnHrjXIEPQZ4t4IM03AqDiePvn7ScBIM1xJ5d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