[llvm] 9c5b856 - [CoroSplit] Avoid pointer element type accesses
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 21 03:22:17 PST 2022
Author: Nikita Popov
Date: 2022-01-21T12:22:09+01:00
New Revision: 9c5b856dac5c0ccbe755410b826f683ef01d7f08
URL: https://github.com/llvm/llvm-project/commit/9c5b856dac5c0ccbe755410b826f683ef01d7f08
DIFF: https://github.com/llvm/llvm-project/commit/9c5b856dac5c0ccbe755410b826f683ef01d7f08.diff
LOG: [CoroSplit] Avoid pointer element type accesses
Use isOpaqueOrPointeeTypeMatches() for the assertions instead.
Added:
Modified:
llvm/lib/Transforms/Coroutines/CoroSplit.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 2e4661fa1d0a1..b5129809c6a6a 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -618,7 +618,8 @@ static void replaceSwiftErrorOps(Function &F, coro::Shape &Shape,
Value *CachedSlot = nullptr;
auto getSwiftErrorSlot = [&](Type *ValueTy) -> Value * {
if (CachedSlot) {
- assert(CachedSlot->getType()->getPointerElementType() == ValueTy &&
+ assert(cast<PointerType>(CachedSlot->getType())
+ ->isOpaqueOrPointeeTypeMatches(ValueTy) &&
"multiple swifterror slots in function with
diff erent types");
return CachedSlot;
}
@@ -627,7 +628,8 @@ static void replaceSwiftErrorOps(Function &F, coro::Shape &Shape,
for (auto &Arg : F.args()) {
if (Arg.isSwiftError()) {
CachedSlot = &Arg;
- assert(Arg.getType()->getPointerElementType() == ValueTy &&
+ assert(cast<PointerType>(Arg.getType())
+ ->isOpaqueOrPointeeTypeMatches(ValueTy) &&
"swifterror argument does not have expected type");
return &Arg;
}
More information about the llvm-commits
mailing list