-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undocumented Unconventional Order of BR Instruction Label Operands #399
Comments
I don't follow... We supply cond, iftrue, and iffalse in that order: Lines 2213 to 2215 in 13c6c3b
|
Thanks for looking into this! The I've produced an example demonstrating the issue I see. Could you let me know if the pass/fail behaviour of the assertions in the example are expected? Here's the small example illustrating the issue:
Here's what is printed:
|
Describe the Bug
The convention adopted by the syntax for the conditional 'br' instruction in the LLVM language reference manual (https://llvm.org/docs/LangRef.html#i-br) is:
br i1 <cond>, label <iftrue>, label <iffalse>
In Inkwell, an
InstructionValue
instr
with opcodeinstr.get_opcode() == InstructionOpcode::Br
andinstr.get_num_operands() == 3
has the indices of the<iftrue>
and<iffalse>
operands swapped.That is,
instr.get_operand(1)
represents the<iffalse>
basic block andinstr.get_operand(2)
represents the<iftrue>
basic block.Expected Behavior
I expected the behavior to match the syntax for the conditional 'br' instruction in the LLVM language reference manual:
instr.get_operand(1)
represents the<iftrue>
basic block andinstr.get_operand(2)
represents the<iffalse>
basic block.I don't think changing this to match the syntax for the conditional 'br' instruction in the LLVM language reference manual is feasible due to such a change being breaking. Instead, I propose documentation for Inkwell explicitly declares the semantics of each operand.
LLVM Version (please complete the following information):
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: