ArgPromotion: Don't touch variadic functions
authorReid Kleckner <reid@kleckner.net>
Mon, 25 Aug 2014 23:58:48 +0000 (23:58 +0000)
committerReid Kleckner <reid@kleckner.net>
Mon, 25 Aug 2014 23:58:48 +0000 (23:58 +0000)
commit9d1f8b1b21a75732d6060ae3a9278244b0b49a08
treec15df667ccbfccc6995cee308c1b6cd7dc0d711a
parent9fe621a69e302cbce755fdc486e9d97778a7ba64
ArgPromotion: Don't touch variadic functions

Adding, removing, or changing non-pack parameters can change the ABI
classification of pack parameters. Clang and other frontends encode the
classification in the IR of the call site, but the callee side
determines it dynamically based on the number of registers consumed so
far. Changing the prototype affects the number of registers consumed
would break such code.

Dead argument elimination performs a similar task and already has a
similar check to avoid this problem.

Patch by Thomas Jablin!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216421 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/ArgumentPromotion.cpp
test/Transforms/ArgumentPromotion/variadic.ll [new file with mode: 0644]