From b08d82d91be176046192905bd8c0f4c8d03d096e Mon Sep 17 00:00:00 2001 From: Maksim Panchenko Date: Mon, 30 Mar 2020 19:08:24 -0700 Subject: [PATCH] [BOLT] Verify exceptions action table equivalence in ICF Summary: Some functions may have exactly the same code and exception handlers. However, their action tables could be different leading to mismatching semantics. We should verify their equivalence while running ICF. (cherry picked from FBD20889035) --- bolt/src/Passes/IdenticalCodeFolding.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bolt/src/Passes/IdenticalCodeFolding.cpp b/bolt/src/Passes/IdenticalCodeFolding.cpp index 3eb637c3026e..34cea93538d3 100644 --- a/bolt/src/Passes/IdenticalCodeFolding.cpp +++ b/bolt/src/Passes/IdenticalCodeFolding.cpp @@ -289,6 +289,13 @@ bool isIdenticalWith(const BinaryFunction &A, const BinaryFunction &B, ++BBI; } + // Compare exceptions action tables. + if (A.getLSDAActionTable() != B.getLSDAActionTable() || + A.getLSDATypeTable() != B.getLSDATypeTable() || + A.getLSDATypeIndexTable() != B.getLSDATypeIndexTable()) { + return false; + } + return true; }