C++: Add tests.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-03-19 11:26:32 +00:00
parent 06dbb4e9ef
commit e16e1c7e83
5 changed files with 863 additions and 0 deletions

View File

@@ -18670,6 +18670,786 @@ ir.cpp:
# 2376| getExpr(): [FunctionAccess] VoidToInt
# 2376| Type = [RoutineType] ..()(..)
# 2376| ValueCategory = prvalue
# 2381| [TopLevelFunction] int small_operation_should_not_be_constant_folded()
# 2381| <params>:
# 2381| getEntryPoint(): [BlockStmt] { ... }
# 2382| getStmt(0): [ReturnStmt] return ...
# 2382| getExpr(): [AddExpr] ... + ...
# 2382| Type = [IntType] int
# 2382| Value = [AddExpr] 2
# 2382| ValueCategory = prvalue
# 2382| getLeftOperand(): [Literal] 1
# 2382| Type = [IntType] int
# 2382| Value = [Literal] 1
# 2382| ValueCategory = prvalue
# 2382| getRightOperand(): [Literal] 1
# 2382| Type = [IntType] int
# 2382| Value = [Literal] 1
# 2382| ValueCategory = prvalue
# 2392| [TopLevelFunction] int large_operation_should_be_constant_folded()
# 2392| <params>:
# 2392| getEntryPoint(): [BlockStmt] { ... }
# 2393| getStmt(0): [ReturnStmt] return ...
# 2393| getExpr(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 64
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 32
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 16
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 16
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 16
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 16
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 32
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 16
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 16
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [AddExpr] ... + ...
# 2393| Type = [IntType] int
# 2393| Value = [AddExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getRightOperand(): [Literal] 1
# 2393| Type = [IntType] int
# 2393| Value = [Literal] 1
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 2
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 4
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 8
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 16
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 16
# 2393| ValueCategory = prvalue
# 2393| getLeftOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 32
# 2393| ValueCategory = prvalue
# 2393| getRightOperand().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 32
# 2393| ValueCategory = prvalue
# 2393| getExpr().getFullyConverted(): [ParenthesisExpr] (...)
# 2393| Type = [IntType] int
# 2393| Value = [ParenthesisExpr] 64
# 2393| ValueCategory = prvalue
perf-regression.cpp:
# 4| [CopyAssignmentOperator] Big& Big::operator=(Big const&)
# 4| <params>:

View File

@@ -15135,6 +15135,34 @@ ir.cpp:
# 2374| v2374_7(void) = AliasedUse : m2374_3
# 2374| v2374_8(void) = ExitFunction :
# 2381| int small_operation_should_not_be_constant_folded()
# 2381| Block 0
# 2381| v2381_1(void) = EnterFunction :
# 2381| m2381_2(unknown) = AliasedDefinition :
# 2381| m2381_3(unknown) = InitializeNonLocal :
# 2381| m2381_4(unknown) = Chi : total:m2381_2, partial:m2381_3
# 2382| r2382_1(glval<int>) = VariableAddress[#return] :
# 2382| r2382_2(int) = Constant[2] :
# 2382| m2382_3(int) = Store[#return] : &:r2382_1, r2382_2
# 2381| r2381_5(glval<int>) = VariableAddress[#return] :
# 2381| v2381_6(void) = ReturnValue : &:r2381_5, m2382_3
# 2381| v2381_7(void) = AliasedUse : m2381_3
# 2381| v2381_8(void) = ExitFunction :
# 2392| int large_operation_should_be_constant_folded()
# 2392| Block 0
# 2392| v2392_1(void) = EnterFunction :
# 2392| m2392_2(unknown) = AliasedDefinition :
# 2392| m2392_3(unknown) = InitializeNonLocal :
# 2392| m2392_4(unknown) = Chi : total:m2392_2, partial:m2392_3
# 2393| r2393_1(glval<int>) = VariableAddress[#return] :
# 2393| r2393_2(int) = Constant[64] :
# 2393| m2393_3(int) = Store[#return] : &:r2393_1, r2393_2
# 2392| r2392_5(glval<int>) = VariableAddress[#return] :
# 2392| v2392_6(void) = ReturnValue : &:r2392_5, m2393_3
# 2392| v2392_7(void) = AliasedUse : m2392_3
# 2392| v2392_8(void) = ExitFunction :
perf-regression.cpp:
# 6| void Big::Big()
# 6| Block 0

