[PATCH] D13826: [Bitcode] Limit bits used for CallingConv::ID in Function, update tests
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 26 09:31:56 PDT 2015
rnk added a subscriber: rnk.
rnk added a comment.
Technically this is a bitcode backwards compatibility break, but I don't think anyone has ever used a calling convention ID greater than 1023 except in these test cases. I think we could get away with rejecting large calling convention IDs in the bitcode reader, though. After the reader, we can assert that truncation should not occur in setCallingConv for Function, InvokeInst, and CallInst.
================
Comment at: include/llvm/IR/Function.h:167
@@ -163,3 +166,3 @@
void setCallingConv(CallingConv::ID CC) {
- setValueSubclassData((getSubclassDataFromValue() & 7) |
- (static_cast<unsigned>(CC) << 3));
+ setValueSubclassData((getSubclassDataFromValue() & 0xc00f) |
+ ((static_cast<unsigned>(CC) & 0x3ff) << 4));
----------------
Should this assert that CC < 1024?
http://reviews.llvm.org/D13826
More information about the llvm-commits
mailing list