mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-06 23:32:27 +00:00
InstCombine: Fix a crasher when encountering a function pointer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162180 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0a8f898000
commit
a4b5717ea7
@ -2990,7 +2990,7 @@ Instruction *InstCombiner::visitFCmpInst(FCmpInst &I) {
|
||||
CallInst *CI = cast<CallInst>(LHSI);
|
||||
LibFunc::Func Func;
|
||||
// Various optimization for fabs compared with zero.
|
||||
if (RHSC->isNullValue() &&
|
||||
if (RHSC->isNullValue() && CI->getCalledFunction() &&
|
||||
TLI->getLibFunc(CI->getCalledFunction()->getName(), Func) &&
|
||||
TLI->has(Func)) {
|
||||
if (Func == LibFunc::fabs || Func == LibFunc::fabsf ||
|
||||
|
@ -151,3 +151,11 @@ define i32 @test16(double %a) nounwind {
|
||||
; CHECK-NOT: fabs
|
||||
; CHECK: fcmp ueq double %a, 0.000000e+00
|
||||
}
|
||||
|
||||
; Don't crash.
|
||||
define i32 @test17(double %a, double (double)* %p) nounwind {
|
||||
%call = tail call double %p(double %a) nounwind
|
||||
%cmp = fcmp ueq double %call, 0.000000e+00
|
||||
%conv = zext i1 %cmp to i32
|
||||
ret i32 %conv
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user