[InstCombine] return when SimplifyAssociativeOrCommutative makes a change
authorSanjay Patel <spatel@rotateright.com>
Fri, 13 Jul 2018 01:18:07 +0000 (01:18 +0000)
committerSanjay Patel <spatel@rotateright.com>
Fri, 13 Jul 2018 01:18:07 +0000 (01:18 +0000)
commit70043b7e9ad7c86c61ac5087aa16c6ed366990e1
tree8dd49ed0bbfb125fb40edd7a0a700d66868431bd
parent90ad6835ddaad46efff327db0e2c83bfb1563075
[InstCombine] return when SimplifyAssociativeOrCommutative makes a change

This bug was created by rL335258 because we used to always call instsimplify
after trying the associative folds. After that change it became possible
for subsequent folds to encounter unsimplified code (and potentially assert
because of it).

Instead of carrying changed state through instcombine, we can just return
immediately. This allows instsimplify to run, so we can continue assuming
that easy folds have already occurred.

llvm-svn: 336965
llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
llvm/test/Transforms/InstCombine/and-or-icmps.ll