Issue 124267
Summary [ValueTracking] miscompile in samesign compare
Labels miscompilation, llvm:optimizations
Assignees DianQK
Reporter DianQK
    #122590 and #122700 miscompile the following code:

```llvm
define i1 @src(i8 %L0, i8 %L1, i1 %V) {
  %LHS = icmp samesign ugt i8 %L0, %L1
  %R0 = sub nsw i8 %L0, %L1
  %RHS = icmp ult i8 %R0, -1
  br i1 %LHS, label %LHS_true, label %LHS_false

LHS_true:
  br label %EXIT

LHS_false:
  br label %EXIT

EXIT:
  %RET = phi i1 [ %RHS, %LHS_true ], [ %V, %LHS_false ]
 ret i1 %RET
}
```

`%RHS` should be 1: https://alive2.llvm.org/ce/z/RscAzy.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to