[PATCH] D59668: [ValueTracking] Take signedness into account for and/or ranges

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 14:45:38 PDT 2019


lebedev.ri requested changes to this revision.
lebedev.ri added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/test/Transforms/InstSimplify/icmp-constant.ll:495-503
 ; -75 = 0b10110101, 53 = 0b00110101
 define i1 @and3_true1(i8 %x) {
 ; CHECK-LABEL: @and3_true1(
-; CHECK-NEXT:    [[Y:%.*]] = and i8 [[X:%.*]], -75
-; CHECK-NEXT:    [[Z:%.*]] = icmp sge i8 [[Y]], -75
-; CHECK-NEXT:    ret i1 [[Z]]
+; CHECK-NEXT:    ret i1 true
 ;
   %y = and i8 %x, -75
   %z = icmp sge i8 %y, -75
----------------
This is a miscompile, i believe.
https://rise4fun.com/Alive/R6k
```
----------------------------------------
Optimization: 1

ERROR: Mismatch in values of i1 %z

Example:
%x i8 = 0x80 (128, -128)
%y i8 = 0x80 (128, -128)
Source value: 0x0 (0)
Target value: 0x1 (1, -1)
```


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59668/new/

https://reviews.llvm.org/D59668





More information about the llvm-commits mailing list