Skip to content

Commit

Permalink
Add GenXSimplify pass into O0 VC pipeline
Browse files Browse the repository at this point in the history
.
  • Loading branch information
vmustya authored and igcbot committed Jul 26, 2023
1 parent d63ed77 commit 207b0c9
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
2 changes: 2 additions & 0 deletions IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,12 +671,14 @@ void GenXTargetMachine::adjustPassManager(PassManagerBuilder &PMBuilder) {
PM.add(createCFGSimplificationPass());
#endif
PM.add(createInstructionCombiningPass());
PM.add(createGenXSimplifyPass());
PM.add(createDeadCodeEliminationPass());
PM.add(createSROAPass());
PM.add(createInferAddressSpacesPass());
PM.add(createEarlyCSEPass(true));
PM.add(createCFGSimplificationPass());
PM.add(createInstructionCombiningPass());
PM.add(createGenXSimplifyPass());
PM.add(createDeadCodeEliminationPass());
// PM.add(createGlobalDCEPass());
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,9 @@ Value *llvm::SimplifyGenXIntrinsic(unsigned IID, Type *RetTy, Use *ArgBegin,
== ArgBegin[GenXIntrinsic::GenXRegion::NewValueOperandNum]->getType()) {
if (auto CMask = dyn_cast<Constant>(ArgBegin[
GenXIntrinsic::GenXRegion::PredicateOperandNum])) {
if (CMask->isAllOnesValue()) {
unsigned NumElements = cast<IGCLLVM::FixedVectorType>(RetTy)->getNumElements();
auto *RetVTy = dyn_cast<IGCLLVM::FixedVectorType>(RetTy);
if (RetVTy && CMask->isAllOnesValue()) {
unsigned NumElements = RetVTy->getNumElements();
unsigned Width = cast<ConstantInt>(
ArgBegin[GenXIntrinsic::GenXRegion::WrWidthOperandNum])
->getZExtValue();
Expand Down Expand Up @@ -422,9 +423,7 @@ class GenXSimplify : public FunctionPass {
public:
static char ID;

GenXSimplify() : FunctionPass(ID) {
initializeGenXSimplifyPass(*PassRegistry::getPassRegistry());
}
GenXSimplify() : FunctionPass(ID) {}

bool runOnFunction(Function &F) override;

Expand Down Expand Up @@ -512,10 +511,13 @@ bool GenXSimplify::processGenXIntrinsics(Function &F) {
}

char GenXSimplify::ID = 0;
INITIALIZE_PASS_BEGIN(GenXSimplify, "genx-simplify",
INITIALIZE_PASS_BEGIN(GenXSimplify, "GenXSimplify",
"simplify genx specific instructions", false, false)
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
INITIALIZE_PASS_END(GenXSimplify, "genx-simplify",
INITIALIZE_PASS_END(GenXSimplify, "GenXSimplify",
"simplify genx specific instructions", false, false)

FunctionPass *llvm::createGenXSimplifyPass() { return new GenXSimplify; }
FunctionPass *llvm::createGenXSimplifyPass() {
initializeGenXSimplifyPass(*PassRegistry::getPassRegistry());
return new GenXSimplify;
}
4 changes: 2 additions & 2 deletions IGC/VectorCompiler/test/GenXSimplify/debug-intrinsic.ll
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2022 Intel Corporation
; Copyright (C) 2022-2023 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================
;
; RUN: opt %use_old_pass_manager% -genx-simplify -march=genx64 -mtriple=spir64-unknown-unknown -mcpu=Gen9 -S < %s | FileCheck %s
; RUN: opt %use_old_pass_manager% -GenXSimplify -march=genx64 -mtriple=spir64-unknown-unknown -mcpu=Gen9 -S < %s | FileCheck %s
; ------------------------------------------------
; GenXSimplify
; ------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions IGC/VectorCompiler/test/GenXSimplify/masked_constant_fold.ll
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2020-2021 Intel Corporation
; Copyright (C) 2020-2023 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================

; RUN: opt %use_old_pass_manager% -genx-simplify -mcpu=Gen9 -march=genx64 -mtriple=spir64 -S < %s | FileCheck %s
; RUN: opt %use_old_pass_manager% -GenXSimplify -mcpu=Gen9 -march=genx64 -mtriple=spir64 -S < %s | FileCheck %s

target datalayout = "e-p:64:64-i64:64-n8:16:32"

Expand Down
4 changes: 2 additions & 2 deletions IGC/VectorCompiler/test/GenXSimplify/ptr_constant_fold.ll
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
;=========================== begin_copyright_notice ============================
;
; Copyright (C) 2020-2021 Intel Corporation
; Copyright (C) 2020-2023 Intel Corporation
;
; SPDX-License-Identifier: MIT
;
;============================ end_copyright_notice =============================

; RUN: opt %use_old_pass_manager% -genx-simplify -mcpu=Gen9 -march=genx64 -mtriple=spir64 -S < %s | FileCheck %s
; RUN: opt %use_old_pass_manager% -GenXSimplify -mcpu=Gen9 -march=genx64 -mtriple=spir64 -S < %s | FileCheck %s

;; Test constant folding of pointers -- that pass do not fails and
;; correctly handles pointer size.
Expand Down

0 comments on commit 207b0c9

Please sign in to comment.