[PATCH] D44415: [PM][FunctionAttrs] add NoUnwind attribute inference to PostOrderFunctionAttrs pass
Justin Lebar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 14 07:51:23 PDT 2018
jlebar added a comment.
> generating direct calls here seems really, really hard... Maybe you have an idea I don't see...
It's...not awful. https://godbolt.org/g/D3KMQH
#include <array>
#include <vector>
#include <utility>
struct Instruction;
struct FooDescriptor {
static bool IsGood(Instruction* I) { return true; }
};
struct BarDescriptor {
static bool IsGood(Instruction* I) { return false; }
};
template <typename... Descriptors>
struct AttrInferer {
void Foo(std::vector<Instruction*> Instrs) {
for (Instruction* Instr : Instrs) {
bool IsGood[] = {
[&] { return Descriptors::IsGood(Instr); }()...
};
for (int i = 0; i < sizeof...(Descriptors); ++i) {
}
}
}
};
void Test() {
AttrInferer<FooDescriptor, BarDescriptor> a;
a.Foo({});
}
Anyway if you think the virtual functions aren't a big deal, that's good enough for me.
Repository:
rL LLVM
https://reviews.llvm.org/D44415
More information about the llvm-commits
mailing list