From 73f1f3be46652d3f6df61b4234c366ebbf81274a Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Wed, 28 Oct 2015 15:28:08 -0700 Subject: Move loop invariant utility to more general place. Change-Id: I15ebfbf9684f0fcce9e63d078ff8dc1381fd1ca3 --- compiler/optimizing/nodes.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/optimizing/nodes.h') diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h index 7ac39d1a8e..0565c9a1cb 100644 --- a/compiler/optimizing/nodes.h +++ b/compiler/optimizing/nodes.h @@ -551,6 +551,12 @@ class HLoopInformation : public ArenaObject { // Note that `other` *must* be populated before entering this function. bool IsIn(const HLoopInformation& other) const; + // Returns true if instruction is not defined within this loop or any loop nested inside + // this loop. If must_dominate is set, only definitions that actually dominate the loop + // header can be invariant. Otherwise, any definition outside the loop, including + // definitions that appear after the loop, is invariant. + bool IsLoopInvariant(HInstruction* instruction, bool must_dominate) const; + const ArenaBitVector& GetBlocks() const { return blocks_; } void Add(HBasicBlock* block); -- cgit v1.2.3-59-g8ed1b