Skip to content

Commit

Permalink
Remove Viper field access from trigger with top-level PointerSubscrip…
Browse files Browse the repository at this point in the history
…t or DerefPointer

* Gives a 12% performance improvement on Silicon for examples/concepts/c/structs.c
  • Loading branch information
superaxander committed Jul 25, 2024
1 parent 401c3d9 commit a1773b7
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/rewrite/vct/rewrite/adt/ImportPointer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -286,25 +286,25 @@ case class ImportPointer[Pre <: Generation](importer: ImportADTImporter)
Nil,
Nil,
)(PanicBlame("ptr_deref requires nothing."))
case other => rewriteDefault(other)
case other => dispatch(other)
}
}

override def postCoerce(e: Expr[Pre]): Expr[Post] = {
implicit val o: Origin = e.o
e match {
// case f @ Forall(_, triggers, _) =>
// f.rewrite(triggers =
// triggers.map(_.map(rewriteTopLevelPointerSubscriptInTrigger))
// )
// case s @ Starall(_, triggers, _) =>
// s.rewrite(triggers =
// triggers.map(_.map(rewriteTopLevelPointerSubscriptInTrigger))
// )
// case e @ Exists(_, triggers, _) =>
// e.rewrite(triggers =
// triggers.map(_.map(rewriteTopLevelPointerSubscriptInTrigger))
// )
case f @ Forall(_, triggers, _) =>
f.rewrite(triggers =
triggers.map(_.map(rewriteTopLevelPointerSubscriptInTrigger))
)
case s @ Starall(_, triggers, _) =>
s.rewrite(triggers =
triggers.map(_.map(rewriteTopLevelPointerSubscriptInTrigger))
)
case e @ Exists(_, triggers, _) =>
e.rewrite(triggers =
triggers.map(_.map(rewriteTopLevelPointerSubscriptInTrigger))
)
case sub @ PointerSubscript(pointer, index) =>
SilverDeref(
obj =
Expand Down

0 comments on commit a1773b7

Please sign in to comment.