Skip to content

Commit 14f70c5

Browse files
authored
Merge pull request intel#46 from frasercrmck/llvm-17-updates
Update construction kit to build with LLVM 17
2 parents 8bfb4ec + 26cb604 commit 14f70c5

File tree

6 files changed

+15
-47
lines changed

6 files changed

+15
-47
lines changed

llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/include/multi_llvm/opaque_pointers.h

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,18 @@ inline bool isOpaquePointerTy(llvm::Type *Ty) {
2727
return false;
2828
}
2929

30-
inline bool isOpaqueOrPointeeTypeMatches(llvm::PointerType *PTy,
31-
llvm::Type *EltTy) {
32-
#if LLVM_VERSION_MAJOR >= 15
33-
(void)EltTy;
30+
inline bool isOpaqueOrPointeeTypeMatches(llvm::PointerType *PTy, llvm::Type *) {
3431
(void)PTy;
3532
assert(PTy->isOpaque() && "No support for typed pointers in LLVM 15+");
3633
return true;
37-
#else
38-
return PTy->isOpaque() || PTy->getPointerElementType() == EltTy;
39-
#endif
4034
}
4135

4236
inline llvm::Type *getPtrElementType(llvm::PointerType *PTy) {
4337
if (PTy->isOpaque()) {
4438
return nullptr;
4539
}
46-
#if LLVM_VERSION_MAJOR >= 15
47-
assert(false && "No support for typed pointers in LLVM 15+");
40+
assert(false && "No support for typed pointers");
4841
return nullptr;
49-
#else
50-
return PTy->getPointerElementType();
51-
#endif
5242
}
5343

5444
}; // namespace multi_llvm

llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/include/multi_llvm/optional_helper.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,6 @@ class Optional : public llvm::Optional<T> {
6464
inline constexpr bool has_value() const {
6565
return llvm::Optional<T>::hasValue();
6666
}
67-
68-
#if (LLVM_VERSION_MAJOR <= 14)
69-
inline constexpr const T &value() const {
70-
return llvm::Optional<T>::getValue();
71-
}
72-
inline constexpr T &value() { return llvm::Optional<T>::getValue(); }
73-
74-
template <typename U>
75-
constexpr T value_or(U &&alt) const & {
76-
return llvm::Optional<T>::getValueOr(alt);
77-
}
78-
#endif
7967
};
8068

8169
#endif

llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/source/transform/basic_mem2reg_pass.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ bool BasicMem2RegPass::promoteAlloca(AllocaInst *Alloca) const {
182182
StoredValue = Store->getValueOperand();
183183
ToDelete.push_back(Store);
184184
DIBuilder DIB(*Alloca->getModule(), /*AllowUnresolved*/ false);
185+
#if LLVM_VERSION_GREATER_EQUAL(17, 0)
186+
auto DbgIntrinsics = FindDbgDeclareUses(Alloca);
187+
#else
185188
auto DbgIntrinsics = FindDbgAddrUses(Alloca);
189+
#endif
186190
for (auto oldDII : DbgIntrinsics) {
187191
ConvertDebugDeclareToDebugValue(oldDII, Store, DIB);
188192
}

llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/source/transform/control_flow_conversion_pass.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
#include <llvm/IR/IRBuilder.h>
3232
#include <llvm/Support/Debug.h>
3333
#include <llvm/Support/raw_ostream.h>
34-
#include <multi_llvm/multi_llvm.h>
35-
#include <multi_llvm/vector_type_helper.h>
34+
#include <multi_llvm/optional_helper.h>
3635

3736
#include <queue>
3837
#include <utility>
@@ -3064,11 +3063,7 @@ bool ControlFlowConversionState::Impl::simplifyMasks() {
30643063
if (I.use_empty()) {
30653064
toDelete.push_back(&I);
30663065
} else {
3067-
#if LLVM_VERSION_GREATER_EQUAL(15, 0)
30683066
Value *simpleMask = simplifyInstruction(&I, Q);
3069-
#else
3070-
Value *simpleMask = SimplifyInstruction(&I, Q);
3071-
#endif
30723067
if (simpleMask && simpleMask != &I) {
30733068
I.replaceAllUsesWith(simpleMask);
30743069
toDelete.push_back(&I);

llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/source/transform/scalarizer.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include <llvm/IR/Intrinsics.h>
2828
#include <llvm/Support/Debug.h>
2929
#include <llvm/Support/raw_ostream.h>
30-
#include <multi_llvm/llvm_version.h>
3130
#include <multi_llvm/multi_llvm.h>
3231
#include <multi_llvm/vector_type_helper.h>
3332

@@ -667,11 +666,7 @@ SimdPacket *Scalarizer::extractLanes(llvm::Value *V, PacketMask PM) {
667666
}
668667

669668
Value *Idx = B.getInt32(i);
670-
#if LLVM_VERSION_GREATER_EQUAL(15, 0)
671669
Value *Extract = simplifyExtractElementInst(V, Idx, Q);
672-
#else
673-
Value *Extract = SimplifyExtractElementInst(V, Idx, Q);
674-
#endif
675670
if (!Extract) {
676671
Extract = B.CreateExtractElement(V, Idx);
677672
}

llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/source/vector_target_info_riscv.cpp

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,8 @@ llvm::Value *TargetInfoRISCV::createScalableExtractElement(
360360
indices, zero);
361361

362362
SmallVector<Value *, 4> ops;
363-
#if LLVM_VERSION_GREATER_EQUAL(15, 0)
364-
// LLVM 15+ has a pass-through operand - we set it to undef.
363+
// Add the a pass-through operand - we set it to undef.
365364
ops.push_back(UndefValue::get(srcTy));
366-
#endif
367365
ops.push_back(src);
368366
ops.push_back(indices);
369367
ops.push_back(avl);
@@ -428,10 +426,8 @@ llvm::Value *TargetInfoRISCV::createScalableBroadcast(llvm::IRBuilder<> &B,
428426
auto *const avl = getIntrinsicVL(B, VL, wideTy, getTargetMachine());
429427

430428
SmallVector<Value *, 4> ops;
431-
#if LLVM_VERSION_GREATER_EQUAL(15, 0)
432-
// LLVM 15+ has a pass-through operand - we set it to undef.
429+
// Add the pass-through operand - we set it to undef.
433430
ops.push_back(UndefValue::get(vs2->getType()));
434-
#endif
435431
ops.push_back(vs2);
436432
ops.push_back(vs1);
437433
ops.push_back(avl);
@@ -641,10 +637,8 @@ llvm::Value *TargetInfoRISCV::createVectorShuffle(llvm::IRBuilder<> &B,
641637
auto *const avl = getIntrinsicVL(B, VL, gatherTy, getTargetMachine());
642638

643639
SmallVector<Value *, 4> ops;
644-
#if LLVM_VERSION_GREATER_EQUAL(15, 0)
645-
// LLVM 15+ has a pass-through operand - we set it to undef.
640+
// Add the pass-through operand - we set it to undef.
646641
ops.push_back(UndefValue::get(gatherTy));
647-
#endif
648642
ops.push_back(src);
649643
ops.push_back(mask);
650644
ops.push_back(avl);
@@ -676,10 +670,8 @@ llvm::Value *TargetInfoRISCV::createVectorSlideUp(llvm::IRBuilder<> &B,
676670
auto *const avl = getIntrinsicVL(B, VL, srcTy, getTargetMachine());
677671

678672
SmallVector<Value *, 4> ops;
679-
#if LLVM_VERSION_GREATER_EQUAL(15, 0)
680-
// LLVM 15+ has a pass-through operand - we set it to undef.
673+
// Add the pass-through operand - we set it to undef.
681674
ops.push_back(UndefValue::get(srcTy));
682-
#endif
683675
ops.push_back(src);
684676
ops.push_back(insert);
685677
ops.push_back(avl);
@@ -745,7 +737,11 @@ Value *TargetInfoRISCV::createVPKernelWidth(IRBuilder<> &B,
745737
auto *const I64Ty = Type::getInt64Ty(B.getContext());
746738

747739
auto *const VL =
740+
#if LLVM_VERSION_GREATER_EQUAL(17, 0)
741+
B.CreateIntrinsic(Intrinsic::RISCVIntrinsics::riscv_vsetvli, {I64Ty},
742+
#else
748743
B.CreateIntrinsic(Intrinsic::RISCVIntrinsics::riscv_vsetvli_opt, {I64Ty},
744+
#endif
749745
{RemainingIters, VSEW, VLMul});
750746

751747
return B.CreateTrunc(VL, I32Ty);

0 commit comments

Comments
 (0)