[MemCpyOpt] Promote both memset/memcpy sizes if differently typed.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 18 Apr 2015 17:57:41 +0000 (17:57 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 18 Apr 2015 17:57:41 +0000 (17:57 +0000)
commitebb4371478d166647018696835f9609b92026047
tree24d4228451a52edbc9ce6cf829484fa73269f1c4
parent339bc7faf04ce15fbf496453f7340fb750aebecf
[MemCpyOpt] Promote both memset/memcpy sizes if differently typed.

Followup to r235232, which caused PR23278.

We can't assume the memset and memcpy sizes have the same type, as
nothing in the language reference prevents that.
Instead, zext both to i64 if they disagree.

While there, robustify tests by using i8 %c rather than i8 0 for the
memset character.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235258 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/MemCpyOptimizer.cpp
test/Transforms/MemCpyOpt/memset-memcpy-redundant-memset.ll