aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Verifier.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2024-10-25 12:56:10 +0100
committerGitHub <noreply@github.com>2024-10-25 12:56:10 +0100
commit90cdc03e7f5bda2e31573d48450a8ac8fa856efa (patch)
treeecb260372381dcb84a3aa386a21032296af27d45 /llvm/lib/IR/Verifier.cpp
parent2c0b34852af4dc9964f8bf6db303bd54a32856e7 (diff)
downloadllvm-90cdc03e7f5bda2e31573d48450a8ac8fa856efa.zip
llvm-90cdc03e7f5bda2e31573d48450a8ac8fa856efa.tar.gz
llvm-90cdc03e7f5bda2e31573d48450a8ac8fa856efa.tar.bz2
[IR] Fix undiagnosed cases of structs containing scalable vectors (#113455)
Type::isScalableTy and StructType::containsScalableVectorType failed to detect some cases of structs containing scalable vectors because containsScalableVectorType did not call back into isScalableTy to check the element types. Fix this, which requires sharing the same Visited set in both functions. Also change the external API so that callers are never required to pass in a Visited set, and normalize the naming to isScalableTy.
Diffstat (limited to 'llvm/lib/IR/Verifier.cpp')
-rw-r--r--llvm/lib/IR/Verifier.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index f34fe75..60e65392 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -4107,8 +4107,7 @@ void Verifier::visitGetElementPtrInst(GetElementPtrInst &GEP) {
Check(GEP.getSourceElementType()->isSized(), "GEP into unsized type!", &GEP);
if (auto *STy = dyn_cast<StructType>(GEP.getSourceElementType())) {
- SmallPtrSet<Type *, 4> Visited;
- Check(!STy->containsScalableVectorType(&Visited),
+ Check(!STy->isScalableTy(),
"getelementptr cannot target structure that contains scalable vector"
"type",
&GEP);