mikaelholmen wrote: I think this patch causes miscompiles. Reproduce with ```opt bbi-88690.ll -passes=instcombine -S -o -``` So with this patch instcombine turns ``` @v_936 = global i16 -3276, align 1 @v_937 = global i24 0, align 1
define i16 @main() { entry: %0 = load i16, ptr @v_936, align 1 %unsclear = and i16 %0, 32767 %resize = zext i16 %unsclear to i24 %unsclear1 = and i24 %resize, 8388607 store i24 %unsclear1, ptr @v_937, align 1 ret i16 0 } ``` into ``` @v_936 = global i16 -3276, align 1 @v_937 = global i24 0, align 1 define i16 @main() { entry: %0 = load i16, ptr @v_936, align 1 %resize = zext nneg i16 %0 to i24 store i24 %resize, ptr @v_937, align 1 ret i16 0 } ``` I.e the and with 32767 (0x7fff) is gone and instead the zext got "nneg"? But the value in v_936 can be, and actually _is_ negative. [bbi-88690.ll.gz](https://github.com/llvm/llvm-project/files/13306009/bbi-88690.ll.gz) https://github.com/llvm/llvm-project/pull/71534 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits