From 1d20c02f55f5cba7591362de4c5078309fb57be0 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Thu, 24 Jan 2013 08:22:40 +0000 Subject: Lift a cheap early exit test above loops and other complex early exit tests. No need to pay the high cost when we're never going to do anything. No functionality changed. llvm-svn: 173331 --- llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp') diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 21d156d..fc84c4a 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1370,6 +1370,11 @@ static bool SinkThenElseCodeToEnd(BranchInst *BI1) { /// /// \returns true if the conditional block is removed. static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) { + // Be conservative for now. FP select instruction can often be expensive. + Value *BrCond = BI->getCondition(); + if (isa(BrCond)) + return false; + // Only speculatively execution a single instruction (not counting the // terminator) for now. Instruction *HInst = NULL; @@ -1409,11 +1414,6 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *BB1) { } } - // Be conservative for now. FP select instruction can often be expensive. - Value *BrCond = BI->getCondition(); - if (isa(BrCond)) - return false; - // If BB1 is actually on the false edge of the conditional branch, remember // to swap the select operands later. bool Invert = false; -- cgit v1.1