diff options
author | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2023-08-11 14:38:53 +0200 |
---|---|---|
committer | Bjorn Pettersson <bjorn.a.pettersson@ericsson.com> | 2023-08-13 16:46:56 +0200 |
commit | a7ee80fab213fe7a52b159e3a6c13c7355c30b25 (patch) | |
tree | 6efdf00725527203dae2042ac8c071266c9b21a5 /llvm/lib/Transforms/Utils/LoopUtils.cpp | |
parent | 2c85b24fb8d33a5755c06869ee0c8facc43af624 (diff) | |
download | llvm-a7ee80fab213fe7a52b159e3a6c13c7355c30b25.zip llvm-a7ee80fab213fe7a52b159e3a6c13c7355c30b25.tar.gz llvm-a7ee80fab213fe7a52b159e3a6c13c7355c30b25.tar.bz2 |
[llvm] Drop some more typed pointer bitcasts etc.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUtils.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 273c659..f99cf3d 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -1640,7 +1640,7 @@ static PointerBounds expandBounds(const RuntimeCheckingPtrGroup *CG, Loop *TheLoop, Instruction *Loc, SCEVExpander &Exp) { LLVMContext &Ctx = Loc->getContext(); - Type *PtrArithTy = Type::getInt8PtrTy(Ctx, CG->AddressSpace); + Type *PtrArithTy = PointerType::get(Ctx, CG->AddressSpace); Value *Start = nullptr, *End = nullptr; LLVM_DEBUG(dbgs() << "LAA: Adding RT check for range:\n"); @@ -1693,21 +1693,13 @@ Value *llvm::addRuntimeChecks( const PointerBounds &A = Check.first, &B = Check.second; // Check if two pointers (A and B) conflict where conflict is computed as: // start(A) <= end(B) && start(B) <= end(A) - unsigned AS0 = A.Start->getType()->getPointerAddressSpace(); - unsigned AS1 = B.Start->getType()->getPointerAddressSpace(); - assert((AS0 == B.End->getType()->getPointerAddressSpace()) && - (AS1 == A.End->getType()->getPointerAddressSpace()) && + assert((A.Start->getType()->getPointerAddressSpace() == + B.End->getType()->getPointerAddressSpace()) && + (B.Start->getType()->getPointerAddressSpace() == + A.End->getType()->getPointerAddressSpace()) && "Trying to bounds check pointers with different address spaces"); - Type *PtrArithTy0 = Type::getInt8PtrTy(Ctx, AS0); - Type *PtrArithTy1 = Type::getInt8PtrTy(Ctx, AS1); - - Value *Start0 = ChkBuilder.CreateBitCast(A.Start, PtrArithTy0, "bc"); - Value *Start1 = ChkBuilder.CreateBitCast(B.Start, PtrArithTy1, "bc"); - Value *End0 = ChkBuilder.CreateBitCast(A.End, PtrArithTy1, "bc"); - Value *End1 = ChkBuilder.CreateBitCast(B.End, PtrArithTy0, "bc"); - // [A|B].Start points to the first accessed byte under base [A|B]. // [A|B].End points to the last accessed byte, plus one. // There is no conflict when the intervals are disjoint: @@ -1716,8 +1708,8 @@ Value *llvm::addRuntimeChecks( // bound0 = (B.Start < A.End) // bound1 = (A.Start < B.End) // IsConflict = bound0 & bound1 - Value *Cmp0 = ChkBuilder.CreateICmpULT(Start0, End1, "bound0"); - Value *Cmp1 = ChkBuilder.CreateICmpULT(Start1, End0, "bound1"); + Value *Cmp0 = ChkBuilder.CreateICmpULT(A.Start, B.End, "bound0"); + Value *Cmp1 = ChkBuilder.CreateICmpULT(B.Start, A.End, "bound1"); Value *IsConflict = ChkBuilder.CreateAnd(Cmp0, Cmp1, "found.conflict"); if (MemoryRuntimeCheck) { IsConflict = |