[llvm] 537829f - [VPlan] Add isStore helper to VPWidenMemoryInstructionRecipe (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 9 06:02:47 PST 2020
Author: Florian Hahn
Date: 2020-11-09T14:01:29Z
New Revision: 537829f2a7e6b60ea0bd434753f57a091e7f8ec8
URL: https://github.com/llvm/llvm-project/commit/537829f2a7e6b60ea0bd434753f57a091e7f8ec8
DIFF: https://github.com/llvm/llvm-project/commit/537829f2a7e6b60ea0bd434753f57a091e7f8ec8.diff
LOG: [VPlan] Add isStore helper to VPWidenMemoryInstructionRecipe (NFC).
Move logic to check if the recipe is a store to a helper for easier
reuse.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlan.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index b037e376ed52..c70d82bfb137 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1244,8 +1244,7 @@ class VPWidenMemoryInstructionRecipe : public VPRecipeBase,
}
bool isMasked() const {
- return (isa<LoadInst>(getUnderlyingInstr()) && getNumOperands() == 2) ||
- (isa<StoreInst>(getUnderlyingInstr()) && getNumOperands() == 3);
+ return isStore() ? getNumOperands() == 3 : getNumOperands() == 2;
}
public:
@@ -1280,10 +1279,12 @@ class VPWidenMemoryInstructionRecipe : public VPRecipeBase,
return isMasked() ? getOperand(getNumOperands() - 1) : nullptr;
}
+ /// Returns true if this recipe is a store.
+ bool isStore() const { return isa<StoreInst>(getUnderlyingInstr()); }
+
/// Return the address accessed by this recipe.
VPValue *getStoredValue() const {
- assert(isa<StoreInst>(getUnderlyingInstr()) &&
- "Stored value only available for store instructions");
+ assert(isStore() && "Stored value only available for store instructions");
return getOperand(1); // Stored value is the 2nd, mandatory operand.
}
More information about the llvm-commits
mailing list