Skip to content

Commit abe71b7

Browse files
committed
[OpenMP][NFC] Delete dead code
1 parent e28c393 commit abe71b7

File tree

1 file changed

+0
-88
lines changed

1 file changed

+0
-88
lines changed

clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp

Lines changed: 0 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1574,11 +1574,6 @@ enum CopyAction : unsigned {
15741574
RemoteLaneToThread,
15751575
// ThreadCopy: Make a copy of a Reduce list on the thread's stack.
15761576
ThreadCopy,
1577-
// ThreadToScratchpad: Copy a team-reduced array to the scratchpad.
1578-
ThreadToScratchpad,
1579-
// ScratchpadToThread: Copy from a scratchpad array in global memory
1580-
// containing team-reduced data to a thread's stack.
1581-
ScratchpadToThread,
15821577
};
15831578
} // namespace
15841579

@@ -1600,13 +1595,10 @@ static void emitReductionListCopy(
16001595
CGBuilderTy &Bld = CGF.Builder;
16011596

16021597
llvm::Value *RemoteLaneOffset = CopyOptions.RemoteLaneOffset;
1603-
llvm::Value *ScratchpadIndex = CopyOptions.ScratchpadIndex;
1604-
llvm::Value *ScratchpadWidth = CopyOptions.ScratchpadWidth;
16051598

16061599
// Iterates, element-by-element, through the source Reduce list and
16071600
// make a copy.
16081601
unsigned Idx = 0;
1609-
unsigned Size = Privates.size();
16101602
for (const Expr *Private : Privates) {
16111603
Address SrcElementAddr = Address::invalid();
16121604
Address DestElementAddr = Address::invalid();
@@ -1616,10 +1608,6 @@ static void emitReductionListCopy(
16161608
// Set to true to update the pointer in the dest Reduce list to a
16171609
// newly created element.
16181610
bool UpdateDestListPtr = false;
1619-
// Increment the src or dest pointer to the scratchpad, for each
1620-
// new element.
1621-
bool IncrScratchpadSrc = false;
1622-
bool IncrScratchpadDest = false;
16231611
QualType PrivatePtrType = C.getPointerType(Private->getType());
16241612
llvm::Type *PrivateLlvmPtrType = CGF.ConvertType(PrivatePtrType);
16251613

@@ -1655,49 +1643,6 @@ static void emitReductionListCopy(
16551643
PrivatePtrType->castAs<PointerType>());
16561644
break;
16571645
}
1658-
case ThreadToScratchpad: {
1659-
// Step 1.1: Get the address for the src element in the Reduce list.
1660-
Address SrcElementPtrAddr = Bld.CreateConstArrayGEP(SrcBase, Idx);
1661-
SrcElementAddr = CGF.EmitLoadOfPointer(
1662-
SrcElementPtrAddr.withElementType(PrivateLlvmPtrType),
1663-
PrivatePtrType->castAs<PointerType>());
1664-
1665-
// Step 1.2: Get the address for dest element:
1666-
// address = base + index * ElementSizeInChars.
1667-
llvm::Value *ElementSizeInChars = CGF.getTypeSize(Private->getType());
1668-
llvm::Value *CurrentOffset =
1669-
Bld.CreateNUWMul(ElementSizeInChars, ScratchpadIndex);
1670-
llvm::Value *ScratchPadElemAbsolutePtrVal =
1671-
Bld.CreateNUWAdd(DestBase.getPointer(), CurrentOffset);
1672-
ScratchPadElemAbsolutePtrVal =
1673-
Bld.CreateIntToPtr(ScratchPadElemAbsolutePtrVal, CGF.VoidPtrTy);
1674-
DestElementAddr = Address(ScratchPadElemAbsolutePtrVal, CGF.Int8Ty,
1675-
C.getTypeAlignInChars(Private->getType()));
1676-
IncrScratchpadDest = true;
1677-
break;
1678-
}
1679-
case ScratchpadToThread: {
1680-
// Step 1.1: Get the address for the src element in the scratchpad.
1681-
// address = base + index * ElementSizeInChars.
1682-
llvm::Value *ElementSizeInChars = CGF.getTypeSize(Private->getType());
1683-
llvm::Value *CurrentOffset =
1684-
Bld.CreateNUWMul(ElementSizeInChars, ScratchpadIndex);
1685-
llvm::Value *ScratchPadElemAbsolutePtrVal =
1686-
Bld.CreateNUWAdd(SrcBase.getPointer(), CurrentOffset);
1687-
ScratchPadElemAbsolutePtrVal =
1688-
Bld.CreateIntToPtr(ScratchPadElemAbsolutePtrVal, CGF.VoidPtrTy);
1689-
SrcElementAddr = Address(ScratchPadElemAbsolutePtrVal, CGF.Int8Ty,
1690-
C.getTypeAlignInChars(Private->getType()));
1691-
IncrScratchpadSrc = true;
1692-
1693-
// Step 1.2: Create a temporary to store the element in the destination
1694-
// Reduce list.
1695-
DestElementPtrAddr = Bld.CreateConstArrayGEP(DestBase, Idx);
1696-
DestElementAddr =
1697-
CGF.CreateMemTemp(Private->getType(), ".omp.reduction.element");
1698-
UpdateDestListPtr = true;
1699-
break;
1700-
}
17011646
}
17021647

17031648
// Regardless of src and dest of copy, we emit the load of src
@@ -1755,39 +1700,6 @@ static void emitReductionListCopy(
17551700
C.VoidPtrTy);
17561701
}
17571702

