13744 Commits

Author SHA1 Message Date
Robert Marsh
755e21d355 C++: improve conversion handling in IRGuards.qll 2018-09-20 10:06:18 -07:00
Robert Marsh
e40ce91e7e C++: document new IR class and predicates 2018-09-20 10:06:18 -07:00
Robert Marsh
d6cea1b203 C++: Add class and predicates to other IR stages 2018-09-20 10:06:17 -07:00
Robert Marsh
b5cd48d819 C++: comments on new classes and predicates 2018-09-20 10:06:17 -07:00
Robert Marsh
0273b20743 C++: make internal classes private 2018-09-20 10:06:17 -07:00
Robert Marsh
ad8f30d2f7 C++: accept test output and add IR guards tests 2018-09-20 10:06:17 -07:00
Robert Marsh
d7e630b3c6 C++: Add IR-based port of Guards library
For ease of reviewing, I've checked in the .expected files from the
AST-based guards library. The next commit accepts output for these tests
and adds tests that use getAST rather than the translation layer.
2018-09-20 10:06:16 -07:00
Robert Marsh
4e1a37cd6e C++: add isStrict to RelationalInstruction 2018-09-20 10:06:16 -07:00
Robert Marsh
27a83e65b2 C++: add RelationalOpcode and RelationalInstruction 2018-09-20 10:06:16 -07:00
Robert Marsh
69962bd06c Merge pull request #203 from dave-bartolomeo/dave/GVN
C++: Initial attempt at IR-based value numbering
2018-09-20 10:00:45 -07:00
Dave Bartolomeo
5a25602c28 C++: Move GVN out of "internal" directory 2018-09-20 08:21:15 -07:00
Dave Bartolomeo
27cee9bd80 C++: Handle inheritance conversions in IR GVN 2018-09-20 08:00:38 -07:00
Dave Bartolomeo
bd156757d3 C++: Remove accidental add of IR.md 2018-09-19 14:26:17 -07:00
ian-semmle
4b0ab602e7 Merge pull request #202 from jbj/resolveClass-conservative
C++: more conservative resolveClass
2018-09-19 11:35:45 +01:00
Nick Rolfe
017e3a390f C++: stats for is_standard_layout_class 2018-09-19 10:26:11 +01:00
Nick Rolfe
f1358b7c02 C++: test for Class::isStandardLayout() 2018-09-19 10:26:11 +01:00
Nick Rolfe
e5b9dca312 C++: add Class::isStandardLayout() 2018-09-19 10:26:11 +01:00
Dave Bartolomeo
43f0289f0f C++: Remove Phi instructions from previous IR generations
It turns out that when building aliased SSA IR, we were still keeping around the Phi instructions from unaliased SSA IR. These leftover instructions didn't show up in dumps because they were not assigned to a block. However, when dumping additional instruction properties, they would show up as a top-level node in the dump, without a label.
2018-09-18 11:28:09 -07:00
Jonas Jensen
86fe0ce42e Merge pull request #107 from rdmarsh2/rdmarsh/cpp/HashCons
C++: HashCons library
2018-09-18 11:45:26 +02:00
Dave Bartolomeo
46b2c19c66 C++: Initial attempt at IR-based value numbering 2018-09-17 17:19:05 -07:00
Jonas Jensen
a7d897108a C++: Exclude non-toplevel items from resolveClass
Also exclude templates as their names are not canonical.

The test changes in `isfromtemplateinstantiation/` are the inverses of
what we got in 34c9892f7, which should be a good thing.
2018-09-17 15:55:34 +02:00
Jonas Jensen
d7f442b042 C++: Force unique resolveClass results 2018-09-17 15:52:38 +02:00
Jonas Jensen
b633ee1bc4 C++: Add more tests of resolveClass
These tests exercise the problematic cases where a variable can appear
to have multiple types because of how we fail to account for qualified
names when comparing type names.
2018-09-17 15:48:02 +02:00
Pavel Avgustinov
2b4da8d6a7 Parameter.qll: Tweak how effective declaration entries are computed
With the new formulation, we can join on function and index at the
same time, leading to significant performance gains on large code
bases that use templates extensively.
2018-09-14 12:22:01 +01:00
Dave Bartolomeo
c9cb2a0d14 Merge pull request #177 from jbj/ir-array-init-perf
C++: IR: Fix performance of value-init ranges
2018-09-14 00:14:45 -07:00
Raul Garcia
28050e1415 Change to cpp/overflow-buffer to detect access to an array using a negative index (static, out of range access, lower bound). 2018-09-13 15:44:32 -07:00
Jonas Jensen
9886e4a056 Merge remote-tracking branch 'upstream/master' into merge-master-next-20180913 2018-09-13 20:28:17 +02:00
semmle-qlci
3d022298dc Merge pull request #186 from Semmle/rc/1.18
Approved by esben-semmle
2018-09-13 12:34:54 +01:00
Nick Rolfe
3d2637a249 C++: stats for builtinconvertvector 2018-09-13 10:28:42 +01:00
Nick Rolfe
0957ee7c1b C++: support clang's __builtin_convertvector 2018-09-13 10:28:41 +01:00
Aditya Sharad
767045b55d Merge rc/1.18 into next. 2018-09-12 14:59:54 +01:00
Jonas Jensen
9fb5fbd995 C++: Restructure UnsafeUseOfStrcat for performance
This query gets optimized badly, and it has started timing out when we
run it on our own code base. Most of the evaluation time is spent in an
RA predicate named `#select#cpe#1#f#antijoin_rhs#1`, which takes 1m36s a
Wireshark snapshot.

