Skip to content

[SYCL] Don't dump IR and dot files by default in the LowerWGScope pass #2887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions llvm/lib/SYCLLowerIR/LowerWGScope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static constexpr char PFWI_MD[] = "parallel_for_work_item";
static cl::opt<int> Debug("sycl-lower-wg-debug", llvm::cl::Optional,
llvm::cl::Hidden,
llvm::cl::desc("Debug SYCL work group code lowering"),
llvm::cl::init(10));
llvm::cl::init(1));

namespace {
class SYCLLowerWGScopeLegacyPass : public FunctionPass {
Expand Down Expand Up @@ -375,25 +375,29 @@ using LocalsSet = SmallPtrSet<AllocaInst *, 4>;

static void copyBetweenPrivateAndShadow(Value *L, GlobalVariable *Shadow,
IRBuilder<> &Builder, bool Loc2Shadow) {
assert(isa<PointerType>(L->getType()));
Type *T = nullptr;
MaybeAlign LocAlign(0);

if (const auto *AI = dyn_cast<AllocaInst>(L)) {
T = AI->getAllocatedType();
LocAlign = MaybeAlign(AI->getAlignment());
} else {
if (cast<Argument>(L)->hasByValAttr()) {
T = cast<Argument>(L)->getParamByValType();
LocAlign = MaybeAlign(cast<Argument>(L)->getParamAlignment());
auto Arg = cast<Argument>(L);
if (Arg->hasByValAttr()) {
T = Arg->getParamByValType();
LocAlign = MaybeAlign(Arg->getParamAlignment());
} else {
Type *Ty = cast<Argument>(L)->getType();
Type *Ty = Arg->getType();
Module &M = *Shadow->getParent();
LocAlign = M.getDataLayout().getValueOrABITypeAlignment(
MaybeAlign(cast<Argument>(L)->getParamAlignment()), Ty);
T = cast<Argument>(L)->getType()->getPointerElementType();
MaybeAlign(Arg->getParamAlignment()), Ty);
T = Arg->getType()->getPointerElementType();
}
}

assert(T && "Unexpected type");

if (T->isAggregateType()) {
// TODO: we should use methods which directly return MaybeAlign once such
// are added to LLVM for AllocaInst and GlobalVariable
Expand Down