1758-
// Step 4.1: Increment SrcBase/DestBase so that it points to the starting
1759-
// address of the next element in scratchpad memory, unless we're currently
1760-
// processing the last one. Memory alignment is also taken care of here.
1761-
if ((IncrScratchpadDest || IncrScratchpadSrc) && (Idx + 1 < Size)) {
1762-
// FIXME: This code doesn't make any sense, it's trying to perform
1763-
// integer arithmetic on pointers.
1764-
llvm::Value *ScratchpadBasePtr =
1765-
IncrScratchpadDest ? DestBase.getPointer() : SrcBase.getPointer();
1766-
llvm::Value *ElementSizeInChars = CGF.getTypeSize(Private->getType());
1767-
ScratchpadBasePtr = Bld.CreateNUWAdd(
1768-
ScratchpadBasePtr,
1769-
Bld.CreateNUWMul(ScratchpadWidth, ElementSizeInChars));
1770-
1771-
// Take care of global memory alignment for performance
1772-
ScratchpadBasePtr = Bld.CreateNUWSub(
1773-
ScratchpadBasePtr, llvm::ConstantInt::get(CGM.SizeTy, 1));
1774-
ScratchpadBasePtr = Bld.CreateUDiv(
1775-
ScratchpadBasePtr,
1776-
llvm::ConstantInt::get(CGM.SizeTy, GlobalMemoryAlignment));
1777-
ScratchpadBasePtr = Bld.CreateNUWAdd(
1778-
ScratchpadBasePtr, llvm::ConstantInt::get(CGM.SizeTy, 1));
1779-
ScratchpadBasePtr = Bld.CreateNUWMul(
1780-
ScratchpadBasePtr,
1781-
llvm::ConstantInt::get(CGM.SizeTy, GlobalMemoryAlignment));
1782-
1783-
if (IncrScratchpadDest)
1784-
DestBase =
1785-
Address(ScratchpadBasePtr, CGF.VoidPtrTy, CGF.getPointerAlign());
1786-
else /* IncrScratchpadSrc = true */
1787-
SrcBase =
1788-
Address(ScratchpadBasePtr, CGF.VoidPtrTy, CGF.getPointerAlign());
1789-
}
1790-
17911703
++Idx;
17921704
}
17931705
}

0 commit comments

Comments
 (0)