diff options
Diffstat (limited to 'lib/Transforms')
| -rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 6 | 
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 082dc020b0..b60d1fa972 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -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) {  | 