View File

@@ -2378,4 +2378,19 @@ namespace return_routine_type {
}
int small_operation_should_not_be_constant_folded() {
return 1 + 1;
}
#define BINOP2(x) (x + x)
#define BINOP4(x) (BINOP2(x) + BINOP2(x))
#define BINOP8(x) (BINOP4(x) + BINOP4(x))
#define BINOP16(x) (BINOP8(x) + BINOP8(x))
#define BINOP32(x) (BINOP16(x) + BINOP16(x))
#define BINOP64(x) (BINOP32(x) + BINOP32(x))
int large_operation_should_be_constant_folded() {
return BINOP64(1);
}
// semmle-extractor-options: -std=c++20 --clang

View File

@@ -12530,6 +12530,20 @@
| ir.cpp:2374:32:2374:47 | SideEffect | m2374_3 |
| ir.cpp:2376:9:2376:44 | Address | &:r2376_1 |
| ir.cpp:2376:16:2376:43 | StoreValue | r2376_2 |
| ir.cpp:2381:5:2381:49 | Address | &:r2381_5 |
| ir.cpp:2381:5:2381:49 | ChiPartial | partial:m2381_3 |
| ir.cpp:2381:5:2381:49 | ChiTotal | total:m2381_2 |
| ir.cpp:2381:5:2381:49 | Load | m2382_3 |
| ir.cpp:2381:5:2381:49 | SideEffect | m2381_3 |
| ir.cpp:2382:5:2382:17 | Address | &:r2382_1 |
| ir.cpp:2382:12:2382:16 | StoreValue | r2382_2 |
| ir.cpp:2392:5:2392:45 | Address | &:r2392_5 |
| ir.cpp:2392:5:2392:45 | ChiPartial | partial:m2392_3 |
| ir.cpp:2392:5:2392:45 | ChiTotal | total:m2392_2 |
| ir.cpp:2392:5:2392:45 | Load | m2393_3 |
| ir.cpp:2392:5:2392:45 | SideEffect | m2392_3 |
| ir.cpp:2393:5:2393:22 | Address | &:r2393_1 |
| ir.cpp:2393:12:2393:21 | StoreValue | r2393_2 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_7 |

View File

@@ -13977,6 +13977,32 @@ ir.cpp:
# 2374| v2374_6(void) = AliasedUse : ~m?
# 2374| v2374_7(void) = ExitFunction :
# 2381| int small_operation_should_not_be_constant_folded()
# 2381| Block 0
# 2381| v2381_1(void) = EnterFunction :
# 2381| mu2381_2(unknown) = AliasedDefinition :
# 2381| mu2381_3(unknown) = InitializeNonLocal :
# 2382| r2382_1(glval<int>) = VariableAddress[#return] :
# 2382| r2382_2(int) = Constant[2] :
# 2382| mu2382_3(int) = Store[#return] : &:r2382_1, r2382_2
# 2381| r2381_4(glval<int>) = VariableAddress[#return] :
# 2381| v2381_5(void) = ReturnValue : &:r2381_4, ~m?
# 2381| v2381_6(void) = AliasedUse : ~m?
# 2381| v2381_7(void) = ExitFunction :
# 2392| int large_operation_should_be_constant_folded()
# 2392| Block 0
# 2392| v2392_1(void) = EnterFunction :
# 2392| mu2392_2(unknown) = AliasedDefinition :
# 2392| mu2392_3(unknown) = InitializeNonLocal :
# 2393| r2393_1(glval<int>) = VariableAddress[#return] :
# 2393| r2393_2(int) = Constant[64] :
# 2393| mu2393_3(int) = Store[#return] : &:r2393_1, r2393_2
# 2392| r2392_4(glval<int>) = VariableAddress[#return] :
# 2392| v2392_5(void) = ReturnValue : &:r2392_4, ~m?
# 2392| v2392_6(void) = AliasedUse : ~m?
# 2392| v2392_7(void) = ExitFunction :
perf-regression.cpp:
# 6| void Big::Big()
# 6| Block 0