@@ -12,6 +12,9 @@ int getConstantValue(Instruction instr) {
12
12
or
13
13
result = getConstantValue ( instr .( CopyInstruction ) .getSourceValue ( ) )
14
14
or
15
+ getConstantValue ( instr .( LogicalNotInstruction ) .getUnary ( ) ) != 0 and
16
+ result = 0
17
+ or
15
18
exists ( PhiInstruction phi |
16
19
phi = instr and
17
20
result = unique( Operand op | op = phi .getAnInputOperand ( ) | getConstantValue ( op .getDef ( ) ) )
@@ -26,28 +29,25 @@ private predicate binaryInstructionOperands(BinaryInstruction instr, int left, i
26
29
27
30
pragma [ noinline]
28
31
private int getBinaryInstructionValue ( BinaryInstruction instr ) {
29
- exists ( int left , int right |
30
- binaryInstructionOperands ( instr , left , right ) and
31
- (
32
- instr instanceof AddInstruction and result = add ( left , right )
33
- or
34
- instr instanceof SubInstruction and result = sub ( left , right )
35
- or
36
- instr instanceof MulInstruction and result = mul ( left , right )
37
- or
38
- instr instanceof DivInstruction and result = div ( left , right )
39
- or
40
- instr instanceof CompareEQInstruction and result = compareEQ ( left , right )
41
- or
42
- instr instanceof CompareNEInstruction and result = compareNE ( left , right )
43
- or
44
- instr instanceof CompareLTInstruction and result = compareLT ( left , right )
45
- or
46
- instr instanceof CompareGTInstruction and result = compareGT ( left , right )
47
- or
48
- instr instanceof CompareLEInstruction and result = compareLE ( left , right )
49
- or
50
- instr instanceof CompareGEInstruction and result = compareGE ( left , right )
51
- )
32
+ exists ( int left , int right | binaryInstructionOperands ( instr , left , right ) |
33
+ instr instanceof AddInstruction and result = add ( left , right )
34
+ or
35
+ instr instanceof SubInstruction and result = sub ( left , right )
36
+ or
37
+ instr instanceof MulInstruction and result = mul ( left , right )
38
+ or
39
+ instr instanceof DivInstruction and result = div ( left , right )
40
+ or
41
+ instr instanceof CompareEQInstruction and result = compareEQ ( left , right )
42
+ or
43
+ instr instanceof CompareNEInstruction and result = compareNE ( left , right )
44
+ or
45
+ instr instanceof CompareLTInstruction and result = compareLT ( left , right )
46
+ or
47
+ instr instanceof CompareGTInstruction and result = compareGT ( left , right )
48
+ or
49
+ instr instanceof CompareLEInstruction and result = compareLE ( left , right )
50
+ or
51
+ instr instanceof CompareGEInstruction and result = compareGE ( left , right )
52
52
)
53
53
}
0 commit comments