diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2012-03-26 21:52:36 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2012-03-26 21:52:36 +0000 |
commit | 911b3b2e1a9aa8d75d5fdb0465907082684d323a (patch) | |
tree | 95464492fd551d461e1827222d1b094d04685fa3 /lib | |
parent | 906be24b79ec5b97d8fb4e8017659af480bd8d04 (diff) | |
download | klee-911b3b2e1a9aa8d75d5fdb0465907082684d323a.tar.gz |
STPBuilder: fix ConstantExpr builder for the case where width>64 but
is not a multiple of 64. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@153473 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Solver/STPBuilder.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Solver/STPBuilder.cpp b/lib/Solver/STPBuilder.cpp index f150d2a5..28b5c1a5 100644 --- a/lib/Solver/STPBuilder.cpp +++ b/lib/Solver/STPBuilder.cpp @@ -478,13 +478,13 @@ ExprHandle STPBuilder::constructActual(ref<Expr> e, int *width_out) { if (*width_out <= 64) return bvConst64(*width_out, CE->getZExtValue()); - // FIXME: Optimize? ref<ConstantExpr> Tmp = CE; ExprHandle Res = bvConst64(64, Tmp->Extract(0, 64)->getZExtValue()); - for (unsigned i = (*width_out / 64) - 1; i; --i) { - Tmp = Tmp->LShr(ConstantExpr::alloc(64, Tmp->getWidth())); - Res = vc_bvConcatExpr(vc, bvConst64(std::min(64U, Tmp->getWidth()), - Tmp->Extract(0, 64)->getZExtValue()), + while (Tmp->getWidth() > 64) { + Tmp = Tmp->Extract(64, Tmp->getWidth()-64); + unsigned Width = std::min(64U, Tmp->getWidth()); + Res = vc_bvConcatExpr(vc, bvConst64(Width, + Tmp->Extract(0, Width)->getZExtValue()), Res); } return Res; |