[InstCombine] Don't transform code if DoTransform is false
authorGuozhi Wei <carrot@google.com>
Sat, 19 Jun 2021 01:01:34 +0000 (18:01 -0700)
committerGuozhi Wei <carrot@google.com>
Sat, 19 Jun 2021 01:01:34 +0000 (18:01 -0700)
commit575ba6f42560002807dd6382ffc83abc1b6b9b50
treebf1263469bebed4b3bc0ed43cf2da18cd43aa2a2
parentc9b241efd68c5a0f1f67e9250960ade454f3bc11
[InstCombine] Don't transform code if DoTransform is false

In patch https://reviews.llvm.org/D72396, it doesn't check DoTransform before transforming the code, and generates wrong result for the attached test case.

Differential Revision: https://reviews.llvm.org/D104567
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
llvm/test/Transforms/InstCombine/zext.ll