Skip to content

Commit 1d3d9b9

Browse files
committed
[OpenMPOpt][NFC] Moving constants as struct static attributes
1 parent 2bbbcae commit 1d3d9b9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

llvm/lib/Transforms/IPO/OpenMPOpt.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ struct OffloadArray {
407407
return true;
408408
}
409409

410+
static const unsigned BasePtrsArgNum = 2;
411+
static const unsigned PtrsArgNum = 3;
412+
static const unsigned SizesArgNum = 4;
413+
410414
private:
411415
/// Traverses the BasicBlock where \p Array is, collecting the stores made to
412416
/// \p Array, leaving StoredValues with the values stored before the
@@ -705,14 +709,12 @@ struct OpenMPOpt {
705709
// offload arrays, offload_baseptrs, offload_ptrs, offload_sizes.
706710
// Therefore:
707711
// i8** %offload_baseptrs.
708-
const unsigned BasePtrsArgNum = 2;
709-
Value *BasePtrsArg = RuntimeCall.getArgOperand(BasePtrsArgNum);
712+
Value *BasePtrsArg =
713+
RuntimeCall.getArgOperand(OffloadArray::BasePtrsArgNum);
710714
// i8** %offload_ptrs.
711-
const unsigned PtrsArgNum = 3;
712-
Value *PtrsArg = RuntimeCall.getArgOperand(PtrsArgNum);
715+
Value *PtrsArg = RuntimeCall.getArgOperand(OffloadArray::PtrsArgNum);
713716
// i8** %offload_sizes.
714-
const unsigned SizesArgNum = 4;
715-
Value *SizesArg = RuntimeCall.getArgOperand(SizesArgNum);
717+
Value *SizesArg = RuntimeCall.getArgOperand(OffloadArray::SizesArgNum);
716718

717719
// Get values stored in **offload_baseptrs.
718720
auto *V = getUnderlyingObject(BasePtrsArg);

0 commit comments

Comments
 (0)