Skip to content

Commit 972856d

Browse files
bokrzesiigcbot
authored andcommitted
[LLVM16] [LITS] Fixing 38 failing LITs of LdStCombine
Porting IGC code to LLVM16 * Fixing 38 failing LITs of LdStCombine LdStCombine/DI_call_between_stores-typed-pointers.ll LdStCombine/DI_call_between_stores.ll LdStCombine/load_basic.ll LdStCombine/load_favor_vector-typed-pointers.ll LdStCombine/load_favor_vector.ll LdStCombine/load_struct_vec_member-typed-pointers.ll LdStCombine/load_struct_vec_member.ll LdStCombine/load_use_struct_1-typed-pointers.ll LdStCombine/load_use_struct_1.ll LdStCombine/load_use_struct_2-typed-pointers.ll LdStCombine/load_use_struct_2.ll LdStCombine/load_use_vector-typed-pointers.ll LdStCombine/load_use_vector.ll LdStCombine/store_address_or_inst-typed-pointers.ll LdStCombine/store_address_or_inst.ll LdStCombine/store_address_sext_inst-typed-pointers.ll LdStCombine/store_address_sext_inst.ll LdStCombine/store_check_uniform-typed-pointers.ll LdStCombine/store_check_uniform.ll LdStCombine/store_fence_split.ll LdStCombine/store_no_overlap_stores-typed-pointers.ll LdStCombine/store_no_overlap_stores.ll LdStCombine/store_no_vec3_member-typed-pointers.ll LdStCombine/store_no_vec3_member.ll LdStCombine/store_prefer_struct_over_vector-typed-pointers.ll LdStCombine/store_prefer_struct_over_vector.ll LdStCombine/store_two_pointers.ll LdStCombine/store_two_stores-typed-pointers.ll LdStCombine/store_two_stores.ll LdStCombine/store_use_struct.ll LdStCombine/store_use_vector-typed-pointers.ll LdStCombine/store_use_vector.ll LdStCombine/store_vec_member-typed-pointers.ll LdStCombine/store_vec_member.ll LdStCombine/store_vector_with_const-typed-pointers.ll LdStCombine/store_vector_with_const.ll LdStCombine/uniqueLayoutStruct-typed-pointers.ll LdStCombine/uniqueLayoutStruct.ll
1 parent 7bbf209 commit 972856d

File tree

2 files changed

+30
-15
lines changed

2 files changed

+30
-15
lines changed

IGC/Compiler/CISACodeGen/MemOpt.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ SPDX-License-Identifier: MIT
1313
#include <llvmWrapper/Analysis/MemoryLocation.h>
1414
#include <llvmWrapper/Analysis/TargetLibraryInfo.h>
1515
#include <llvmWrapper/Analysis/AliasSetTracker.h>
16-
#include <llvm/Analysis/AliasAnalysis.h>
17-
#include "llvm/Analysis/AliasSetTracker.h"
1816
#include <llvm/Analysis/InstructionSimplify.h>
1917
#include <llvm/Analysis/ScalarEvolution.h>
2018
#include <llvm/Analysis/ScalarEvolutionExpressions.h>
@@ -3297,7 +3295,8 @@ void LdStCombine::combineStores()
32973295

32983296
// Keep store candidates for checking alias to see if those
32993297
// stores can be moved to the place of the last store.
3300-
AliasSetTracker AST = IGCLLVM::createAliasSetTracker(m_AA);
3298+
auto batchAARes = IGCLLVM::AliasAnalysis::createAAresults(m_AA);
3299+
AliasSetTracker AST = IGCLLVM::createAliasSetTracker(batchAARes);
33013300

33023301
AST.add(base);
33033302
for (auto JI = std::next(II); JI != IE; ++JI) {
@@ -3412,7 +3411,8 @@ void LdStCombine::combineLoads()
34123411

34133412
// Keep store/maywritemem/fence insts for checking alias to see if those
34143413
// stores block load candidates from moving to the first (leading) load.
3415-
AliasSetTracker AST = IGCLLVM::createAliasSetTracker(m_AA);
3414+
auto batchAARes = IGCLLVM::AliasAnalysis::createAAresults(m_AA);
3415+
AliasSetTracker AST = IGCLLVM::createAliasSetTracker(batchAARes);
34163416

34173417
for (auto JI = std::next(II); JI != IE; ++JI) {
34183418
Instruction* I = &*JI;

IGC/WrapperLLVM/include/llvmWrapper/Analysis/AliasSetTracker.h

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,32 @@ SPDX-License-Identifier: MIT
1212
#include "llvm/Analysis/AliasAnalysis.h"
1313
#include <llvm/Analysis/AliasSetTracker.h>
1414

15-
namespace IGCLLVM
16-
{
17-
llvm::AliasSetTracker createAliasSetTracker(llvm::AliasAnalysis *aliasAnalysis)
18-
{
19-
#if LLVM_VERSION_MAJOR < 16
20-
return llvm::AliasSetTracker(*aliasAnalysis);
21-
#else
22-
llvm::BatchAAResults batchAAResult(*aliasAnalysis);
23-
return llvm::AliasSetTracker(batchAAResult);
24-
#endif
25-
}
15+
namespace IGCLLVM {
16+
namespace AliasAnalysis {
17+
#if LLVM_VERSION_MAJOR < 16
18+
using BatchAAResults = llvm::AliasAnalysis*;
19+
#else
20+
using BatchAAResults = llvm::BatchAAResults;
21+
#endif
22+
23+
BatchAAResults createAAresults(llvm::AliasAnalysis* AA)
24+
{
25+
#if LLVM_VERSION_MAJOR < 16
26+
return AA;
27+
#else
28+
return llvm::BatchAAResults(*AA);
29+
#endif
30+
}
31+
} // end namespace AliasAnalysis
32+
33+
llvm::AliasSetTracker createAliasSetTracker(AliasAnalysis::BatchAAResults AARes)
34+
{
35+
#if LLVM_VERSION_MAJOR < 16
36+
return llvm::AliasSetTracker(*AARes);
37+
#else
38+
return llvm::AliasSetTracker(AARes);
39+
#endif
40+
}
2641
}
2742

2843
#endif

0 commit comments

Comments
 (0)