Revision fffb8bd568e5e1053437471806a1528e7c569081 authored by Andrew Adams on 24 October 2023, 17:23:49 UTC, committed by GitHub on 24 October 2023, 17:23:49 UTC
Explicitly mark which loops get loop-carry-dependencies inserted by
sliding window to assist storage folding.

Storage folding needs to know about this so it doesn't try to fold in a
way that invalidates these read-after-write dependencies. It currently
tries to prove the absence of hazards with box_contains(box_provided,
box_required), but this is sometimes incorrect because box_provided
could be conservatively large, and the code it analyses might not
actually provide (store to) all the required (loaded from) values.

It's simpler for sliding window to just tell storage folding when it
inserts loop-carry-dependencies, and this is most simply done directly
in the IR itself.

Fixes #7909
1 parent d023065
Raw File
regexp_replace.cpp
#include <cassert>
#include <cstring>
#include <iostream>
#include <regex>

// A utility that does a single regexp-based replace on stdin and dumps it to stdout.
// Exists solely because we can't rely on (e.g.) `sed` being available in Windows
// build environments. Usage is basically equivalent to `sed -e 's/regex/replacement/g'`
// Note that if regex is an empty string, this becomes a simple line-by-line file copy.

int main(int argc, const char **argv) {
    if (argc != 3) {
        fprintf(stderr, "Usage: %s regex replacement\n", argv[0]);
        return -1;
    }
    std::regex re(argv[1]);

    std::string line;
    while (std::getline(std::cin, line)) {
        std::regex_replace(std::ostreambuf_iterator<char>(std::cout),
                           line.begin(), line.end(), re, argv[2]);
        std::cout << std::endl;
    }
    return 0;
}
back to top