[llvm] 3d9386a - [CoroFrame] Avoid pointer element type access for swifterror
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 9 02:15:20 PST 2022
Author: Nikita Popov
Date: 2022-03-09T11:15:10+01:00
New Revision: 3d9386a349427483dc55f92876dedf037ae97854
URL: https://github.com/llvm/llvm-project/commit/3d9386a349427483dc55f92876dedf037ae97854
DIFF: https://github.com/llvm/llvm-project/commit/3d9386a349427483dc55f92876dedf037ae97854.diff
LOG: [CoroFrame] Avoid pointer element type access for swifterror
These must have pointer-to-pointer type, and with opaque pointers
we don't care about the specific pointer type anymore.
Added:
Modified:
llvm/lib/Transforms/Coroutines/CoroFrame.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 372238dcb9ea0..ee88e95924b90 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -2282,7 +2282,10 @@ static void eliminateSwiftErrorArgument(Function &F, Argument &Arg,
IRBuilder<> Builder(F.getEntryBlock().getFirstNonPHIOrDbg());
auto ArgTy = cast<PointerType>(Arg.getType());
- auto ValueTy = ArgTy->getPointerElementType();
+ // swifterror arguments are required to have pointer-to-pointer type,
+ // so create a pointer-typed alloca with opaque pointers.
+ auto ValueTy = ArgTy->isOpaque() ? PointerType::getUnqual(F.getContext())
+ : ArgTy->getNonOpaquePointerElementType();
// Reduce to the alloca case:
More information about the llvm-commits
mailing list