[all-commits] [llvm/llvm-project] 911e06: [ICP] Handling must tail calls in indirect call pr...
Hongtao Yu via All-commits
all-commits at lists.llvm.org
Sun May 3 10:42:59 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 911e06f5eba66516e87c73d8e76016e549051cd7
https://github.com/llvm/llvm-project/commit/911e06f5eba66516e87c73d8e76016e549051cd7
Author: Hongtao Yu <hoy at fb.com>
Date: 2020-05-03 (Sun, 03 May 2020)
Changed paths:
M llvm/lib/Transforms/Utils/CallPromotionUtils.cpp
A llvm/test/Transforms/PGOProfile/indirect_call_promotion_musttail.ll
Log Message:
-----------
[ICP] Handling must tail calls in indirect call promotion
Per the IR convention, a musttail call must precede a ret with an optional bitcast. This was violated by the indirect call promotion optimization which could result an IR like:
; <label>:2192:
br i1 %2198, label %2199, label %2201, !dbg !226012, !prof !229483
; <label>:2199: ; preds = %2192
musttail call fastcc void @foo(i8* %2195), !dbg !226012
br label %2202, !dbg !226012
; <label>:2201: ; preds = %2192
musttail call fastcc void %2197(i8* %2195), !dbg !226012
br label %2202, !dbg !226012
; <label>:2202: ; preds = %605, %2201, %2199
ret void, !dbg !229485
This is being fixed in this change where the return statement goes together with the promoted indirect call. The code generated is like:
; <label>:2192:
br i1 %2198, label %2199, label %2201, !dbg !226012, !prof !229483
; <label>:2199: ; preds = %2192
musttail call fastcc void @foo(i8* %2195), !dbg !226012
ret void, !dbg !229485
; <label>:2201: ; preds = %2192
musttail call fastcc void %2197(i8* %2195), !dbg !226012
ret void, !dbg !229485
Differential Revision: https://reviews.llvm.org/D79258
More information about the All-commits
mailing list