mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 03:06:06 +00:00
[NFC][LoopPredication] Add parsed checks logging
Differential Revision: https://reviews.llvm.org/D157491
This commit is contained in:
parent
3d65f8211f
commit
aa603c41ca
@ -767,14 +767,23 @@ unsigned LoopPredication::widenChecks(SmallVectorImpl<Value *> &Checks,
|
||||
return NumWidened;
|
||||
}
|
||||
|
||||
bool LoopPredication::widenGuardConditions(IntrinsicInst *Guard,
|
||||
SCEVExpander &Expander) {
|
||||
static SmallVector<Value *> extractChecksFromGuard(Instruction *Guard) {
|
||||
LLVM_DEBUG(dbgs() << "Processing guard:\n");
|
||||
LLVM_DEBUG(Guard->dump());
|
||||
|
||||
TotalConsidered++;
|
||||
SmallVector<Value *, 4> Checks;
|
||||
parseWidenableGuard(Guard, Checks);
|
||||
LLVM_DEBUG(dbgs() << "Found checks:\n");
|
||||
std::for_each(Checks.begin(), Checks.end(), [](const Value *Check) {
|
||||
LLVM_DEBUG(dbgs() << *Check << "\n");
|
||||
});
|
||||
return Checks;
|
||||
}
|
||||
|
||||
bool LoopPredication::widenGuardConditions(IntrinsicInst *Guard,
|
||||
SCEVExpander &Expander) {
|
||||
TotalConsidered++;
|
||||
auto Checks = extractChecksFromGuard(Guard);
|
||||
unsigned NumWidened = widenChecks(Checks, Expander, Guard);
|
||||
if (NumWidened == 0)
|
||||
return false;
|
||||
@ -799,8 +808,6 @@ bool LoopPredication::widenGuardConditions(IntrinsicInst *Guard,
|
||||
bool LoopPredication::widenWidenableBranchGuardConditions(
|
||||
BranchInst *BI, SCEVExpander &Expander) {
|
||||
assert(isGuardAsWidenableBranch(BI) && "Must be!");
|
||||
LLVM_DEBUG(dbgs() << "Processing guard:\n");
|
||||
LLVM_DEBUG(BI->dump());
|
||||
|
||||
Value *Cond, *WC;
|
||||
BasicBlock *IfTrueBB, *IfFalseBB;
|
||||
@ -809,8 +816,7 @@ bool LoopPredication::widenWidenableBranchGuardConditions(
|
||||
(void)Parsed;
|
||||
|
||||
TotalConsidered++;
|
||||
SmallVector<Value *, 4> Checks;
|
||||
parseWidenableGuard(BI, Checks);
|
||||
auto Checks = extractChecksFromGuard(BI);
|
||||
// At the moment, our matching logic for wideable conditions implicitly
|
||||
// assumes we preserve the form: (br (and Cond, WC())). FIXME
|
||||
Checks.push_back(WC);
|
||||
|
@ -1,10 +1,15 @@
|
||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
||||
; RUN: opt -S -passes=loop-predication < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -S -passes='require<scalar-evolution>,loop-mssa(loop-predication)' -verify-memoryssa < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -S -passes=loop-predication -debug-only=loop-predication < %s 2>&1 | FileCheck %s
|
||||
; RUN: opt -S -passes='require<scalar-evolution>,loop-mssa(loop-predication)' -verify-memoryssa -debug-only=loop-predication < %s 2>&1 | FileCheck %s
|
||||
; REQUIRES: asserts
|
||||
|
||||
declare void @llvm.experimental.guard(i1, ...)
|
||||
|
||||
define i32 @test_visited(ptr %array, i32 %length, i32 %n, i32 %x) {
|
||||
; CHECK: Found checks:
|
||||
; CHECK-NEXT: %unrelated.cond = icmp eq i32 %x, %i
|
||||
; CHECK-NEXT: %within.bounds = icmp ult i32 %i, %length
|
||||
;
|
||||
; CHECK-LABEL: @test_visited(
|
||||
; CHECK-NEXT: entry:
|
||||
; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i32 [[N:%.*]], 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user