[llvm] [llvm][NFC] Assert VAArg type (PR #67148)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 07:31:31 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
<details>
<summary>Changes</summary>
Due to the way we have a backend arranged, we fell over a varadic struct bug, and noticed the generic machinery presumes all by-val structs are by hidden pointer. The documentation even warns:
'Note that the code generator does not yet fully support va\_arg on many targets. Also, it does not currently support va\_arg with aggregate types on any target.'
While this assert would not have triggered in our case, it was surprising to not see a check. So here's one. Of course it doesn't trigger :)
---
Full diff: https://github.com/llvm/llvm-project/pull/67148.diff
1 Files Affected:
- (modified) llvm/include/llvm/IR/Instructions.h (+4)
``````````diff
diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index a0c8406fe4ec1e5..cfe90ecdef3fd5a 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -1796,12 +1796,16 @@ class VAArgInst : public UnaryInstruction {
VAArgInst(Value *List, Type *Ty, const Twine &NameStr = "",
Instruction *InsertBefore = nullptr)
: UnaryInstruction(Ty, VAArg, List, InsertBefore) {
+ assert(!Ty->isStructTy() && !Ty->isArrayTy() &&
+ "by-val structures and arrays unsupported");
setName(NameStr);
}
VAArgInst(Value *List, Type *Ty, const Twine &NameStr,
BasicBlock *InsertAtEnd)
: UnaryInstruction(Ty, VAArg, List, InsertAtEnd) {
+ assert(!Ty->isStructTy() && !Ty->isArrayTy() &&
+ "by-val structures and arrays unsupported");
setName(NameStr);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/67148
More information about the llvm-commits
mailing list