Skip to content

Commit e85760b

Browse files
committed
Merge from 'main' to 'sycl-web' (1 commits)
CONFLICT (content): Merge conflict in llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
2 parents 4778b7e + 0680795 commit e85760b

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

llvm/lib/IR/Constants.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,7 @@ Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy,
22262226
bool OnlyIfReduced) {
22272227
assert(CastInst::castIsValid(Instruction::AddrSpaceCast, C, DstTy) &&
22282228
"Invalid constantexpr addrspacecast!");
2229-
2229+
#ifndef INTEL_SYCL_OPAQUEPOINTER_READY
22302230
// Canonicalize addrspacecasts between different pointer types by first
22312231
// bitcasting the pointer type and then converting the address space.
22322232
PointerType *SrcScalarTy = cast<PointerType>(C->getType()->getScalarType());
@@ -2241,6 +2241,7 @@ Constant *ConstantExpr::getAddrSpaceCast(Constant *C, Type *DstTy,
22412241
}
22422242
C = getBitCast(C, MidTy);
22432243
}
2244+
#endif // INTEL_SYCL_OPAQUEPOINTER_READY
22442245
return getFoldedCast(Instruction::AddrSpaceCast, C, DstTy, OnlyIfReduced);
22452246
}
22462247

llvm/lib/IR/Instructions.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3397,6 +3397,11 @@ unsigned CastInst::isEliminableCastPair(
33973397
"Illegal addrspacecast, bitcast sequence!");
33983398
// Allowed, use first cast's opcode
33993399
return firstOp;
3400+
#ifdef INTEL_SYCL_OPAQUEPOINTER_READY
3401+
case 14:
3402+
// bitcast, addrspacecast -> addrspacecast
3403+
return Instruction::AddrSpaceCast;
3404+
#else // INTEL_SYCL_OPAQUEPOINTER_READY
34003405
case 14: {
34013406
// bitcast, addrspacecast -> addrspacecast if the element type of
34023407
// bitcast's source is the same as that of addrspacecast's destination.
@@ -3406,6 +3411,7 @@ unsigned CastInst::isEliminableCastPair(
34063411
return Instruction::AddrSpaceCast;
34073412
return 0;
34083413
}
3414+
#endif // INTEL_SYCL_OPAQUEPOINTER_READY
34093415
case 15:
34103416
// FIXME: this state can be merged with (1), but the following assert
34113417
// is useful to check the correcteness of the sequence due to semantic

llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,15 +1321,10 @@ bool InferAddressSpacesImpl::rewriteWithNewAddressSpaces(
13211321
if (AddrSpaceCastInst *ASC = dyn_cast<AddrSpaceCastInst>(CurUser)) {
13221322
unsigned NewAS = NewV->getType()->getPointerAddressSpace();
13231323
if (ASC->getDestAddressSpace() == NewAS) {
1324-
#ifdef INTEL_SYCL_OPAQUEPOINTER_READY
1325-
if (!cast<PointerType>(ASC->getType()->getScalarType())
1326-
->hasSameElementTypeAs(
1327-
cast<PointerType>(NewV->getType()->getScalarType()))) {
1328-
#else
1324+
#ifndef INTEL_SYCL_OPAQUEPOINTER_READY
13291325
if (!cast<PointerType>(ASC->getType())
13301326
->hasSameElementTypeAs(
13311327
cast<PointerType>(NewV->getType()))) {
1332-
#endif
13331328
BasicBlock::iterator InsertPos;
13341329
if (Instruction *NewVInst = dyn_cast<Instruction>(NewV))
13351330
InsertPos = std::next(NewVInst->getIterator());
@@ -1341,6 +1336,7 @@ bool InferAddressSpacesImpl::rewriteWithNewAddressSpaces(
13411336
NewV = CastInst::Create(Instruction::BitCast, NewV,
13421337
ASC->getType(), "", &*InsertPos);
13431338
}
1339+
#endif
13441340
ASC->replaceAllUsesWith(NewV);
13451341
DeadInstructions.push_back(ASC);
13461342
continue;

0 commit comments

Comments
 (0)