return ::SimplifyCmpInst(Predicate, LHS, RHS, TD, DT, RecursionLimit);
}
+static Value *SimplifyCallInst(CallInst *CI) {
+ // call undef -> undef
+ if (isa<UndefValue>(CI->getCalledValue()))
+ return UndefValue::get(CI->getType());
+
+ return 0;
+}
+
/// SimplifyInstruction - See if we can compute a simplified version of this
/// instruction. If not, this returns null.
Value *llvm::SimplifyInstruction(Instruction *I, const TargetData *TD,
case Instruction::PHI:
Result = SimplifyPHINode(cast<PHINode>(I), DT);
break;
+ case Instruction::Call:
+ Result = SimplifyCallInst(cast<CallInst>(I));
+ break;
}
/// If called on unreachable code, the above logic may report that the
%r = select i1 undef, i64 undef, i64 %a
ret i64 %r
}
+
+; @test18
+; CHECK: ret i64 undef
+define i64 @test18(i64 %a) {
+ %r = call i64 (i64)* undef(i64 %a)
+ ret i64 %r
+}