<commit_before>#include "ConstantProp.hpp"

using namespace IR;

void determineGlobalConstants()
{
  for(auto& s : IR::ir)
  {
    auto subr = s.second;
    auto writes = subr->getWrites();
    for(auto v : writes)
    {
      if(v->isGlobal())
      {
        IR::globalConstants[v] = false;
      }
    }
  }
}
<commit_msg>Improved global constant analysis<commit_after>#include "ConstantProp.hpp"

using namespace IR;

void determineGlobalConstants()
{
  for(auto& s : IR::ir)
  {
    auto subr = s.second;
    for(auto stmt : subr->stmts)
    {
      auto outputs = stmt->getOutput();
      for(auto out : outputs)
      {
        auto writes = out->getWrites();
        for(auto w : writes)
        {
          if(w->isGlobal())
          {
            //there is an assignment to w,
            //so w is not a constant
            IR::globalConstants[w] = false;
          }
        }
      }
    }
  }
}

{'fraction_non_alphanumeric': 0.13048245614035087, 'fraction_numerical': 0.0, 'mean_word_length': 1.889240506329114, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7420819', 'n_tokens_mistral': 303, 'n_tokens_neox': 301, 'n_words': 68}