diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-05-12 01:17:38 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2016-05-12 01:17:38 +0000 |
commit | e0aa414acf9bb455376df4579e244dcca1434e1f (patch) | |
tree | 8104efd7ced9cab63a9c566a3dcf0fe886eb3756 /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | fe7bba4ee416ffcc1a5439700b230aa94c106957 (diff) | |
download | bcm5719-llvm-e0aa414acf9bb455376df4579e244dcca1434e1f.tar.gz bcm5719-llvm-e0aa414acf9bb455376df4579e244dcca1434e1f.zip |
All llvm.deoptimize declarations must use the same calling convention
This new verifier rule lets us unambigously pick a calling convention
when creating a new declaration for
`@llvm.experimental.deoptimize.<ty>`. It is also congruent with our
lowering strategy -- since all calls to `@llvm.experimental.deoptimize`
are lowered to calls to `__llvm_deoptimize`, it is reasonable to enforce
a unique calling convention.
Some of the tests that were breaking this verifier rule have had to be
split up into different .ll files.
The inliner was violating this rule as well, and has been fixed to avoid
producing invalid IR.
llvm-svn: 269261
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 5b0640c7237..c8d76f4d9e8 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1874,7 +1874,13 @@ bool llvm::InlineFunction(CallSite CS, InlineFunctionInfo &IFI, continue; } - auto CallingConv = DeoptCall->getCallingConv(); + // The calling convention on the deoptimize call itself may be bogus, + // since the code we're inlining may have undefined behavior (and may + // never actually execute at runtime); but all + // @llvm.experimental.deoptimize declarations have to have the same + // calling convention in a well-formed module. + auto CallingConv = DeoptCall->getCalledFunction()->getCallingConv(); + NewDeoptIntrinsic->setCallingConv(CallingConv); auto *CurBB = RI->getParent(); RI->eraseFromParent(); |