File tree Expand file tree Collapse file tree 3 files changed +6
-30
lines changed
cpp/ql/src/semmle/code/cpp/ir/implementation Expand file tree Collapse file tree 3 files changed +6
-30
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,8 @@ int getConstantValue(Instruction instr) {
1010 result = getConstantValue ( instr .( CopyInstruction ) .getSourceValue ( ) ) or
1111 exists ( PhiInstruction phi |
1212 phi = instr and
13- result = max ( Instruction def | def = phi .getAnInput ( ) | getConstantValueToPhi ( def ) ) and
14- result = min ( Instruction def | def = phi .getAnInput ( ) | getConstantValueToPhi ( def ) )
15- )
16- }
17-
18- pragma [ noinline]
19- int getConstantValueToPhi ( Instruction def ) {
20- exists ( PhiInstruction phi |
21- result = getConstantValue ( def ) and
22- def = phi .getAnInput ( )
13+ result = max ( Operand op | op = phi .getAnInputOperand ( ) | getConstantValue ( op .getDef ( ) ) ) and
14+ result = min ( Operand op | op = phi .getAnInputOperand ( ) | getConstantValue ( op .getDef ( ) ) )
2315 )
2416}
2517
Original file line number Diff line number Diff line change @@ -10,16 +10,8 @@ int getConstantValue(Instruction instr) {
1010 result = getConstantValue ( instr .( CopyInstruction ) .getSourceValue ( ) ) or
1111 exists ( PhiInstruction phi |
1212 phi = instr and
13- result = max ( Instruction def | def = phi .getAnInput ( ) | getConstantValueToPhi ( def ) ) and
14- result = min ( Instruction def | def = phi .getAnInput ( ) | getConstantValueToPhi ( def ) )
15- )
16- }
17-
18- pragma [ noinline]
19- int getConstantValueToPhi ( Instruction def ) {
20- exists ( PhiInstruction phi |
21- result = getConstantValue ( def ) and
22- def = phi .getAnInput ( )
13+ result = max ( Operand op | op = phi .getAnInputOperand ( ) | getConstantValue ( op .getDef ( ) ) ) and
14+ result = min ( Operand op | op = phi .getAnInputOperand ( ) | getConstantValue ( op .getDef ( ) ) )
2315 )
2416}
2517
Original file line number Diff line number Diff line change @@ -10,16 +10,8 @@ int getConstantValue(Instruction instr) {
1010 result = getConstantValue ( instr .( CopyInstruction ) .getSourceValue ( ) ) or
1111 exists ( PhiInstruction phi |
1212 phi = instr and
13- result = max ( Instruction def | def = phi .getAnInput ( ) | getConstantValueToPhi ( def ) ) and
14- result = min ( Instruction def | def = phi .getAnInput ( ) | getConstantValueToPhi ( def ) )
15- )
16- }
17-
18- pragma [ noinline]
19- int getConstantValueToPhi ( Instruction def ) {
20- exists ( PhiInstruction phi |
21- result = getConstantValue ( def ) and
22- def = phi .getAnInput ( )
13+ result = max ( Operand op | op = phi .getAnInputOperand ( ) | getConstantValue ( op .getDef ( ) ) ) and
14+ result = min ( Operand op | op = phi .getAnInputOperand ( ) | getConstantValue ( op .getDef ( ) ) )
2315 )
2416}
2517
You can’t perform that action at this time.
0 commit comments