Skip to content

Commit db85bab

Browse files
committed
[VPlan] Use m_Intrinsic to match assumes/noalias_scope_decl (NFC).
Use pattern matching to check for intrinsics to slightly simplify code.
1 parent 75e4438 commit db85bab

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "VPlanCFG.h"
1212
#include "VPlanDominatorTree.h"
1313
#include "VPlanHelpers.h"
14+
#include "VPlanPatternMatch.h"
1415
#include "llvm/ADT/PostOrderIterator.h"
1516
#include "llvm/ADT/TypeSwitch.h"
1617
#include "llvm/Analysis/ScalarEvolution.h"
@@ -19,6 +20,7 @@
1920
#include "llvm/IR/PatternMatch.h"
2021

2122
using namespace llvm;
23+
using namespace VPlanPatternMatch;
2224

2325
#define DEBUG_TYPE "vplan"
2426

@@ -327,8 +329,7 @@ void llvm::collectEphemeralRecipesForVPlan(
327329
vp_depth_first_deep(Plan.getVectorLoopRegion()->getEntry()))) {
328330
for (VPRecipeBase &R : *VPBB) {
329331
auto *RepR = dyn_cast<VPReplicateRecipe>(&R);
330-
if (!RepR || !match(RepR->getUnderlyingInstr(),
331-
PatternMatch::m_Intrinsic<Intrinsic::assume>()))
332+
if (!RepR || !match(RepR, m_Intrinsic<Intrinsic::assume>()))
332333
continue;
333334
Worklist.push_back(RepR);
334335
EphRecipes.insert(RepR);

llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,11 +275,10 @@ void UnrollState::unrollRecipeByUF(VPRecipeBase &R) {
275275
remapOperands(&R, UF - 1);
276276
return;
277277
}
278-
if (auto *II = dyn_cast<IntrinsicInst>(RepR->getUnderlyingValue())) {
279-
if (II->getIntrinsicID() == Intrinsic::experimental_noalias_scope_decl) {
280-
addUniformForAllParts(RepR);
281-
return;
282-
}
278+
if (match(RepR,
279+
m_Intrinsic<Intrinsic::experimental_noalias_scope_decl>())) {
280+
addUniformForAllParts(RepR);
281+
return;
283282
}
284283
}
285284

0 commit comments

Comments
 (0)