Skip to content

Commit 9462ea9

Browse files
PawelJurekigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: 393c54a
RemoveCodeAssumptions pass Instruction combining can miss some optimizations if it happens, that the only use of instructions end up in llvm.assume intrinsic. This change removes llvm.assume calls and runs instruction combining before Legalization pass.
1 parent bb37b85 commit 9462ea9

File tree

6 files changed

+2
-137
lines changed

6 files changed

+2
-137
lines changed

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ SPDX-License-Identifier: MIT
126126
#include "Compiler/InitializePasses.h"
127127
#include "Compiler/GenRotate.hpp"
128128
#include "Compiler/Optimizer/Scalarizer.h"
129-
#include "Compiler/RemoveCodeAssumptions.hpp"
130129
#include "common/debug/Debug.hpp"
131130
#include "common/igc_regkeys.hpp"
132131
#include "common/debug/Dump.hpp"
@@ -906,9 +905,9 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi
906905
}
907906
}
908907

909-
// Enabling half promotion AIL for compute shaders only at this point.
908+
// Enabling half promotion AIL for compute shaders only at this point.
910909
// If needed ctx.type check can be removed to apply for all shader types
911-
if (IGC_IS_FLAG_ENABLED(ForceHalfPromotion) ||
910+
if (IGC_IS_FLAG_ENABLED(ForceHalfPromotion) ||
912911
(ctx.getModuleMetaData()->compOpt.WaForceHalfPromotion && ctx.type == ShaderType::COMPUTE_SHADER) ||
913912
(!ctx.platform.supportFP16() && IGC_IS_FLAG_ENABLED(EnableHalfPromotion)))
914913
{
@@ -941,20 +940,12 @@ static void AddLegalizationPasses(CodeGenContext& ctx, IGCPassManager& mpm, PSSi
941940
mpm.add(createNanHandlingPass());
942941
}
943942

944-
if(!isOptDisabled) {
945-
// Removing code assumptions can enable some InstructionCombining optimizations.
946-
// Last instruction combining pass needs to be before Legalization pass, as it can produce illegal instructions.
947-
mpm.add(new RemoveCodeAssumptions());
948-
mpm.add(createIGCInstructionCombiningPass());
949-
}
950-
951943
// TODO: move to use instruction flags
952944
// to figure out if we need to preserve Nan
953945
bool preserveNan = !ctx.getCompilerOption().NoNaNs;
954946

955947
// Legalizer does not handle constant expressions
956948
mpm.add(new BreakConstantExpr());
957-
958949
mpm.add(new Legalization(preserveNan));
959950

960951
// Scalarizer in codegen to handle the vector instructions

IGC/Compiler/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ set(IGC_BUILD__SRC__Compiler
6666
"${CMAKE_CURRENT_SOURCE_DIR}/SampleMultiversioning.cpp"
6767
"${CMAKE_CURRENT_SOURCE_DIR}/HandleFRemInstructions.cpp"
6868
"${CMAKE_CURRENT_SOURCE_DIR}/GenRotate.cpp"
69-
"${CMAKE_CURRENT_SOURCE_DIR}/RemoveCodeAssumptions.cpp"
7069
"${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/ibdw_wa.c"
7170
"${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/ichv_wa.c"
7271
"${IGC_BUILD__GFX_DEV_SRC_DIR}/skuwa/ibxt_wa.c"
@@ -158,7 +157,6 @@ set(IGC_BUILD__HDR__Compiler
158157
"${CMAKE_CURRENT_SOURCE_DIR}/HandleFRemInstructions.hpp"
159158
"${CMAKE_CURRENT_SOURCE_DIR}/GenRotate.hpp"
160159
"${CMAKE_CURRENT_SOURCE_DIR}/SamplerPerfOptPass.hpp"
161-
"${CMAKE_CURRENT_SOURCE_DIR}/RemoveCodeAssumptions.hpp"
162160
${IGC_BUILD__HDR__Compiler_CISACodeGen}
163161
${IGC_BUILD__HDR__Compiler_DebugInfo}
164162
${IGC_BUILD__HDR__Compiler_Legalizer}

IGC/Compiler/InitializePasses.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,5 +226,3 @@ void initializeCatchAllLineNumberPass(llvm::PassRegistry&);
226226
void initializePromoteConstantStructsPass(llvm::PassRegistry&);
227227
void initializeLowerInvokeSIMDPass(llvm::PassRegistry&);
228228
void initializeImplicitGIDRestoringPass(llvm::PassRegistry&);
229-
void initializeRemoveCodeAssumptionsPass(llvm::PassRegistry&);
230-

IGC/Compiler/RemoveCodeAssumptions.cpp

Lines changed: 0 additions & 58 deletions
This file was deleted.

IGC/Compiler/RemoveCodeAssumptions.hpp

Lines changed: 0 additions & 39 deletions
This file was deleted.

IGC/Compiler/tests/RemoveCodeAssumptions/basic.ll

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)