aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Instruction.h
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2012-06-28 05:42:26 +0000
committerHal Finkel <hfinkel@anl.gov>2012-06-28 05:42:26 +0000
commitec4e85e3364f50802f2007e4b1e23661d4610366 (patch)
tree630824715448e25e4159add533273cf8e125c884 /include/llvm/Instruction.h
parent97a759249d6be2ad4f64b40f6bc14b0c3e77ef32 (diff)
Refactor operation equivalence checking in BBVectorize by extending Instruction::isSameOperationAs.
Maintaining this kind of checking in different places is dangerous, extending Instruction::isSameOperationAs consolidates this logic into one place. Here I've added an optional flags parameter and two flags that are important for vectorization: CompareIgnoringAlignment and CompareUsingScalarTypes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159329 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Instruction.h')
-rw-r--r--include/llvm/Instruction.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/llvm/Instruction.h b/include/llvm/Instruction.h
index a386d1de42..5512dcc9e6 100644
--- a/include/llvm/Instruction.h
+++ b/include/llvm/Instruction.h
@@ -281,6 +281,16 @@ public:
/// ignores the SubclassOptionalData flags, which specify conditions
/// under which the instruction's result is undefined.
bool isIdenticalToWhenDefined(const Instruction *I) const;
+
+ /// When checking for operation equivalence (using isSameOperationAs) it is
+ /// sometimes useful to ignore certain attributes.
+ enum OperationEquivalenceFlags {
+ /// Check for equivalence ignoring load/store alignment.
+ CompareIgnoringAlignment = 1<<0,
+ /// Check for equivalence treating a type and a vector of that type
+ /// as equivalent.
+ CompareUsingScalarTypes = 1<<1
+ };
/// This function determines if the specified instruction executes the same
/// operation as the current one. This means that the opcodes, type, operand
@@ -290,7 +300,7 @@ public:
/// @returns true if the specified instruction is the same operation as
/// the current one.
/// @brief Determine if one instruction is the same operation as another.
- bool isSameOperationAs(const Instruction *I) const;
+ bool isSameOperationAs(const Instruction *I, unsigned flags = 0) const;
/// isUsedOutsideOfBlock - Return true if there are any uses of this
/// instruction in blocks other than the specified block. Note that PHI nodes