This restructuring of the code makes the problematic RA predicate go
away.
2018-09-12 09:37:17 +02:00
Jonas Jensen
df948ecbbc C++: IR: designated initializer test 2018-09-11 19:43:02 +02:00
Dave Bartolomeo
49b8db9631 Merge pull request #180 from jbj/ArrayType-size-docs
C++: Document the three predicates for array size
2018-09-11 10:11:45 -07:00
Jonas Jensen
4304a4e1bc C++: Fix docs copy-paste error 2018-09-11 15:39:44 +02:00
Jonas Jensen
bb49966395 C++: Fixup getEndOfValueInitializedRange 2018-09-11 15:19:18 +02:00
Jonas Jensen
d956bf90ad C++: Document the three predicates for array size 2018-09-11 15:15:44 +02:00
ian-semmle
628d7b95d9 Merge pull request #178 from jbj/ir-duplicateOperand-perf
C++: IR: InstructionSanity::duplicateOperand perf
2018-09-11 12:53:27 +01:00
Jonas Jensen
ecfc53668f C++: IR: InstructionSanity::duplicateOperand perf
The `InstructionSanity::duplicateOperand` predicate used `count` instead
of `strictcount`. The 0-case of this `count` was as large as the
Cartesian product of `Instruction` and `OperandTag`, which made
`duplicateOperand` take forever to compute on large snapshots.
2018-09-11 12:04:27 +02:00
Jonas Jensen
b2571c8d63 C++: IR: Fix performance of value-init ranges
On a snapshot of Postgres, evaluation of
`getNextExplicitlyInitializedElementAfter#fff#antijoin_rhs#1` took
forever, preventing the computation of the IR. I haven't been able to
reproduce it with a small test case, but the implementation of
`getNextExplicitlyInitializedElementAfter` was fragile because it called
the inline predicate `ArrayAggregateLiteral.isInitialized`. It also
seemed inefficient that `getNextExplicitlyInitializedElementAfter` was
computed for many values of its parameters that were never needed by the
caller.

This commit replaces `getNextExplicitlyInitializedElementAfter` with a
new predicate named `getEndOfValueInitializedRange`, which should have
the same behavior but a more efficient implementation. It uses a helper
predicate `getNextExplicitlyInitializedElementAfter`, which shares its
name with the now-deleted predicate but has behavior that I think
matches the name.
2018-09-11 11:43:46 +02:00
Tom Hvitved
70e713122f Merge branch 'rc/1.18' into merge-rc 2018-09-11 09:11:03 +02:00
Robert Marsh
0e44bf3c30 C++: Add import for LGTM 2018-09-10 12:22:45 -07:00
Robert Marsh
cb9f1269f9 C++: select example exprs for HashCons portably
This makes two changes to how example exprs are selected. Example exprs
are now ordered separately by each piece of the location, rather than by
stringifying their location. Second, UnknownLocations are now ordered
after locations with absolute paths, by using "~" in the lexicographic
comparison of absolute paths. I think this works on both POSIX and
Windows systems, but it's possible I'm missing a way to start an
absolute path with a unicode character.
2018-09-10 12:22:45 -07:00
Robert Marsh
fb8ad9387d C++: Uniqueness fixes for HashCons 2018-09-10 12:22:45 -07:00
Robert Marsh
166dba288b C++: accept test output 2018-09-10 12:22:45 -07:00
Robert Marsh
bbafcd9941 C++: typeid and noexcept fixes in HashCons 2018-09-10 12:22:45 -07:00
Robert Marsh
2d098fed98 fix HashCons for typeid of type 2018-09-10 12:22:44 -07:00
Robert Marsh
c42ecfe8f9 C++: Simplify HashCons for new and handle extents 2018-09-10 12:22:44 -07:00
Robert Marsh
9f476e585a C++: Simplify some code 2018-09-10 12:22:44 -07:00
Robert Marsh
fa9eeea302 C++: remove implicit this handling in HashCons 2018-09-10 12:22:44 -07:00