mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
[CodeExtractor] Do not extract calls to eh_typeid_for (PR39545)
The lowering for a call to eh_typeid_for changes when it's moved from one function to another. There are several proposals for fixing this issue in llvm.org/PR39545. Until some solution is in place, do not allow CodeExtractor to extract calls to eh_typeid_for, as that results in serious miscompilations. llvm-svn: 346256
This commit is contained in:
parent
2ea46024ae
commit
cf991106ab
@ -168,14 +168,22 @@ static bool isBlockValidForExtraction(const BasicBlock &BB,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (const CallInst *CI = dyn_cast<CallInst>(I))
|
||||
if (const Function *F = CI->getCalledFunction())
|
||||
if (F->getIntrinsicID() == Intrinsic::vastart) {
|
||||
if (const CallInst *CI = dyn_cast<CallInst>(I)) {
|
||||
if (const Function *F = CI->getCalledFunction()) {
|
||||
auto IID = F->getIntrinsicID();
|
||||
if (IID == Intrinsic::vastart) {
|
||||
if (AllowVarArgs)
|
||||
continue;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// Currently, we miscompile outlined copies of eh_typid_for. There are
|
||||
// proposals for fixing this in llvm.org/PR39545.
|
||||
if (IID == Intrinsic::eh_typeid_for)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
26
test/Transforms/HotColdSplit/eh-typeid-for.ll
Normal file
26
test/Transforms/HotColdSplit/eh-typeid-for.ll
Normal file
@ -0,0 +1,26 @@
|
||||
; RUN: opt -hotcoldsplit -S < %s | FileCheck %s
|
||||
|
||||
; Do not outline calls to @llvm.eh.typeid.for. See llvm.org/PR39545.
|
||||
|
||||
@_ZTIi = external constant i8*
|
||||
|
||||
; CHECK-LABEL: @fun
|
||||
; CHECK-NOT: call {{.*}}@fun.cold.1
|
||||
define void @fun() {
|
||||
entry:
|
||||
br i1 undef, label %if.then, label %if.else
|
||||
|
||||
if.then:
|
||||
ret void
|
||||
|
||||
if.else:
|
||||
%t = call i32 @llvm.eh.typeid.for(i8* bitcast (i8** @_ZTIi to i8*))
|
||||
call void @sink()
|
||||
call void @sink()
|
||||
call void @sink()
|
||||
ret void
|
||||
}
|
||||
|
||||
declare void @sink() cold
|
||||
|
||||
declare i32 @llvm.eh.typeid.for(i8*)
|
Loading…
Reference in New Issue
Block a user