Skip to content

Commit d214783

Browse files
vmustyaigcbot
authored andcommitted
Add GenXSimplify pass into O0 VC pipeline
.
1 parent a568d0d commit d214783

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

IGC/VectorCompiler/lib/GenXCodeGen/GenXTargetMachine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,12 +680,14 @@ void GenXTargetMachine::adjustPassManager(PassManagerBuilder &PMBuilder) {
680680
PM.add(createCFGSimplificationPass());
681681
#endif
682682
PM.add(createInstructionCombiningPass());
683+
PM.add(createGenXSimplifyPass());
683684
PM.add(createDeadCodeEliminationPass());
684685
PM.add(createSROAPass());
685686
PM.add(createInferAddressSpacesPass());
686687
PM.add(createEarlyCSEPass(true));
687688
PM.add(createCFGSimplificationPass());
688689
PM.add(createInstructionCombiningPass());
690+
PM.add(createGenXSimplifyPass());
689691
PM.add(createDeadCodeEliminationPass());
690692
// PM.add(createGlobalDCEPass());
691693
};

IGC/VectorCompiler/lib/GenXOpts/CMAnalysis/InstructionSimplifyGenX.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,9 @@ Value *llvm::SimplifyGenXIntrinsic(unsigned IID, Type *RetTy, Use *ArgBegin,
316316
== ArgBegin[GenXIntrinsic::GenXRegion::NewValueOperandNum]->getType()) {
317317
if (auto CMask = dyn_cast<Constant>(ArgBegin[
318318
GenXIntrinsic::GenXRegion::PredicateOperandNum])) {
319-
if (CMask->isAllOnesValue()) {
320-
unsigned NumElements = cast<IGCLLVM::FixedVectorType>(RetTy)->getNumElements();
319+
auto *RetVTy = dyn_cast<IGCLLVM::FixedVectorType>(RetTy);
320+
if (RetVTy && CMask->isAllOnesValue()) {
321+
unsigned NumElements = RetVTy->getNumElements();
321322
unsigned Width = cast<ConstantInt>(
322323
ArgBegin[GenXIntrinsic::GenXRegion::WrWidthOperandNum])
323324
->getZExtValue();
@@ -422,9 +423,7 @@ class GenXSimplify : public FunctionPass {
422423
public:
423424
static char ID;
424425

425-
GenXSimplify() : FunctionPass(ID) {
426-
initializeGenXSimplifyPass(*PassRegistry::getPassRegistry());
427-
}
426+
GenXSimplify() : FunctionPass(ID) {}
428427

429428
bool runOnFunction(Function &F) override;
430429

@@ -512,10 +511,13 @@ bool GenXSimplify::processGenXIntrinsics(Function &F) {
512511
}
513512

514513
char GenXSimplify::ID = 0;
515-
INITIALIZE_PASS_BEGIN(GenXSimplify, "genx-simplify",
514+
INITIALIZE_PASS_BEGIN(GenXSimplify, "GenXSimplify",
516515
"simplify genx specific instructions", false, false)
517516
INITIALIZE_PASS_DEPENDENCY(DominatorTreeWrapperPass)
518-
INITIALIZE_PASS_END(GenXSimplify, "genx-simplify",
517+
INITIALIZE_PASS_END(GenXSimplify, "GenXSimplify",
519518
"simplify genx specific instructions", false, false)
520519

521-
FunctionPass *llvm::createGenXSimplifyPass() { return new GenXSimplify; }
520+
FunctionPass *llvm::createGenXSimplifyPass() {
521+
initializeGenXSimplifyPass(*PassRegistry::getPassRegistry());
522+
return new GenXSimplify;
523+
}

IGC/VectorCompiler/test/GenXSimplify/debug-intrinsic.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
;=========================== begin_copyright_notice ============================
22
;
3-
; Copyright (C) 2022 Intel Corporation
3+
; Copyright (C) 2022-2023 Intel Corporation
44
;
55
; SPDX-License-Identifier: MIT
66
;
77
;============================ end_copyright_notice =============================
88
;
9-
; RUN: opt %use_old_pass_manager% -genx-simplify -march=genx64 -mtriple=spir64-unknown-unknown -mcpu=Gen9 -S < %s | FileCheck %s
9+
; RUN: opt %use_old_pass_manager% -GenXSimplify -march=genx64 -mtriple=spir64-unknown-unknown -mcpu=Gen9 -S < %s | FileCheck %s
1010
; ------------------------------------------------
1111
; GenXSimplify
1212
; ------------------------------------------------

IGC/VectorCompiler/test/GenXSimplify/masked_constant_fold.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
;=========================== begin_copyright_notice ============================
22
;
3-
; Copyright (C) 2020-2021 Intel Corporation
3+
; Copyright (C) 2020-2023 Intel Corporation
44
;
55
; SPDX-License-Identifier: MIT
66
;
77
;============================ end_copyright_notice =============================
88

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

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

IGC/VectorCompiler/test/GenXSimplify/ptr_constant_fold.ll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
;=========================== begin_copyright_notice ============================
22
;
3-
; Copyright (C) 2020-2021 Intel Corporation
3+
; Copyright (C) 2020-2023 Intel Corporation
44
;
55
; SPDX-License-Identifier: MIT
66
;
77
;============================ end_copyright_notice =============================
88

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

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

0 commit comments

Comments
 (0)