[Test] how to test the metadata of library function (original) (raw)
Thanks to all folks that help me, I need some help about the usage of update_cc_test_checks.py.
- After I try the following commad to auto update the match pattern, it only generate that for the function foo without the callee library function std::exp
llvm/utils/update_cc_test_checks.py --clang=build/bin/clang clang/test/CodeGen/math-libcalls-tbaa.cpp
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 2
// RUN: %clang -S -emit-llvm -o - -x c++ %s | FileCheck %s -check-prefixes=CHECK
#include <math.h>
float foo (float num[], float r2inv, int n) {
const float expm2 = std::exp(num[10]);
float tmp = expm2 * num[10];
return tmp;
}
- But when I try the command local, we can see there are dump for std::exp, so my question is how to get the matched pattern for _ZSt3expf ? (I need check the _ZSt3expf because my local PR add some metadata for it to improve the TBAA)
clang -S -emit-llvm -o - -x c++ clang/test/CodeGen/math-libcalls-tbaa.cpp
define linkonce_odr dso_local noundef float @_ZSt3expf(float noundef %__x) #1 comdat {
entry:
%__x.addr = alloca float, align 4
store float %__x, ptr %__x.addr, align 4
%0 = load float, ptr %__x.addr, align 4
%call = call float @expf(float noundef %0) #3, !tbaa !6
ret float %call
}