[InstCombine] Rephrase fix to SimplifyWithOpReplaced
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 5 Jun 2015 09:57:57 +0000 (09:57 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 5 Jun 2015 09:57:57 +0000 (09:57 +0000)
commitedbc0df974cebd05a76f17023c7e7c057f709441
tree2809c317d7b23fca6ebaab5f79732a9fe8ba9ea6
parent2a89c94df649fcf5e4f6569d1ededdb5d130bd31
[InstCombine] Rephrase fix to SimplifyWithOpReplaced

I don't have the IR which is causing the build bot breakage but I can
postulate as to why they are timing out:
1. SimplifyWithOpReplaced was stripping flags from the simplified value.
2. visitSelectInstWithICmp was overriding SimplifyWithOpReplaced because
   it's simplification wasn't correct.
3. InstCombine would revisit the add instruction and note that it can
   rederive the flags.
4. By modifying the value, we chose to revisit instructions which reuse
   the value.  One of the instructions is the original select, causing
   LLVM to never reach fixpoint.

Instead, strip the flags only when we are sure we are going to perform
the simplification.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@239141 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineSelect.cpp
test/Transforms/InstCombine/select.ll