diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp --- a/llvm/lib/CodeGen/BranchFolding.cpp +++ b/llvm/lib/CodeGen/BranchFolding.cpp @@ -1086,6 +1086,10 @@ if (PBB->hasEHPadSuccessor()) continue; + // Skip landing pads, can't tail merge these. + if (PBB->isEHPad()) + continue; + // After block placement, only consider predecessors that belong to the // same loop as IBB. The reason is the same as above when skipping loop // header.