diff options
author | Nikita Popov <npopov@redhat.com> | 2022-04-11 12:06:39 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2022-04-11 12:08:29 +0200 |
commit | b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4 (patch) | |
tree | a92e11460d9c6ef7ac738dd915c090f5407b9aa6 /clang/lib/CodeGen/CGCall.cpp | |
parent | b24b56165a95d99d7aafb453410f27688ef5b134 (diff) | |
download | llvm-b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4.zip llvm-b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4.tar.gz llvm-b72fd1a84d33e19f9f7fa6b7fdcaea57dc51aee4.tar.bz2 |
[CGCall] Check store type in findDominatingStoreToReturnValue()
We need to make sure that the stored type matches the return type.
Diffstat (limited to 'clang/lib/CodeGen/CGCall.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGCall.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp index c4d342e..e6a5fd1 100644 --- a/clang/lib/CodeGen/CGCall.cpp +++ b/clang/lib/CodeGen/CGCall.cpp @@ -3228,7 +3228,8 @@ static llvm::StoreInst *findDominatingStoreToReturnValue(CodeGenFunction &CGF) { // ReturnValue to some other location. auto GetStoreIfValid = [&CGF](llvm::User *U) -> llvm::StoreInst * { auto *SI = dyn_cast<llvm::StoreInst>(U); - if (!SI || SI->getPointerOperand() != CGF.ReturnValue.getPointer()) + if (!SI || SI->getPointerOperand() != CGF.ReturnValue.getPointer() || + SI->getValueOperand()->getType() != CGF.ReturnValue.getElementType()) return nullptr; // These aren't actually possible for non-coerced returns, and we // only care about non-coerced returns on this code path. |