Skip to content

Commit 207b0c9

Browse files
vmustyaigcbot
authored andcommitted
Add GenXSimplify pass into O0 VC pipeline
.
1 parent d63ed77 commit 207b0c9

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
@@ -671,12 +671,14 @@ void GenXTargetMachine::adjustPassManager(PassManagerBuilder &PMBuilder) {
671671
PM.add(createCFGSimplificationPass());
672672
#endif
673673
PM.add(createInstructionCombiningPass());
674+
PM.add(createGenXSimplifyPass());
674675
PM.add(createDeadCodeEliminationPass());
675676
PM.add(createSROAPass());
676677
PM.add(createInferAddressSpacesPass());
677678
PM.add(createEarlyCSEPass(true));
678679
PM.add(createCFGSimplificationPass());
679680
PM.add(createInstructionCombiningPass());
681+
PM.add(createGenXSimplifyPass());
680682
PM.add(createDeadCodeEliminationPass());
681683
// PM.add(createGlobalDCEPass());
682684
};

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)