InstructionSimplify: don't speculate about Constants changing.
authorTim Northover <tnorthover@apple.com>
Mon, 22 May 2017 21:28:08 +0000 (21:28 +0000)
committerTim Northover <tnorthover@apple.com>
Mon, 22 May 2017 21:28:08 +0000 (21:28 +0000)
commit997f5f10c6de8f0327225ff4e03582272094811a
tree269bb12909c545959c8fbe668d8c5d487a21f727
parentf12ac5b77612c9dbdbbf7f34cfda4a96d5cdc732
InstructionSimplify: don't speculate about Constants changing.

When presented with an icmp/select pair, we can end up asking what would happen
if we replaced one constant with another in an instruction. This is a mistake,
while non-constant Values could become a constant, constants cannot change and
trying to do so can lead to completely invalid IR (a GEP referencing a
non-existant field in the original case).

llvm-svn: 303580
llvm/lib/Analysis/InstructionSimplify.cpp
llvm/test/Transforms/EarlyCSE/const-speculation.ll [new file with mode: 0644]