[PATCH] D35594: [GISel]: ConstantFold operations when building MIR
Aditya Nandakumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 26 15:09:28 PDT 2017
aditya_nandakumar marked an inline comment as done.
aditya_nandakumar added a comment.
I can try changing one of IRTranslator's build methods to use this API instead and then I should be able to write a test case.
================
Comment at: include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h:79-85
+ void buildSources(MachineInstrBuilder &MIB) { }
+ template<typename ... UseArgsTy>
+ void buildSources(MachineInstrBuilder &MIB, UseArgsTy &&... Args) {
+ unsigned It[] = {(getRegFromArg(Args))...};
+ for (const auto &i : It)
+ MIB.addUse(i);
+ }
----------------
dsanders wrote:
> This will need refreshing to account for the updates to one of your other patches.
This is not needed anymore. The other patch went in.
================
Comment at: lib/CodeGen/GlobalISel/MachineIRBuilder.cpp:185-186
+ case TargetOpcode::G_MUL: return C1 * C2;
+ case TargetOpcode::G_AND: return C1 & C2;
+ case TargetOpcode::G_OR: return C1 | C2;
+ }
----------------
dsanders wrote:
> XOR seems to be missing
Missed that. Thanks.
Repository:
rL LLVM
https://reviews.llvm.org/D35594
More information about the llvm-commits
mailing list