[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Sep 23 18:40:01 PDT 2002


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.57 -> 1.58

---
Log message:

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]




---
Diffs of the changes:

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.57 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.58
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.57	Tue Sep 17 16:05:42 2002
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Sep 23 18:39:43 2002
@@ -536,6 +536,12 @@
     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) {





More information about the llvm-commits mailing list