[PATCH] D150388: [CodeGen]Allow targets to use target specific COPY instructions for live range splitting
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 22 17:55:18 PDT 2023
vitalybuka added a comment.
Not sure if this is useful when we have IR, but is my creduce
template <class a> void b(a &c, a p2) { c = p2; }
void *operator new(unsigned long, void *);
inline namespace e {
template <class... f> void *g(f... c) { return __builtin_operator_new(c...); }
void *h(unsigned c) { return g(c); }
int l;
template <class> struct aa;
template <class a, class = aa<a>> struct j;
template <class a> struct k {
union {
char ab;
a b;
};
bool n;
k() : ab(), n() {}
};
template <class a> struct ac : k<a> {
bool m() { return this->n; }
};
template <class r> struct o {
using ad = r::ae;
};
template <class af> struct ag {
using ad = af::ah;
};
template <class af> struct s {
using p = af;
using ae = o<p>::ad;
using ah = ag<p>::ad;
template <class a, class... f> static void ai(p c, a p2, f &&...p3) {
c.ai(p2, p3...);
}
};
template <class q> struct aj {
q ak;
};
int al;
template <class af> aj<typename af ::ae> am(af c) { return {c.allocate(al)}; }
template <class a> struct aa {
a *allocate(int) { return static_cast<a *>(h(sizeof(a))); }
typedef a *ae;
typedef a *ah;
template <class an, class... f> void ai(an *c, f &&...p2) {
new (c) an(p2...);
}
};
template <class a> struct ao {
using ap = a &;
template <class an> ao(an) : aq() {}
ap ar() { return aq; }
a aq;
};
template <class as> struct at : ao<as> {
using au = ao<as>;
template <class av, class aw> at(av c, aw) : au(c) {}
au::ap ax() { return (*this).ar(); }
};
template <class ay> struct az {
using p = ay;
using ba = p;
using bb = ba;
using ae = bb::ae;
ae bc;
ae bd;
ae be;
at<ae> bf;
az(unsigned, unsigned, ba &);
ae &bg() { return bf.ax(); }
};
template <class ay> az<ay>::az(unsigned c, unsigned, ba &p3) : bf(nullptr, p3) {
ba bh;
auto bi = am(bh);
bc = bi.ak;
bd = be = bc;
bg() = bc + c;
}
template <class a, class ay> struct j {
typedef a bj;
typedef ay p;
typedef s<p> bb;
typedef bb::ae ae;
typedef bb::ah bk;
bk begin() const noexcept;
bk end() const noexcept;
void bl(bj &&);
ae bd;
ae be;
at<ae> bf = at<ae>(nullptr, int());
template <class an> void bm(an &&);
ae &bg() { return bf.ax(); }
};
template <class a, class ay> j<a, ay>::bk j<a, ay>::begin() const noexcept {
return bd;
}
template <class a, class ay> j<a, ay>::bk j<a, ay>::end() const noexcept {
return be;
}
template <class a, class ay> template <class an> void j<a, ay>::bm(an &&c) {
p x;
az bn(1, 0, x);
a bo(c);
bb::ai(x, bn.be, bo);
bn.be++;
b(bd, bn.bd);
b(be, bn.be);
ae bq = bn.bg();
b(bg(), bq);
}
template <class a, class ay> void j<a, ay>::bl(bj &&c) {
if (bg())
;
else
bm(c);
}
} // namespace e
template <typename bp> struct br {
template <typename... bs> br(int, bs... p2) : bt(p2...) {}
bp bt;
};
template <typename bp> struct bv : br<bp> {
template <typename... bs> bv(int, bs &&...);
template <typename bu> bv(bu c) : bv(l, c) {}
bp &operator*() &;
};
template <typename bp>
template <typename... bs>
bv<bp>::bv(int, bs &&...p2) : br<bp>(l, p2...) {}
template <typename bp> bp &bv<bp>::operator*() & { return this->bt; }
namespace ca {
template <typename bw> struct bx {
using by = bw;
};
template <typename bz, typename bw> struct cc {
static bool cb(bw c) { return bz::cd(&c); }
};
template <typename, typename> struct ce;
template <typename bz, typename bw> struct ce<bz, bw *> {
static bool cb(bw *c) { return cc<bz, bw>::cb(*c); }
};
template <typename, typename, typename> struct cf;
template <typename bz, typename ci> struct cf<bz, ci, ci> {
static bool cb(ci c) { return ce<bz, ci>::cb(c); }
};
struct cg {
using cm = int *;
};
struct cj {
using cm = cg::cm;
};
struct ck {
using cm = cj::cm;
};
template <class> struct cl;
template <class ci> struct cl<ci *> {
static ck::cm cb(ci *c) { return (ck::cm)c; }
};
template <typename bz, typename bw> struct cn {
static bool cr(bw c) { return cf<bz, bw, typename bx<bw>::by>::cb(c); }
};
template <typename bz, typename bw> struct co : cn<bz, bw> {
using cq = co;
using cp = ck::cm;
static cp cv(bw c) {
cp cs;
if (!cq::cr(c))
return 0;
cs = cl<typename bx<bw>::by>::cb(c);
return cs;
}
};
template <typename bz, typename bw> auto ct(bw c) { return co<bz, bw>::cv(c); }
} // namespace ca
using ca::ct;
namespace ca {
template <typename cy> struct cu {
cy a;
};
template <typename, typename, int...> struct db;
template <typename cw, typename cx, int da> struct db<cw, cx, da> {
cx ch;
};
struct cz : db<cz, cu<void *>, 0> {};
} // namespace ca
namespace clang {
struct SourceManager;
struct dc {
using dd = int;
dd de;
};
struct dg {
dc df;
dc d;
};
struct CharSourceRange {
dg dh;
bool di;
CharSourceRange(bool) {}
};
struct LangOptions;
struct u {
ca::cu<ca::cz> a;
};
struct dj {
enum dk { v };
class {
friend dj;
unsigned dl;
} w;
dk z() { return dk(w.dl); }
};
struct dm : dj {
u dn;
};
struct CallExpr : dm {
unsigned y;
unsigned getNumArgs() { return y; }
dm *getArg(unsigned);
static bool cd(dj *c) { return c->z() <= v; }
};
struct ASTContext {
SourceManager &SourceMgr;
LangOptions &LangOpts;
SourceManager &getSourceManager() { return SourceMgr; }
LangOptions &getLangOpts() { return LangOpts; }
};
namespace tooling {
ac<CharSourceRange> getFileRangeForEdit(const CharSourceRange &,
const SourceManager &,
const LangOptions &, bool);
ac<CharSourceRange> getFileRangeForEdit(CharSourceRange c, ASTContext p2,
bool p3) {
SourceManager &__trans_tmp_4 = p2.getSourceManager();
LangOptions &__trans_tmp_5 = p2.getLangOpts();
return getFileRangeForEdit(c, __trans_tmp_4, __trans_tmp_5, p3);
}
} // namespace tooling
struct CallArg2 {
ac<CharSourceRange> std_move_call;
};
void ParseCallArgs3(CallExpr &c, ASTContext p2) {
int num_args = c.getNumArgs();
j<CallArg2> args;
for (int i = 0; i < num_args; ++i) {
dm __trans_tmp_6 = *c.getArg(i), arg = __trans_tmp_6;
dm *std_move_call = nullptr;
if (ct<CallExpr>(&arg))
std_move_call = &arg;
ac<CharSourceRange> std_move_range;
if (std_move_call)
std_move_range = tooling::getFileRangeForEdit(0, p2, true);
args.bl({std_move_range});
}
bv<j<CallArg2>> arg2(args);
for (auto t : *arg2)
t.std_move_call.m();
}
extern "C" {
void *pcontext;
void *pcall;
void ParseCallArgs2() {
ParseCallArgs3(*(CallExpr *)pcall, *(ASTContext *)pcontext);
}
}
} // namespace clang
the produce a different assembly with and without patch
clang -cc1 -triple x86_64-grtev4-linux-gnu -S -target-cpu x86-64 -O1 -fsanitize=bool -x c++ test.cc -o - -w
And if linked into my binary produces UBsan report with D150388 <https://reviews.llvm.org/D150388>, and no report on D150388 <https://reviews.llvm.org/D150388>^.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150388/new/
https://reviews.llvm.org/D150388
More information about the llvm-commits
mailing list