[PATCH] D16383: Change ConstantFoldInstOperands to take Instruction instead of opcode and type. NFC.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 25 16:50:35 PST 2016

dberlin added a subscriber: dberlin.
dberlin added a comment.

Hi Manuel,

Things like NewGVN don't always have instruction *'s to hand to ConstantFoldInstOperands.

For example, we create an expression that stores operands and opcodes and such (like GVN does!)

Before, we could pass the opcode and operands, and that worked great.

Now you've made it take the Instruction.

I don't see how this makes anything related to opaque pointers easier, maybe you could enlighten me?

Additionally, i can't see how use cases like mine are supposed to function - i have what was an instruction, but is now an operation and some operands.
I want to see if it will fold to a constant.

What API am i expected to use to do so?

Note also that the InstOperands API was *explicitly* designed to not require an instruction, to support the above use case. This was the difference between ConstantFoldInst and ConstantFoldInstOperands.  It happens most users can pass it instructions, but that doesn't , IMHO make a lot of sense.

I want to request that you provide some way to not require the instruction, as the current API does (and many users use!), so that folks can use this without creating fake instructions to do so.


More information about the llvm-commits mailing list