[PATCH] Teach the inliner how to preserve musttail invariants
Reid Kleckner
rnk at google.com
Tue May 6 14:32:55 PDT 2014
================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:697
@@ +696,3 @@
+ for (Instruction &I : *BB) {
+ if (CallInst *CI = dyn_cast<CallInst>(&I)) {
+ CallInst::TailCallKind ChildTCK = CI->getTailCallKind();
----------------
Chandler Carruth wrote:
> nit: invert and use continue to reduce indentation
done
================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:794
@@ +793,3 @@
+
+ if (NeedBitCast) {
+ // Strip any possible inlined bitcast and grab the musttail call.
----------------
Chandler Carruth wrote:
> nit: as above, invert and continue to reduce indentation.
done
================
Comment at: lib/Transforms/Utils/InlineFunction.cpp:795-800
@@ +794,8 @@
+ if (NeedBitCast) {
+ // Strip any possible inlined bitcast and grab the musttail call.
+ Value *RV = RI->getReturnValue();
+ BitCastInst *OldCast = dyn_cast<BitCastInst>(RV);
+ if (OldCast)
+ RV = OldCast->getOperand(0);
+ assert(cast<CallInst>(RV)->isMustTailCall());
+
----------------
Chandler Carruth wrote:
> Rather than duplicating isPrecededByMustTailCall, make that function getPrecedingMustTailCallInst or some such, and have it return null when there is no call? That should make this loop simplify quite a bit.
Sure. It helps a bit, but I have to get the bitcast instr so I can erase it.
http://reviews.llvm.org/D3491
More information about the llvm-commits
mailing list