Don't splice in vector creation when optimizing vector-length.

Closes PR13788.

original commit: d9264525bd823052cd456df0caa900eac2d87ed3
This commit is contained in:
Vincent St-Amour 2013-05-28 11:57:00 -04:00
parent 60f3bcbc46
commit 724cd37520
2 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1,9 @@
#;
(
TR opt: pr13788.rkt 9:0 (vector-length (vector 1 2 3)) -- known-length vector-length
3
)
#lang typed/racket
(vector-length (vector 1 2 3)) ; should not print the vector

View File

@ -44,7 +44,7 @@
(add-disappeared-use #'op)
(match (type-of #'v)
[(tc-result1: (HeterogeneousVector: es))
#`(begin v.opt #,(length es))]))) ; v may have side effects
#`(let () v.opt #,(length es))]))) ; v may have side effects
;; we can optimize vector-length on all vectors.
;; since the program typechecked, we know the arg is a vector.
;; we can optimize no matter what.