add support for abs libcall
MODIFY
llvm_util/known_fns.cpp
llvm_util/known_fns.cpp
@@ -72,14 +72,6 @@ known_call(llvm::CallInst &i, const llvm::TargetLibraryInfo &TLI,
RETURN_UNKNOWN();
switch (libfn) {
- case llvm::LibFunc_access:
- ret_and_args_no_undef();
- attrs.set(FnAttrs::NoThrow);
- attrs.set(FnAttrs::NoFree);
- set_param(0, ParamAttrs::NoCapture);
- set_param(0, ParamAttrs::ReadOnly);
- RETURN_KNOWN_ATTRS();
-
case llvm::LibFunc_memset: // void* memset(void *ptr, int val, size_t bytes)
BB.addInstr(make_unique<Memset>(*args[0], *args[1], *args[2], 1));
RETURN_KNOWN(make_unique<UnaryOp>(*ty, value_name(i), *args[0],
@@ -117,6 +109,13 @@ known_call(llvm::CallInst &i, const llvm::TargetLibraryInfo &TLI,
RETURN_KNOWN(
make_unique<ConversionOp>(*ty, value_name(i), *Op, ConversionOp::Trunc));
}
+
+ case llvm::LibFunc_abs:
+ case llvm::LibFunc_labs:
+ case llvm::LibFunc_llabs:
+ RETURN_KNOWN(make_unique<BinOp>(*ty, value_name(i), *args[0],
+ *make_intconst(1, 1), BinOp::Abs));
+
case llvm::LibFunc_fabs:
case llvm::LibFunc_fabsf:
RETURN_KNOWN(
@@ -248,6 +247,14 @@ known_call(llvm::CallInst &i, const llvm::TargetLibraryInfo &TLI,
set_param(3, ParamAttrs::NoCapture);
RETURN_KNOWN_ATTRS();
+ case llvm::LibFunc_access:
+ ret_and_args_no_undef();
+ attrs.set(FnAttrs::NoThrow);
+ attrs.set(FnAttrs::NoFree);
+ set_param(0, ParamAttrs::NoCapture);
+ set_param(0, ParamAttrs::ReadOnly);
+ RETURN_KNOWN_ATTRS();
+
case llvm::LibFunc_open:
ret_and_args_no_undef();
set_param(0, ParamAttrs::NoCapture);

add support for abs libcall