Skip to content

Commit

Permalink
Consistency for poison
Browse files Browse the repository at this point in the history
  • Loading branch information
KuechA committed Nov 8, 2024
1 parent 897fca2 commit a0c327d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -741,12 +741,8 @@ class StatementHandler(lang: LLVMIRLanguageFrontend) :
condition.lhs = undefCheck
val poisonCheck = newBinaryOperator("!=", rawNode = instr)
poisonCheck.lhs = operand
poisonCheck.rhs =
newLiteral(
"POISON",
operand.type,
rawNode = instr
) // This could be e.g. NAN. Not sure for complex types
// This could be e.g. NAN. Not sure for complex types
poisonCheck.rhs = newReference("poison", operand.type, rawNode = instr)
condition.rhs = poisonCheck

// Call to a dummy function "llvm.freeze" which would fill the undef or poison values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,8 +748,8 @@ class StatementHandlerTest {
assertIs<BinaryOperator>(poisonCheck)
assertEquals("!=", poisonCheck.operatorCode)
assertRefersTo(poisonCheck.lhs, wDeclaration)
// poison is modeled as the string "POISON"
assertLiteralValue("POISON", poisonCheck.rhs)
// poison is modeled as a reference "poison"
assertLocalName("poison", poisonCheck.rhs)

assertRefersTo(freezeInstruction.thenExpression, wDeclaration)

Expand Down

0 comments on commit a0c327d

Please sign in to comment.