Move some shift transforms out of instcombine and into InstructionSimplify.
authorDuncan Sands <baldrick@free.fr>
Fri, 14 Jan 2011 00:37:45 +0000 (00:37 +0000)
committerDuncan Sands <baldrick@free.fr>
Fri, 14 Jan 2011 00:37:45 +0000 (00:37 +0000)
commitc43cee3fbb3098f0647e50dd2c13bc55b027a228
tree1e584c101d4d96ef46988fd14f156b4e74b21ec4
parent68a659d423b56e3cafcc3751b33e2472bb191048
Move some shift transforms out of instcombine and into InstructionSimplify.
While there, I noticed that the transform "undef >>a X -> undef" was wrong.
For example if X is 2 then the top two bits must be equal, so the result can
not be anything.  I fixed this in the constant folder as well.  Also, I made
the transform for "X << undef" stronger: it now folds to undef always, even
though X might be zero.  This is in accordance with the LangRef, but I must
admit that it is fairly aggressive.  Also, I added "i32 X << 32 -> undef"
following the LangRef and the constant folder, likewise fairly aggressive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123417 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/InstructionSimplify.h
lib/Analysis/InstructionSimplify.cpp
lib/Transforms/InstCombine/InstCombineShifts.cpp
lib/VMCore/ConstantFold.cpp
test/Transforms/InstCombine/shift.ll