summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2024-05-02 16:26:05 -0700
committerAmir Ayupov <aaupov@fb.com>2024-05-02 16:26:05 -0700
commitf21c7c5579eaf8bfd481e2c87920b8e95f9c8ecc (patch)
tree54f0725bba8f93d16ccd6fb40371446a714bf198
parent2b1be3d4ca776d4fbcf6753078eec0ed268ff552 (diff)
[𝘀𝗽𝗿] changes introduced through rebaseupstream/users/aaupov/spr/main.bolt-ignore-returns-in-dataaggregator
Created using spr 1.3.4 [skip ci]
-rw-r--r--bolt/include/bolt/Core/BinaryFunction.h6
-rw-r--r--bolt/lib/Core/BinaryFunction.cpp6
-rw-r--r--bolt/lib/Passes/ValidateInternalCalls.cpp13
-rw-r--r--bolt/lib/Rewrite/RewriteInstance.cpp3
4 files changed, 15 insertions, 13 deletions
diff --git a/bolt/include/bolt/Core/BinaryFunction.h b/bolt/include/bolt/Core/BinaryFunction.h
index 540a9767760a..26d2d01f8626 100644
--- a/bolt/include/bolt/Core/BinaryFunction.h
+++ b/bolt/include/bolt/Core/BinaryFunction.h
@@ -361,9 +361,6 @@ private:
/// True if another function body was merged into this one.
bool HasFunctionsFoldedInto{false};
- /// True if the function has internal calls.
- bool HasInternalCalls{false};
-
/// Name for the section this function code should reside in.
std::string CodeSectionName;
@@ -1337,9 +1334,6 @@ public:
/// Return true if other functions were folded into this one.
bool hasFunctionsFoldedInto() const { return HasFunctionsFoldedInto; }
- /// Return true if the function has internal calls.
- bool hasInternalCalls() const { return HasInternalCalls; }
-
/// If this function was folded, return the function it was folded into.
BinaryFunction *getFoldedIntoFunction() const { return FoldedIntoFunction; }
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index 8b12492aa1a1..1fa96dfaabde 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -1281,7 +1281,6 @@ Error BinaryFunction::disassemble() {
// Recursive call.
TargetSymbol = getSymbol();
} else {
- HasInternalCalls = true;
if (BC.isX86()) {
// Dangerous old-style x86 PIC code. We may need to freeze this
// function, so preserve the function as is for now.
@@ -1437,6 +1436,11 @@ add_instruction:
clearList(Relocations);
+ if (!IsSimple) {
+ clearList(Instructions);
+ return createNonFatalBOLTError("");
+ }
+
updateState(State::Disassembled);
return Error::success();
diff --git a/bolt/lib/Passes/ValidateInternalCalls.cpp b/bolt/lib/Passes/ValidateInternalCalls.cpp
index 24f9bfde401a..88df2e5b59f3 100644
--- a/bolt/lib/Passes/ValidateInternalCalls.cpp
+++ b/bolt/lib/Passes/ValidateInternalCalls.cpp
@@ -309,10 +309,15 @@ Error ValidateInternalCalls::runOnFunctions(BinaryContext &BC) {
std::set<BinaryFunction *> NeedsValidation;
for (auto &BFI : BC.getBinaryFunctions()) {
BinaryFunction &Function = BFI.second;
- if (!Function.hasInternalCalls())
- continue;
- NeedsValidation.insert(&Function);
- Function.setSimple(false);
+ for (BinaryBasicBlock &BB : Function) {
+ for (MCInst &Inst : BB) {
+ if (getInternalCallTarget(Function, Inst)) {
+ NeedsValidation.insert(&Function);
+ Function.setSimple(false);
+ break;
+ }
+ }
+ }
}
// Skip validation for non-relocation mode
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index f6f597c8cee0..23f79e3c135a 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -3343,8 +3343,7 @@ void RewriteInstance::disassembleFunctions() {
if (!Function.isSimple()) {
assert((!BC->HasRelocations || Function.getSize() == 0 ||
- Function.hasIndirectTargetToSplitFragment() ||
- Function.hasInternalCalls()) &&
+ Function.hasIndirectTargetToSplitFragment()) &&
"unexpected non-simple function in relocation mode");
continue;
}