Browse Source

Fixed the order in which phi nodes are created (was incorrect)

[#80895676]
cl-refactor
artur-zawlocki 10 years ago
parent
commit
701d99e052
  1. 3
      evmcc/test/jump/fib1.ethel
  2. 2
      evmcc/test/jump/fib1.evm
  3. 4
      evmcc/test/jump/rec1.ethel
  4. 1
      evmcc/test/jump/rec1.evm
  5. 2
      libevmjit/BasicBlock.cpp

3
evmcc/test/jump/fib1.ethel

@ -2,4 +2,5 @@ let fib n =
if n < 3 then 1
else fib (n-1) + fib (n-2)
return fib 5
return fib 10

2
evmcc/test/jump/fib1.evm

@ -1 +1 @@
630000000d60056300000016585d60005460206000f28060030a630000004759630000002f816001036300000016585d630000003f836002036300000016585d0163000000495860019350505058
6007600a6010585d60005460206000f26003810a602f596020600282036010585d602a600183036010585d01603158600190509058

4
evmcc/test/jump/rec1.ethel

@ -0,0 +1,4 @@
let f n =
if n == 0 then 2 else f (n-1)
return f 10

1
evmcc/test/jump/rec1.evm

@ -0,0 +1 @@
6007600a6010585d60005460206000f26000810e6024596020600182036010585d602658600290509058

2
libevmjit/BasicBlock.cpp

@ -52,7 +52,7 @@ llvm::Value* BasicBlock::LocalStack::get(size_t _index)
m_backend.insert(m_backend.begin(), nMissingVals, nullptr);
for (decltype(nMissingVals) i = 0; i < nMissingVals; ++i)
{
m_backend[i] = m_llvmBB->empty() ?
m_backend[nMissingVals - 1 - i] = m_llvmBB->empty() ?
llvm::PHINode::Create(Type::i256, 0, {}, m_llvmBB) :
llvm::PHINode::Create(Type::i256, 0, {}, m_llvmBB->getFirstNonPHI());
m_numRequiredStackItems += 1;

Loading…
Cancel
Save