Skip to content

Commit e3f1729

Browse files
committed
Add constexpr.
1 parent 2789008 commit e3f1729

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

llvm/include/llvm/Transforms/Utils/LoopUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ bool canSinkOrHoistInst(Instruction &I, AAResults *AA, DominatorTree *DT,
361361

362362
/// Returns the llvm.vector.reduce intrinsic that corresponds to the recurrence
363363
/// kind.
364-
Intrinsic::ID getReductionIntrinsicID(RecurKind RK);
364+
constexpr Intrinsic::ID getReductionIntrinsicID(RecurKind RK);
365365

366366
/// Returns the arithmetic instruction opcode used when expanding a reduction.
367367
unsigned getArithmeticReductionInstruction(Intrinsic::ID RdxID);

llvm/lib/IR/IntrinsicInst.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,14 +599,13 @@ Intrinsic::ID VPIntrinsic::getForOpcode(unsigned IROPC) {
599599
return Intrinsic::not_intrinsic;
600600
}
601601

602-
Intrinsic::ID VPIntrinsic::getForIntrinsic(Intrinsic::ID Id) {
603-
if (isVPIntrinsic(Id))
602+
constexpr static Intrinsic::ID getForIntrinsic(Intrinsic::ID Id) {
603+
if (::isVPIntrinsic(Id))
604604
return Id;
605605

606606
switch (Id) {
607607
default:
608608
break;
609-
610609
#define BEGIN_REGISTER_VP_INTRINSIC(VPID, ...) break;
611610
#define VP_PROPERTY_FUNCTIONAL_INTRINSIC(INTRIN) case Intrinsic::INTRIN:
612611
#define END_REGISTER_VP_INTRINSIC(VPID) return Intrinsic::VPID;
@@ -615,6 +614,10 @@ Intrinsic::ID VPIntrinsic::getForIntrinsic(Intrinsic::ID Id) {
615614
return Intrinsic::not_intrinsic;
616615
}
617616

617+
Intrinsic::ID VPIntrinsic::getForIntrinsic(Intrinsic::ID Id) {
618+
return ::getForIntrinsic(Id);
619+
}
620+
618621
bool VPIntrinsic::canIgnoreVectorLengthParam() const {
619622
using namespace PatternMatch;
620623

llvm/lib/Transforms/Utils/LoopUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ bool llvm::hasIterationCountInvariantInParent(Loop *InnerLoop,
918918
return true;
919919
}
920920

921-
Intrinsic::ID llvm::getReductionIntrinsicID(RecurKind RK) {
921+
constexpr Intrinsic::ID llvm::getReductionIntrinsicID(RecurKind RK) {
922922
switch (RK) {
923923
default:
924924
llvm_unreachable("Unexpected recurrence kind");

0 commit comments

Comments
 (0)