[InstCombine] do not add "nuw" to 1<<X if the "1" has undefined elements
authorSanjay Patel <spatel@rotateright.com>
Mon, 26 Dec 2022 18:12:44 +0000 (13:12 -0500)
committerSanjay Patel <spatel@rotateright.com>
Mon, 26 Dec 2022 18:16:03 +0000 (13:16 -0500)
commita0c8017286de0cc34db41bfe7ab3176ca4f8ae64
treeb5cf483c8f557eeaecfa9b23b70fcb3d3dede662
parent00c7840115fb742cd7278a5b3f5337990429ca47
[InstCombine] do not add "nuw" to 1<<X if the "1" has undefined elements

This was noted as a potential miscompile in the post-commit feedback
for the patch that added this fold:
d4493dd1ed58ac3f1eab0
llvm/include/llvm/IR/Constant.h
llvm/lib/IR/Constants.cpp
llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
llvm/test/Transforms/InstCombine/icmp-uge-of-add-of-shl-one-by-bits-to-allones-and-val-to-icmp-eq-of-lshr-val-by-bits-and-0.ll
llvm/test/Transforms/InstCombine/icmp-ult-of-add-of-shl-one-by-bits-to-allones-and-val-to-icmp-ne-of-lshr-val-by-bits-and-0.ll