InstCombine: Fix infinite loop caused by visitFPTrunc
authorDavid Majnemer <david.majnemer@gmail.com>
Fri, 14 Nov 2014 21:21:15 +0000 (21:21 +0000)
committerDavid Majnemer <david.majnemer@gmail.com>
Fri, 14 Nov 2014 21:21:15 +0000 (21:21 +0000)
commit9019a6092df23d44d1f9bf5917bf454073a7a9d1
treeb0eff96ac10d7017b2319793ffa52c7d2eb4e3d5
parent1523db7c64186226317a9e5baecfbde8eb04c580
InstCombine: Fix infinite loop caused by visitFPTrunc

We would attempt to replace a fptrunc of an frem with an identical
fptrunc.  This would cause the new fptrunc to be added to the worklist.
Of course, this results in an infinite loop because we will keep
visiting the newly created fptruncs.

This fixes PR21576.

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