[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Apr 20 22:31:30 PDT 2005



Changes in directory llvm/lib/Transforms/Utils:

SimplifyCFG.cpp updated: 1.67 -> 1.68
---
Log message:

Teach simplifycfg that setcc is cheap and non-trapping, so that it can
convert this:

        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        br bool %tmp.1, label %shortcirc_done, label %shortcirc_next

shortcirc_next:         ; preds = %entry
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        br label %shortcirc_done

shortcirc_done:         ; preds = %shortcirc_next, %entry
        %shortcirc_val = phi bool [ %tmp.4, %shortcirc_next ], [ true, %entry ]         ; <bool> [#uses=1]

to this:
        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        %shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4             ; <bool> [#uses=1]

... which is later simplified by instcombine into an or. 
 


---
Diffs of the changes:  (+6 -0)

 SimplifyCFG.cpp |    6 ++++++
 1 files changed, 6 insertions(+)


Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.67 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.68
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.67	Tue Apr 12 13:51:33 2005
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp	Thu Apr 21 00:31:13 2005
@@ -232,6 +232,12 @@
       case Instruction::Xor:
       case Instruction::Shl:
       case Instruction::Shr:
+      case Instruction::SetEQ:
+      case Instruction::SetNE:
+      case Instruction::SetLT:
+      case Instruction::SetGT:
+      case Instruction::SetLE:
+      case Instruction::SetGE:
         break;   // These are all cheap and non-trapping instructions.
       }
       






More information about the llvm-commits mailing list