Skip to content

Commit 0d4d2b8

Browse files
grey-eminencesys_zuul
authored andcommitted
[Autobackout][FuncReg]Revert of change: 8b900c4
Add AnnotateUniformAllocas pass. Change-Id: Id5da0f1b2619b866de550d7b59c80dd9b8ca2045
1 parent c093f92 commit 0d4d2b8

File tree

6 files changed

+10
-148
lines changed

6 files changed

+10
-148
lines changed

IGC/Compiler/CISACodeGen/AnnotateUniformAllocas.cpp

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

IGC/Compiler/CISACodeGen/AnnotateUniformAllocas.h

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

IGC/Compiler/CISACodeGen/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
44
set(IGC_BUILD__SRC__CISACodeGen_Common
55
"${CMAKE_CURRENT_SOURCE_DIR}/AdvCodeMotion.cpp"
66
"${CMAKE_CURRENT_SOURCE_DIR}/AdvMemOpt.cpp"
7-
"${CMAKE_CURRENT_SOURCE_DIR}/AnnotateUniformAllocas.cpp"
87
"${CMAKE_CURRENT_SOURCE_DIR}/BlockCoalescing.cpp"
98
"${CMAKE_CURRENT_SOURCE_DIR}/CheckInstrTypes.cpp"
109
"${CMAKE_CURRENT_SOURCE_DIR}/CISABuilder.cpp"
@@ -95,7 +94,6 @@ set(IGC_BUILD__SRC__Compiler_CISACodeGen
9594
set(IGC_BUILD__HDR__CISACodeGen_Common
9695
"${CMAKE_CURRENT_SOURCE_DIR}/AdvCodeMotion.h"
9796
"${CMAKE_CURRENT_SOURCE_DIR}/AdvMemOpt.h"
98-
"${CMAKE_CURRENT_SOURCE_DIR}/AnnotateUniformAllocas.h"
9997
"${CMAKE_CURRENT_SOURCE_DIR}/BlockCoalescing.hpp"
10098
"${CMAKE_CURRENT_SOURCE_DIR}/CheckInstrTypes.hpp"
10199
"${CMAKE_CURRENT_SOURCE_DIR}/CISABuilder.hpp"

IGC/Compiler/CISACodeGen/LowerGEPForPrivMem.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2727
#include "Compiler/CodeGenContextWrapper.hpp"
2828
#include "Compiler/MetaDataUtilsWrapper.h"
2929
#include "Compiler/CISACodeGen/RegisterPressureEstimate.hpp"
30+
#include "Compiler/CISACodeGen/WIAnalysis.hpp"
3031
#include "common/LLVMUtils.h"
3132
#include "Compiler/CISACodeGen/LowerGEPForPrivMem.hpp"
3233
#include "Compiler/CodeGenPublic.h"
@@ -69,6 +70,7 @@ namespace IGC {
6970
AU.addRequired<RegisterPressureEstimate>();
7071
AU.addRequired<MetaDataUtilsWrapper>();
7172
AU.addRequired<CodeGenContextWrapper>();
73+
AU.addRequired<WIAnalysis>();
7274
AU.addRequired<DominatorTreeWrapperPass>();
7375
AU.setPreservesCFG();
7476
}
@@ -250,8 +252,14 @@ bool LowerGEPForPrivMem::IsNativeType(Type* type)
250252

251253
bool LowerGEPForPrivMem::CheckIfAllocaPromotable(llvm::AllocaInst* pAlloca)
252254
{
253-
bool isUniformAlloca = pAlloca->getMetadata("uniform") != nullptr;
254-
255+
auto WI = &getAnalysis<WIAnalysis>();
256+
bool isUniformAlloca = WI->whichDepend(pAlloca) == WIAnalysis::UNIFORM;
257+
if (isUniformAlloca)
258+
{
259+
IRBuilder<> builder(pAlloca);
260+
MDNode* node = MDNode::get(pAlloca->getContext(), ConstantAsMetadata::get(builder.getInt1(true)));
261+
pAlloca->setMetadata("uniform", node);
262+
}
255263
unsigned int allocaSize = extractAllocaSize(pAlloca);
256264
unsigned int allowedAllocaSizeInBytes = MAX_ALLOCA_PROMOTE_GRF_NUM * 4;
257265

IGC/Compiler/CISACodeGen/ShaderCodeGen.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
161161
#include "Compiler/Optimizer/IGCInstCombiner/IGCInstructionCombining.hpp"
162162
#include "DebugInfo.hpp"
163163
#include "Compiler/CISACodeGen/HalfPromotion.h"
164-
#include "Compiler/CISACodeGen/AnnotateUniformAllocas.h"
165164
#include "Probe/Assertion.h"
166165

167166
/***********************************************************************************
@@ -458,8 +457,6 @@ namespace IGC
458457
mpm.add(createGenericAddressDynamicResolutionPass());
459458
}
460459

461-
mpm.add(createAnnotateUniformAllocasPass());
462-
463460
// Resolve the Private memory to register pass
464461
if (!isOptDisabled)
465462
{

IGC/Compiler/InitializePasses.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ namespace llvm {
3232
// The following declarations are placed according to alphabetic order for simplicity
3333
void initializeAddImplicitArgsPass(llvm::PassRegistry&);
3434
void initializeAddressSpaceAliasAnalysisPass(llvm::PassRegistry&);
35-
void initializeAnnotateUniformAllocasPass(llvm::PassRegistry&);
3635
void initializeAggregateArgumentsAnalysisPass(llvm::PassRegistry&);
3736
void initializeAlignmentAnalysisPass(llvm::PassRegistry&);
3837
void initializePreBIImportAnalysisPass(llvm::PassRegistry&);

0 commit comments

Comments
 (0)