In function Analysis.cpp:isInTailCallPosition, instructions between call and ret are checked to see if they block tail call optimization. If an instruction is an intrinsic call, only llvm.lifetime_end is allowed and other intrinsic functions block tail call. When compiling tcmalloc, we found llvm.assume between a hot function call and ret, it blocks the optimization. But llvm.assume doesn't generate instructions, it should not block tail call.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/Analysis.cpp | ||
---|---|---|
539 ↗ | (On Diff #214663) | Update comment |
Comment Actions
I'm pretty sure it will not fix the issue. A possible test case would look like:
define i8* @foo() { %1 = tail call i8* @bar() %2 = icmp eq i8* %1, null tail call void @llvm.assume(i1 %2) ret i8* null }
Comment Actions
Yes! There is a new PR and I just realized how big issue we have here (we may call functions which are never called in source code) :[
We need to remove all llvm.assumes in CGP.