forked from OSchip/llvm-project
[IROutliner] Adding instruction strings to IRSimilarityPrinting diagnostics.
When doing some recent debugging of the IROutliner, and using the similarity pass for debugging, just having the basic block and function isn't really enough to get all the information. This adds the first and last instruction to the output of the IRSimilarityPrinting pass to give better information to a user. Reviewer: paquette Differential Revision: https://reviews.llvm.org/D94304
This commit is contained in:
parent
0be0a1237c
commit
56615a2654
|
@ -923,11 +923,16 @@ IRSimilarityAnalysisPrinterPass::run(Module &M, ModuleAnalysisManager &AM) {
|
|||
<< CandVec.begin()->getLength() << ". Found in: \n";
|
||||
for (IRSimilarityCandidate &Cand : CandVec) {
|
||||
OS << " Function: " << Cand.front()->Inst->getFunction()->getName().str()
|
||||
<< ", Basic Block: ";
|
||||
<< ", Basic Block: ";
|
||||
if (Cand.front()->Inst->getParent()->getName().str() == "")
|
||||
OS << "(unnamed)\n";
|
||||
OS << "(unnamed)";
|
||||
else
|
||||
OS << Cand.front()->Inst->getParent()->getName().str() << "\n";
|
||||
OS << Cand.front()->Inst->getParent()->getName().str();
|
||||
OS << "\n Start Instruction: ";
|
||||
Cand.frontInstruction()->print(OS);
|
||||
OS << "\n End Instruction: ";
|
||||
Cand.backInstruction()->print(OS);
|
||||
OS << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,33 +1,74 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -disable-output -S -passes=print-ir-similarity < %s 2>&1 | FileCheck %s
|
||||
|
||||
; This is a simple test to make sure the IRSimilarityIdentifier and
|
||||
; This is a simple test to make sure the IRSimilarityIdentifier and
|
||||
; IRSimilarityPrinterPass is working.
|
||||
|
||||
; CHECK: 4 candidates of length 2. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: 4 candidates of length 3. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: 4 candidates of length 4. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: 4 candidates of length 5. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: 4 candidates of length 6. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK: 4 candidates of length 2. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 4, i32* %4, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 4, i32* %4, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 4, i32* %4, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: Start Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 6, i32* %6, align 4
|
||||
; CHECK-NEXT:4 candidates of length 3. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 3, i32* %3, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 3, i32* %3, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 3, i32* %3, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: Start Instruction: store i32 4, i32* %4, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 6, i32* %6, align 4
|
||||
; CHECK-NEXT:4 candidates of length 4. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 2, i32* %2, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 2, i32* %2, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 2, i32* %2, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: Start Instruction: store i32 3, i32* %3, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 6, i32* %6, align 4
|
||||
; CHECK-NEXT:4 candidates of length 5. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 1, i32* %1, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 1, i32* %1, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 1, i32* %1, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: Start Instruction: store i32 2, i32* %2, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 6, i32* %6, align 4
|
||||
; CHECK-NEXT:4 candidates of length 6. Found in:
|
||||
; CHECK-NEXT: Function: cat, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 6, i32* %0, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 6, i32* %0, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: dog, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 6, i32* %0, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: Start Instruction: store i32 1, i32* %1, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 6, i32* %6, align 4
|
||||
|
||||
define linkonce_odr void @fish() {
|
||||
entry:
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -disable-output -S -passes=print-ir-similarity < %s 2>&1 | FileCheck --allow-empty %s
|
||||
|
||||
; Check to make sure that the IRSimilarityIdentifier and IRSimilarityPrinterPass
|
||||
; return items only within the same function when there are different sets of
|
||||
; instructions in functions.
|
||||
|
||||
; CHECK: 2 candidates of length 3. Found in:
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: 2 candidates of length 5. Found in:
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK: 2 candidates of length 3. Found in:
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: Start Instruction: %a = load i32, i32* %0, align 4
|
||||
; CHECK-NEXT: End Instruction: %c = load i32, i32* %2, align 4
|
||||
; CHECK-NEXT: Function: turtle, Basic Block: (unnamed)
|
||||
; CHECK-NEXT: Start Instruction: %b = load i32, i32* %1, align 4
|
||||
; CHECK-NEXT: End Instruction: %d = load i32, i32* %3, align 4
|
||||
; CHECK-NEXT: 2 candidates of length 5. Found in:
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 6, i32* %0, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 4, i32* %4, align 4
|
||||
; CHECK-NEXT: Function: fish, Basic Block: entry
|
||||
; CHECK-NEXT: Start Instruction: store i32 1, i32* %1, align 4
|
||||
; CHECK-NEXT: End Instruction: store i32 5, i32* %5, align 4
|
||||
|
||||
define linkonce_odr void @fish() {
|
||||
entry:
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -disable-output -S -passes=print-ir-similarity < %s 2>&1 | FileCheck --allow-empty %s
|
||||
|
||||
; This is a simple test to make sure the IRSimilarityPrinterPass returns
|
||||
|
|
Loading…
Reference in New Issue