[PATCH] D68345: Verify that assumption cache has valid entries.
Aditya Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 2 10:37:46 PDT 2019
hiraditya updated this revision to Diff 222869.
hiraditya added a comment.
remove XFAIL now that fix had landed
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68345/new/
https://reviews.llvm.org/D68345
Files:
llvm/include/llvm/Transforms/Utils/CodeExtractor.h
llvm/lib/Transforms/Utils/CodeExtractor.cpp
llvm/test/Transforms/HotColdSplit/assumption-cache-invalidation.ll
Index: llvm/test/Transforms/HotColdSplit/assumption-cache-invalidation.ll
===================================================================
--- llvm/test/Transforms/HotColdSplit/assumption-cache-invalidation.ll
+++ llvm/test/Transforms/HotColdSplit/assumption-cache-invalidation.ll
@@ -1,4 +1,5 @@
-; RUN: opt -instcombine -hotcoldsplit -instsimplify %s -o /dev/null
+; REQUIRES: asserts
+; RUN: opt -instcombine -hotcoldsplit -instsimplify -debug %s -o /dev/null
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64"
Index: llvm/lib/Transforms/Utils/CodeExtractor.cpp
===================================================================
--- llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -1568,5 +1568,17 @@
});
LLVM_DEBUG(if (verifyFunction(*oldFunction))
report_fatal_error("verification of oldFunction failed!"));
+ LLVM_DEBUG(if (AC && verifyAssumptionCache(*oldFunction, AC))
+ report_fatal_error("Stale Asumption cache for old Function!"));
return newFunction;
}
+
+bool CodeExtractor::verifyAssumptionCache(const Function& F,
+ AssumptionCache *AC) {
+ for (auto AssumeVH : AC->assumptions()) {
+ CallInst *I = cast<CallInst>(AssumeVH);
+ if (I->getParent()->getParent() != &F)
+ return true;
+ }
+ return false;
+}
Index: llvm/include/llvm/Transforms/Utils/CodeExtractor.h
===================================================================
--- llvm/include/llvm/Transforms/Utils/CodeExtractor.h
+++ llvm/include/llvm/Transforms/Utils/CodeExtractor.h
@@ -106,6 +106,11 @@
/// returns false.
Function *extractCodeRegion();
+ /// Verify that assumption cache isn't stale after a region is extracted.
+ /// Returns false when verifier finds errors. AssumptionCache is passed as
+ /// parameter to make this function stateless.
+ static bool verifyAssumptionCache(const Function& F, AssumptionCache *AC);
+
/// Test whether this code extractor is eligible.
///
/// Based on the blocks used when constructing the code extractor,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68345.222869.patch
Type: text/x-patch
Size: 2163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191002/717f8789/attachment.bin>
More information about the llvm-commits
mailing list