mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-01 00:33:09 +00:00
Optimize away cases like:
%cast109 = cast uint %cast212 to short ; <short> [#uses=1] %cast214 = cast short %cast109 to uint ; <uint> [#uses=1] %cast215 = cast uint %cast214 to short ; <short> [#uses=1] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3897 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a30b70f381
commit
d06451f920
@ -536,6 +536,12 @@ static inline bool isEliminableCastOfCast(const CastInst &CI,
|
||||
if (SrcSize >= MidSize && MidSize >= DstSize)
|
||||
return true;
|
||||
|
||||
// Cases where the source and destination type are the same, but the middle
|
||||
// type is bigger are noops.
|
||||
//
|
||||
if (SrcSize == DstSize && MidSize > SrcSize)
|
||||
return true;
|
||||
|
||||
// If we are monotonically growing, things are more complex.
|
||||
//
|
||||
if (SrcSize <= MidSize && MidSize <= DstSize) {
|
||||
|
Loading…
Reference in New Issue
Block a user