Files
TheRock/compiler/amd-llvm/llvm/docs/HistoricalNotes/2002-05-12-InstListChange.txt
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

56 lines
2.4 KiB
Plaintext

Date: Sun, 12 May 2002 17:12:53 -0500 (CDT)
From: Chris Lattner <sabre@nondot.org>
To: "Vikram S. Adve" <vadve@cs.uiuc.edu>
Subject: LLVM change
There is a fairly fundemental change that I would like to make to the LLVM
infrastructure, but I'd like to know if you see any drawbacks that I
don't...
Basically right now at the basic block level, each basic block contains an
instruction list (returned by getInstList()) that is a ValueHolder of
instructions. To iterate over instructions, we must actually iterate over
the instlist, and access the instructions through the instlist.
To add or remove an instruction from a basic block, we need to get an
iterator to an instruction, which, given just an Instruction*, requires a
linear search of the basic block the instruction is contained in... just
to insert an instruction before another instruction, or to delete an
instruction! This complicates algorithms that should be very simple (like
simple constant propagation), because they aren't actually sparse anymore,
they have to traverse basic blocks to remove constant propagated
instructions.
Additionally, adding or removing instructions to a basic block
_invalidates all iterators_ pointing into that block, which is really
irritating.
To fix these problems (and others), I would like to make the ordering of
the instructions be represented with a doubly linked list in the
instructions themselves, instead of an external data structure. This is
how many other representations do it, and frankly I can't remember why I
originally implemented it the way I did.
Long term, all of the code that depends on the nasty features in the
instruction list (which can be found by grep'ing for getInstList()) will
be changed to do nice local transformations. In the short term, I'll
change the representation, but preserve the interface (including
getInstList()) so that all of the code doesn't have to change.
Iteration over the instructions in a basic block remains the simple:
for (BasicBlock::iterator I = BB->begin(), E = BB->end(); I != E; ++I) ...
But we will also support:
for (Instruction *I = BB->front(); I; I = I->getNext()) ...
After converting instructions over, I'll convert basic blocks and
functions to have a similar interface.
The only negative aspect of this change that I see is that it increases
the amount of memory consumed by one pointer per instruction. Given the
benefits, I think this is a very reasonable tradeoff.
What do you think?
-Chris