[llvm-branch-commits] [llvm] release/22.x: [SafeStack] Fix crashing with scalable TypeSizes (#180547) (PR #203306)
Jakob Koschel via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jun 12 00:47:23 PDT 2026
jakos-sec wrote:
@brad0: Looks like there is another code change that fixed another instance of the bug (https://github.com/llvm/llvm-project/pull/176486).
In particular this change is needed for `llvm/lib/CodeGen/SafeStack.cpp`:
```
diff --git a/llvm/lib/CodeGen/SafeStack.cpp b/llvm/lib/CodeGen/SafeStack.cpp
index 33ffd94e4f8f..d8c727df2a39 100644
--- a/llvm/lib/CodeGen/SafeStack.cpp
+++ b/llvm/lib/CodeGen/SafeStack.cpp
@@ -198,14 +198,10 @@ public:
};
uint64_t SafeStack::getStaticAllocaAllocationSize(const AllocaInst* AI) {
- uint64_t Size = DL.getTypeAllocSize(AI->getAllocatedType());
- if (AI->isArrayAllocation()) {
- auto C = dyn_cast<ConstantInt>(AI->getArraySize());
- if (!C)
- return 0;
- Size *= C->getZExtValue();
- }
- return Size;
+ if (auto Size = AI->getAllocationSize(DL))
+ if (Size->isFixed())
+ return Size->getFixedValue();
+ return 0;
}
```
https://github.com/llvm/llvm-project/pull/203306
More information about the llvm-branch-commits
mailing list