Issue 128309
Summary [SDAG] Miscompile at O3
Labels miscompilation, llvm:SelectionDAG
Assignees dtcxzyw
Reporter dtcxzyw
    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
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to