diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 315b90697cf..a3980b342c2 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -135,6 +135,10 @@ bool TailDup::canEliminateUnconditionalBranch(TerminatorInst *TI) { Instruction *User = cast(*UI); if (User->getParent() != Tail && User->getParent() != BB) return false; + + // The 'swap' problem foils the tail duplication rewriting code. + if (isa(User) && User->getParent() == Tail) + return false; } return true; } diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp index d42d0533f1c..24033f4876a 100644 --- a/lib/Transforms/Utils/LowerInvoke.cpp +++ b/lib/Transforms/Utils/LowerInvoke.cpp @@ -42,7 +42,7 @@ using namespace llvm; namespace { Statistic<> NumLowered("lowerinvoke", "Number of invoke & unwinds replaced"); - cl::opt ExpensiveEHSupport("enable-correct-eh-support", + cl::opt ExpensiveEHSupport("enable-correct-eh-support", cl::desc("Make the -lowerinvoke pass insert expensive, but correct, EH code")); class LowerInvoke : public FunctionPass {