[llvm] [IR] Add TargetExtType::CanBeLocal property (PR #99016)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 21 03:48:34 PDT 2024
================
@@ -4285,6 +4291,12 @@ void Verifier::visitAllocaInst(AllocaInst &AI) {
SmallPtrSet<Type*, 4> Visited;
Check(AI.getAllocatedType()->isSized(&Visited),
"Cannot allocate unsized type", &AI);
+ // Check if it's a target extension type that disallows being used on the
+ // stack.
+ if (auto *TTy = dyn_cast<TargetExtType>(AI.getAllocatedType())) {
+ Check(TTy->hasProperty(TargetExtType::CanBeLocal),
+ "Alloca has illegal target extension type", &AI);
----------------
nikic wrote:
Also applies to the existing CanBeGlobal check, but this probably needs to be recursive? We'd not want to forbid `target("foo")` but then allow `{ target("foo") }`.
https://github.com/llvm/llvm-project/pull/99016
More information about the llvm-commits
mailing list