diff --git a/lib/std/collections/bitset.c3 b/lib/std/collections/bitset.c3 index ec0c35c74..1d26146b1 100644 --- a/lib/std/collections/bitset.c3 +++ b/lib/std/collections/bitset.c3 @@ -86,15 +86,29 @@ struct GrowableBitSet * @param initial_capacity * @param [&inout] allocator "The allocator to use, defaults to the heap allocator" **/ -fn GrowableBitSet* GrowableBitSet.init_new(&self, usz initial_capacity = 1, Allocator* allocator = mem::heap()) +fn GrowableBitSet* GrowableBitSet.new_init(&self, usz initial_capacity = 1, Allocator* allocator = mem::heap()) { - self.data.init_new(initial_capacity, allocator); + self.data.new_init(initial_capacity, allocator); return self; } -fn GrowableBitSet* GrowableBitSet.init_temp(&self, usz initial_capacity = 1) +/** + * @param initial_capacity + * @param [&inout] allocator "The allocator to use, defaults to the heap allocator" + **/ +fn GrowableBitSet* GrowableBitSet.init_new(&self, usz initial_capacity = 1, Allocator* allocator = mem::heap()) @deprecated("Replaced by new_init") +{ + return self.new_init(initial_capacity, allocator) @inline; +} + +fn GrowableBitSet* GrowableBitSet.temp_init(&self, usz initial_capacity = 1) +{ + return self.new_init(initial_capacity, mem::temp()) @inline; +} + +fn GrowableBitSet* GrowableBitSet.init_temp(&self, usz initial_capacity = 1) @deprecated("Replaced by temp_init") { - return self.init_new(initial_capacity, mem::temp()) @inline; + return self.temp_init(initial_capacity); } fn void GrowableBitSet.free(&self) diff --git a/lib/std/collections/linkedlist.c3 b/lib/std/collections/linkedlist.c3 index 9a9ca90be..1748f67d2 100644 --- a/lib/std/collections/linkedlist.c3 +++ b/lib/std/collections/linkedlist.c3 @@ -32,15 +32,29 @@ fn void LinkedList.push_last(&self, Type value) * @param [&inout] allocator "The allocator to use, defaults to the heap allocator" * @return "the initialized list" **/ -fn LinkedList* LinkedList.init_new(&self, Allocator* allocator = mem::heap()) +fn LinkedList* LinkedList.new_init(&self, Allocator* allocator = mem::heap()) { *self = { .allocator = allocator }; return self; } -fn LinkedList* LinkedList.init_temp(&self) +/** + * @param [&inout] allocator "The allocator to use, defaults to the heap allocator" + * @return "the initialized list" + **/ +fn LinkedList* LinkedList.init_new(&self, Allocator* allocator = mem::heap()) @deprecated("Replaced by new_init") +{ + return self.new_init(allocator); +} + +fn LinkedList* LinkedList.temp_init(&self) +{ + return self.new_init(mem::temp()) @inline; +} + +fn LinkedList* LinkedList.init_temp(&self) @deprecated("Replaced by temp_init") { - return self.init_new(mem::temp()) @inline; + return self.temp_init() @inline; } /** diff --git a/lib/std/collections/list.c3 b/lib/std/collections/list.c3 index 3dc3bfc31..ac7761e8c 100644 --- a/lib/std/collections/list.c3 +++ b/lib/std/collections/list.c3 @@ -18,11 +18,12 @@ struct List (Printable) Type *entries; } + /** * @param initial_capacity "The initial capacity to reserve" * @param [&inout] allocator "The allocator to use, defaults to the heap allocator" **/ -fn List* List.init_new(&self, usz initial_capacity = 16, Allocator* allocator = mem::heap()) +fn List* List.new_init(&self, usz initial_capacity = 16, Allocator* allocator = mem::heap()) { self.allocator = allocator; self.size = 0; @@ -39,14 +40,33 @@ fn List* List.init_new(&self, usz initial_capacity = 16, Allocator* allocator = return self; } +/** + * @param initial_capacity "The initial capacity to reserve" + * @param [&inout] allocator "The allocator to use, defaults to the heap allocator" + **/ +fn List* List.init_new(&self, usz initial_capacity = 16, Allocator* allocator = mem::heap()) @deprecated("Replaced by new_init") +{ + return self.new_init(initial_capacity, allocator) @inline; +} + /** * Initialize the list using the temp allocator. * * @param initial_capacity "The initial capacity to reserve" **/ -fn List* List.init_temp(&self, usz initial_capacity = 16) +fn List* List.temp_init(&self, usz initial_capacity = 16) { - return self.init_new(initial_capacity, mem::temp()) @inline; + return self.new_init(initial_capacity, mem::temp()) @inline; +} + +/** + * Initialize the list using the temp allocator. + * + * @param initial_capacity "The initial capacity to reserve" + **/ +fn List* List.init_temp(&self, usz initial_capacity = 16) @deprecated("Replaced by temp_init") +{ + return self.temp_init(initial_capacity) @inline; } /** @@ -129,11 +149,8 @@ fn Type List.pop_first(&self) **/ fn void List.remove_at(&self, usz index) { - for (usz i = index + 1; i < self.size; i++) - { - self.entries[i - 1] = self.entries[i]; - } - self.size--; + if (!--self.size || index == self.size) return; + self.entries[index .. self.size - 1] = self.entries[index + 1 .. self.size]; } fn void List.add_all(&self, List* other_list) diff --git a/lib/std/collections/map.c3 b/lib/std/collections/map.c3 index 53930d7d6..5b0d877ec 100644 --- a/lib/std/collections/map.c3 +++ b/lib/std/collections/map.c3 @@ -23,28 +23,51 @@ struct HashMap * @param [&inout] allocator "The allocator to use" * @require capacity > 0 "The capacity must be 1 or higher" * @require load_factor > 0.0 "The load factor must be higher than 0" - * @require !map.allocator "Map was already initialized" + * @require !self.allocator "Map was already initialized" * @require capacity < MAXIMUM_CAPACITY "Capacity cannot exceed maximum" **/ -fn HashMap* HashMap.init_new(&map, uint capacity = DEFAULT_INITIAL_CAPACITY, float load_factor = DEFAULT_LOAD_FACTOR, Allocator* allocator = mem::heap()) +fn HashMap* HashMap.new_init(&self, uint capacity = DEFAULT_INITIAL_CAPACITY, float load_factor = DEFAULT_LOAD_FACTOR, Allocator* allocator = mem::heap()) { capacity = math::next_power_of_2(capacity); - map.allocator = allocator; - map.load_factor = load_factor; - map.threshold = (uint)(capacity * load_factor); - map.table = allocator.new_zero_array(Entry*, capacity); - return map; + self.allocator = allocator; + self.load_factor = load_factor; + self.threshold = (uint)(capacity * load_factor); + self.table = allocator.new_zero_array(Entry*, capacity); + return self; } /** + * @param [&inout] allocator "The allocator to use" * @require capacity > 0 "The capacity must be 1 or higher" * @require load_factor > 0.0 "The load factor must be higher than 0" * @require !map.allocator "Map was already initialized" * @require capacity < MAXIMUM_CAPACITY "Capacity cannot exceed maximum" **/ -fn HashMap* HashMap.init_temp(&map, uint capacity = DEFAULT_INITIAL_CAPACITY, float load_factor = DEFAULT_LOAD_FACTOR) +fn HashMap* HashMap.init_new(&map, uint capacity = DEFAULT_INITIAL_CAPACITY, float load_factor = DEFAULT_LOAD_FACTOR, Allocator* allocator = mem::heap()) @deprecated("Replaced by new_init") +{ + return map.new_init(capacity, load_factor, allocator); +} + +/** + * @require capacity > 0 "The capacity must be 1 or higher" + * @require load_factor > 0.0 "The load factor must be higher than 0" + * @require !self.allocator "Map was already initialized" + * @require capacity < MAXIMUM_CAPACITY "Capacity cannot exceed maximum" + **/ +fn HashMap* HashMap.temp_init(&self, uint capacity = DEFAULT_INITIAL_CAPACITY, float load_factor = DEFAULT_LOAD_FACTOR) { - return map.init_new(capacity, load_factor, mem::temp()); + return self.new_init(capacity, load_factor, mem::temp()) @inline; +} + +/** + * @require capacity > 0 "The capacity must be 1 or higher" + * @require load_factor > 0.0 "The load factor must be higher than 0" + * @require !map.allocator "Map was already initialized" + * @require capacity < MAXIMUM_CAPACITY "Capacity cannot exceed maximum" + **/ +fn HashMap* HashMap.init_temp(&map, uint capacity = DEFAULT_INITIAL_CAPACITY, float load_factor = DEFAULT_LOAD_FACTOR) @deprecated("Replaced by temp_init") +{ + return map.temp_init(capacity, load_factor) @inline; } /** @@ -62,21 +85,40 @@ fn bool HashMap.is_initialized(&map) * @param [&inout] allocator "The allocator to use" * @param [&in] other_map "The map to copy from." **/ -fn HashMap* HashMap.init_new_from_map(&self, HashMap* other_map, Allocator* allocator = mem::heap()) +fn HashMap* HashMap.new_init_from_map(&self, HashMap* other_map, Allocator* allocator = mem::heap()) { - self.init_new(other_map.table.len, other_map.load_factor, allocator); + self.new_init(other_map.table.len, other_map.load_factor, allocator); self.put_all_for_create(other_map); return self; } /** + * @param [&inout] allocator "The allocator to use" * @param [&in] other_map "The map to copy from." **/ -fn HashMap* HashMap.init_temp_from_map(&map, HashMap* other_map) +fn HashMap* HashMap.init_new_from_map(&self, HashMap* other_map, Allocator* allocator = mem::heap()) @deprecated("Replaced by new_init_from_map") + { - return map.init_new_from_map(other_map, mem::temp()) @inline; + return self.new_init_from_map(other_map, allocator) @inline; } +/** + * @param [&in] other_map "The map to copy from." + **/ +fn HashMap* HashMap.temp_init_from_map(&map, HashMap* other_map) +{ + return map.new_init_from_map(other_map, mem::temp()) @inline; +} + +/** + * @param [&in] other_map "The map to copy from." + **/ +fn HashMap* HashMap.init_temp_from_map(&map, HashMap* other_map) @deprecated("Replaced by temp_init_from_map") +{ + return map.temp_init_from_map(other_map) @inline; +} + + fn bool HashMap.is_empty(&map) @inline { return !map.count; @@ -146,7 +188,7 @@ fn bool HashMap.set(&map, Key key, Value value) @operator([]=) // If the map isn't initialized, use the defaults to initialize it. if (!map.allocator) { - map.init_new(); + map.new_init(); } uint hash = rehash(key.hash()); uint index = index_for(hash, map.table.len); diff --git a/lib/std/collections/object.c3 b/lib/std/collections/object.c3 index 597d210eb..350c2ae86 100644 --- a/lib/std/collections/object.c3 +++ b/lib/std/collections/object.c3 @@ -168,7 +168,7 @@ fn void Object.init_map_if_needed(&self) @private if (self.is_empty()) { self.type = ObjectInternalMap.typeid; - self.map.init_new(.allocator = self.allocator); + self.map.new_init(.allocator = self.allocator); } } @@ -180,7 +180,7 @@ fn void Object.init_array_if_needed(&self) @private if (self.is_empty()) { self.type = ObjectInternalList.typeid; - self.array.init_new(.allocator = self.allocator); + self.array.new_init(.allocator = self.allocator); } } diff --git a/lib/std/collections/priorityqueue.c3 b/lib/std/collections/priorityqueue.c3 index 40856a28b..90b68ca1c 100644 --- a/lib/std/collections/priorityqueue.c3 +++ b/lib/std/collections/priorityqueue.c3 @@ -36,14 +36,24 @@ struct PrivatePriorityQueue (Printable) Heap heap; } -fn void PrivatePriorityQueue.init_new(&self, usz initial_capacity = 16, Allocator* allocator = mem::heap()) @inline +fn void PrivatePriorityQueue.init_new(&self, usz initial_capacity = 16, Allocator* allocator = mem::heap()) @inline @deprecated("Replaced by new_init") { - self.heap.init_new(initial_capacity, allocator); + return self.new_init(initial_capacity, allocator); } -fn void PrivatePriorityQueue.init_temp(&self, usz initial_capacity = 16) @inline +fn void PrivatePriorityQueue.new_init(&self, usz initial_capacity = 16, Allocator* allocator = mem::heap()) @inline { - self.heap.init_new(initial_capacity, mem::temp()) @inline; + self.heap.new_init(initial_capacity, allocator); +} + +fn void PrivatePriorityQueue.temp_init(&self, usz initial_capacity = 16) @inline +{ + self.heap.new_init(initial_capacity, mem::temp()) @inline; +} + +fn void PrivatePriorityQueue.init_temp(&self, usz initial_capacity = 16) @inline @deprecated("Replaced by temp_init") +{ + return self.temp_init(initial_capacity) @inline; } fn void PrivatePriorityQueue.push(&self, Type element) diff --git a/lib/std/core/allocators/tracking_allocator.c3 b/lib/std/core/allocators/tracking_allocator.c3 index 7974c2cb4..c2dab3411 100644 --- a/lib/std/core/allocators/tracking_allocator.c3 +++ b/lib/std/core/allocators/tracking_allocator.c3 @@ -35,7 +35,7 @@ struct TrackingAllocator (Allocator) fn void TrackingAllocator.init(&self, Allocator* allocator) { *self = { .inner_allocator = allocator }; - self.map.init_new(.allocator = allocator); + self.map.new_init(.allocator = allocator); } /** diff --git a/lib/std/core/builtin.c3 b/lib/std/core/builtin.c3 index 2160a97a0..95c6e346c 100644 --- a/lib/std/core/builtin.c3 +++ b/lib/std/core/builtin.c3 @@ -130,7 +130,7 @@ fn void panicf(String fmt, String file, String function, uint line, args...) @stack_mem(512; Allocator* allocator) { DString s; - s.init_new(.allocator = allocator); + s.new_init(.allocator = allocator); s.appendf(fmt, ...args); panic(s.str_view(), file, function, line); }; diff --git a/lib/std/core/dstring.c3 b/lib/std/core/dstring.c3 index 45cbbb92b..757f27d21 100644 --- a/lib/std/core/dstring.c3 +++ b/lib/std/core/dstring.c3 @@ -8,7 +8,7 @@ const usz MIN_CAPACITY @private = 16; /** * @require !self.data() "String already initialized" **/ -fn DString DString.init_new(&self, usz capacity = MIN_CAPACITY, Allocator* allocator = mem::heap()) +fn DString DString.new_init(&self, usz capacity = MIN_CAPACITY, Allocator* allocator = mem::heap()) { if (capacity < MIN_CAPACITY) capacity = MIN_CAPACITY; StringData* data = allocator.new(StringData, .end_padding = capacity); @@ -21,15 +21,31 @@ fn DString DString.init_new(&self, usz capacity = MIN_CAPACITY, Allocator* alloc /** * @require !self.data() "String already initialized" **/ -fn DString DString.init_temp(&self, usz capacity = MIN_CAPACITY) +fn DString DString.init_new(&self, usz capacity = MIN_CAPACITY, Allocator* allocator = mem::heap()) @deprecated("Replaced by new_init") { - self.init_new(capacity, mem::temp()) @inline; + return self.new_init(capacity, allocator) @inline; +} + +/** + * @require !self.data() "String already initialized" + **/ +fn DString DString.temp_init(&self, usz capacity = MIN_CAPACITY) +{ + self.new_init(capacity, mem::temp()) @inline; return *self; } +/** + * @require !self.data() "String already initialized" + **/ +fn DString DString.init_temp(&self, usz capacity = MIN_CAPACITY) @deprecated("Replaced by temp_init") +{ + return self.temp_init(capacity) @inline; +} + fn DString new_with_capacity(usz capacity, Allocator* allocator = mem::heap()) { - return DString{}.init_new(capacity, allocator); + return DString{}.new_init(capacity, allocator); } fn DString temp_with_capacity(usz capacity) => new_with_capacity(capacity, mem::temp()) @inline; @@ -51,13 +67,15 @@ fn DString temp_new(String s = "") => new(s, mem::temp()) @inline; fn DString DString.new_concat(self, DString b, Allocator* allocator = mem::heap()) { DString string; - string.init_new(self.len() + b.len(), allocator); + string.new_init(self.len() + b.len(), allocator); string.append(self); string.append(b); return string; } -fn DString DString.new_tconcat(self, DString b) => self.new_concat(b, mem::temp()); +fn DString DString.temp_concat(self, DString b) => self.new_concat(b, mem::temp()); + +fn DString DString.new_tconcat(self, DString b) @deprecated("Replaced by temp_concat") => self.new_concat(b, mem::temp()); fn ZString DString.zstr_view(&self) { diff --git a/lib/std/io/os/ls.c3 b/lib/std/io/os/ls.c3 index e6b15e96d..dee284100 100644 --- a/lib/std/io/os/ls.c3 +++ b/lib/std/io/os/ls.c3 @@ -3,7 +3,7 @@ module std::io::file::os @if(env::POSIX); fn PathList! native_ls(Path dir, bool no_dirs, bool no_symlinks, String mask, Allocator* allocator) { PathList list; - list.init_new(.allocator = allocator); + list.new_init(.allocator = allocator); DIRPtr directory = posix::opendir(dir.str_view() ? dir.as_zstr() : (ZString)"."); defer if (directory) posix::closedir(directory); if (!directory) return (path::is_dir(dir) ? IoError.CANNOT_READ_DIR : IoError.FILE_NOT_DIR)?; @@ -25,7 +25,7 @@ module std::io::os @if(env::WIN32); fn PathList! native_ls(Path dir, bool no_dirs, bool no_symlinks, String mask, Allocator* allocator) { PathList list; - list.init_new(.allocator = allocator); + list.new_init(.allocator = allocator); @pool(allocator) { diff --git a/lib/std/io/stream/bytebuffer.c3 b/lib/std/io/stream/bytebuffer.c3 index 0338483f9..ba8782cb0 100644 --- a/lib/std/io/stream/bytebuffer.c3 +++ b/lib/std/io/stream/bytebuffer.c3 @@ -16,7 +16,17 @@ struct ByteBuffer (InStream, OutStream) * max_read defines how many bytes might be kept before its internal buffer is shrinked. * @require self.bytes.len == 0 "Buffer already initialized." **/ -fn ByteBuffer*! ByteBuffer.init_new(&self, usz max_read, usz initial_capacity = 16, Allocator* allocator = mem::heap()) +fn ByteBuffer*! ByteBuffer.init_new(&self, usz max_read, usz initial_capacity = 16, Allocator* allocator = mem::heap()) @deprecated("Replaced by new_init") +{ + return self.new_init(max_read, initial_capacity, allocator) @inline; +} + +/** + * ByteBuffer provides a streamable read/write buffer. + * max_read defines how many bytes might be kept before its internal buffer is shrinked. + * @require self.bytes.len == 0 "Buffer already initialized." + **/ +fn ByteBuffer*! ByteBuffer.new_init(&self, usz max_read, usz initial_capacity = 16, Allocator* allocator = mem::heap()) { *self = { .allocator = allocator, .max_read = max_read }; initial_capacity = max(initial_capacity, 16); @@ -24,9 +34,14 @@ fn ByteBuffer*! ByteBuffer.init_new(&self, usz max_read, usz initial_capacity = return self; } -fn ByteBuffer*! ByteBuffer.init_temp(&self, usz max_read, usz initial_capacity = 16) +fn ByteBuffer*! ByteBuffer.init_temp(&self, usz max_read, usz initial_capacity = 16) @deprecated("Replaced by temp_init") +{ + return self.temp_init(max_read, initial_capacity) @inline; +} + +fn ByteBuffer*! ByteBuffer.temp_init(&self, usz max_read, usz initial_capacity = 16) { - return self.init_new(max_read, initial_capacity, mem::temp()); + return self.new_init(max_read, initial_capacity, mem::temp()); } /** diff --git a/lib/std/io/stream/bytewriter.c3 b/lib/std/io/stream/bytewriter.c3 index d1cd56930..2edea51e1 100644 --- a/lib/std/io/stream/bytewriter.c3 +++ b/lib/std/io/stream/bytewriter.c3 @@ -13,20 +13,41 @@ struct ByteWriter (OutStream) * @require self.bytes.len == 0 "Init may not run on on already initialized data" * @ensure (bool)allocator, self.index == 0 **/ -fn ByteWriter* ByteWriter.init_new(&self, Allocator* allocator = mem::heap()) +fn ByteWriter* ByteWriter.new_init(&self, Allocator* allocator = mem::heap()) { *self = { .bytes = {}, .allocator = allocator }; return self; } +/** + * @param [&inout] self + * @param [&inout] allocator + * @require self.bytes.len == 0 "Init may not run on on already initialized data" + * @ensure (bool)allocator, self.index == 0 + **/ +fn ByteWriter* ByteWriter.init_new(&self, Allocator* allocator = mem::heap()) @deprecated("Replaced by new_init") +{ + return self.new_init(allocator) @inline; +} + +/** + * @param [&inout] self + * @require self.bytes.len == 0 "Init may not run on on already initialized data" + * @ensure self.index == 0 + **/ +fn ByteWriter* ByteWriter.temp_init(&self) +{ + return self.new_init(mem::temp()) @inline; +} + /** * @param [&inout] self * @require self.bytes.len == 0 "Init may not run on on already initialized data" * @ensure self.index == 0 **/ -fn ByteWriter* ByteWriter.init_temp(&self) +fn ByteWriter* ByteWriter.init_temp(&self) @deprecated("Replaced by temp_init") { - return self.init_new(mem::temp()); + return self.temp_init() @inline; } fn ByteWriter* ByteWriter.init_with_buffer(&self, char[] data) diff --git a/lib/std/math/random/math.seeder.c3 b/lib/std/math/random/math.seeder.c3 index e2e527dfb..e5fbd33cb 100644 --- a/lib/std/math/random/math.seeder.c3 +++ b/lib/std/math/random/math.seeder.c3 @@ -85,7 +85,7 @@ fn char[8 * 4] entropy() hash(&entropy), random_int, hash(clock::now()), - hash(&DString.init_new), + hash(&DString.new_init), hash(mem::heap()) }; return bitcast(entropy_data, char[8 * 4]); diff --git a/lib/std/os/linux/linux.c3 b/lib/std/os/linux/linux.c3 index ae4d59a4c..59f47829e 100644 --- a/lib/std/os/linux/linux.c3 +++ b/lib/std/os/linux/linux.c3 @@ -203,7 +203,7 @@ fn Backtrace! backtrace_load_element(void* addr, Allocator* allocator = mem::hea fn BacktraceList! symbolize_backtrace(void*[] backtrace, Allocator* allocator) { BacktraceList list; - list.init_new(backtrace.len, allocator); + list.new_init(backtrace.len, allocator); defer catch { foreach (trace : list) diff --git a/lib/std/os/macos/darwin.c3 b/lib/std/os/macos/darwin.c3 index 78bd271bb..8c836021b 100644 --- a/lib/std/os/macos/darwin.c3 +++ b/lib/std/os/macos/darwin.c3 @@ -136,7 +136,7 @@ fn BacktraceList! symbolize_backtrace(void*[] backtrace, Allocator* allocator) { void *load_addr = (void *)load_address()!; BacktraceList list; - list.init_new(backtrace.len, allocator); + list.new_init(backtrace.len, allocator); defer catch { foreach (trace : list) diff --git a/lib/std/os/win32/process.c3 b/lib/std/os/win32/process.c3 index 60fff82b4..1f76fcc0f 100644 --- a/lib/std/os/win32/process.c3 +++ b/lib/std/os/win32/process.c3 @@ -152,7 +152,7 @@ Win32_DWORD64 displacement; fn BacktraceList! symbolize_backtrace(void*[] backtrace, Allocator* allocator) { BacktraceList list; - list.init_new(backtrace.len, allocator); + list.new_init(backtrace.len, allocator); Win32_HANDLE process = getCurrentProcess(); symInitialize(process, null, 1); defer symCleanup(process); diff --git a/lib/std/threads/os/thread_posix.c3 b/lib/std/threads/os/thread_posix.c3 index 6655ff334..f91ff891e 100644 --- a/lib/std/threads/os/thread_posix.c3 +++ b/lib/std/threads/os/thread_posix.c3 @@ -151,6 +151,7 @@ fn void* callback(void* arg) @private fn void! NativeThread.create(&thread, ThreadFn thread_fn, void* arg) { + PosixThreadData *thread_data = mem::new(PosixThreadData); *thread_data = { .thread_fn = thread_fn, .arg = arg }; if (posix::pthread_create(thread, null, &callback, thread_data) != 0) diff --git a/releasenotes.md b/releasenotes.md index 781f5f2e4..beec95150 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -1,5 +1,23 @@ # C3C Release Notes +## 0.5.3 Change list + +### Changes / improvements +- Migrate from using actual type with GEP, use i8 or i8 array instead. +- Optimize foreach for single element arrays. +- Move all calls to panic due to checks to the end of the function. + +### Fixes +- Single module command line option was not respected. +- Fixed issue with compile time defined types (String in this case), which would crash the compiler in certain cases. +- Projects now correctly respect optimization directives. +- Generic modules now correctly follow the implicit import rules of regular modules. +- Passing an untyped list to a macro and then using it as a vaarg would crash the compiler. +- Extern const globals now work correctly. + +### Stdlib changes +- init_new/init_temp deprecated, replaced by new_init and temp_init. + ## 0.5.2 Change list ### Changes / improvements diff --git a/resources/grammar/grammar.y b/resources/grammar/grammar.y index b8119f2e0..91da72dee 100644 --- a/resources/grammar/grammar.y +++ b/resources/grammar/grammar.y @@ -1108,6 +1108,7 @@ func_definition const_declaration : CONST CONST_IDENT opt_attributes '=' expr ';' | CONST type CONST_IDENT opt_attributes '=' expr ';' + | CONST type CONST_IDENT opt_attributes ';' ; func_typedef diff --git a/src/build/builder.c b/src/build/builder.c index 2d23a1b90..ebb6a79ea 100644 --- a/src/build/builder.c +++ b/src/build/builder.c @@ -234,6 +234,10 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions * { target->optsize = options->optsize; } + if (options->single_module != SINGLE_MODULE_NOT_SET) + { + target->single_module = options->single_module; + } if (options->safety_level != SAFETY_NOT_SET) { target->feature.safe_mode = options->safety_level; @@ -378,6 +382,10 @@ static void update_build_target_from_options(BuildTarget *target, BuildOptions * { target->optsetting = options->optsetting; } + else + { + if (target->optsetting == OPT_SETTING_NOT_SET) target->optsetting = OPT_SETTING_O0; + } update_build_target_with_opt_level(target, target->optsetting); } diff --git a/src/build/project.c b/src/build/project.c index 35ca6467f..508d8d740 100644 --- a/src/build/project.c +++ b/src/build/project.c @@ -365,7 +365,7 @@ static void load_into_build_target(JSONObject *json, const char *type, BuildTarg [OPT_SETTING_OTINY] = "Oz" }; OptimizationSetting opt = (OptimizationSetting)get_valid_string_setting(json, "opt", type, opt_settings, 0, ELEMENTLEN(opt_settings), "'O0', 'O1' etc."); - update_build_target_with_opt_level(target, opt); + if (opt != OPTIMIZATION_NOT_SET) target->optsetting = opt; // Safety level target->feature.safe_mode = (SafetyLevel)get_valid_bool(json, "safe", type, target->feature.safe_mode); @@ -527,6 +527,7 @@ static void project_add_target(Project *project, BuildTarget *default_target, J } type = str_printf("%s %s", type, target->name); load_into_build_target(json, type, target, false); + update_build_target_with_opt_level(target, target->optsetting); } static void project_add_targets(Project *project, JSONObject *project_data) diff --git a/src/compiler/ast.c b/src/compiler/ast.c index 1348215b1..075dd33da 100644 --- a/src/compiler/ast.c +++ b/src/compiler/ast.c @@ -35,6 +35,7 @@ Decl *decl_new(DeclKind decl_kind, const char *name, SourceSpan span) return decl; } + // Check if local or parameter $foo/$Foo bool decl_is_ct_var(Decl *decl) { @@ -169,16 +170,16 @@ void decl_set_external_name(Decl *decl) if (!name) name = "$anon"; // "extern" or the module has no prefix? - if (decl->is_extern || decl->unit->module->no_extprefix) + if (decl->is_extern || decl_module(decl)->no_extprefix) { - assert(decl->name || decl->unit->module->no_extprefix); + assert(decl->name || decl_module(decl)->no_extprefix); decl->extname = name; return; } // Otherwise, first put the module name into the scratch buffer scratch_buffer_clear(); - Module *module = decl->unit->module; + Module *module = decl_module(decl); const char *module_name = module->extname ? module->extname : module->name->module; char c; while ((c = *(module_name++)) != 0) diff --git a/src/compiler/compiler_internal.h b/src/compiler/compiler_internal.h index 4fc40af1b..8e0a6a48c 100644 --- a/src/compiler/compiler_internal.h +++ b/src/compiler/compiler_internal.h @@ -2179,6 +2179,7 @@ static inline Decl *decl_raw(Decl *decl); static inline DeclKind decl_from_token(TokenType type); static inline bool decl_is_var_local(Decl *decl); bool decl_is_ct_var(Decl *decl); +INLINE Module* decl_module(Decl *decl); Decl *decl_find_enum_constant(Decl *decl, const char *name); bool decl_needs_prefix(Decl *decl); AlignSize decl_find_member_offset(Decl *decl, Decl *member); @@ -3507,6 +3508,11 @@ INLINE bool decl_var_kind_is_ct(VarDeclKind kind) return kind >= VARDECL_FIRST_CT && kind <= VARDECL_LAST_CT; } +INLINE Module *decl_module(Decl *decl) +{ + return decl->unit ? decl->unit->module : global_context.core_module; +} + static inline bool decl_is_var_local(Decl *decl) { if (decl->decl_kind != DECL_VAR) return false; diff --git a/src/compiler/context.c b/src/compiler/context.c index 4529ade3c..ee08794fa 100644 --- a/src/compiler/context.c +++ b/src/compiler/context.c @@ -110,7 +110,7 @@ bool context_set_module(ParseContext *context, Path *path, const char **generic_ void unit_register_external_symbol(CompilationUnit *unit, Decl *decl) { - if (!decl->unit || decl->unit->module == unit->module || !decl->extname) return; + if (decl_module(decl) == unit->module || !decl->extname) return; decl->is_external_visible = true; } diff --git a/src/compiler/expr.c b/src/compiler/expr.c index 9de14e966..97b59aa1c 100644 --- a/src/compiler/expr.c +++ b/src/compiler/expr.c @@ -217,15 +217,15 @@ bool expr_is_constant_eval(Expr *expr, ConstantEvalKind eval_kind) case EXPR_RETHROW: return false; case EXPR_IDENTIFIER: - if (expr->identifier_expr.decl->decl_kind != DECL_VAR) return true; - if (expr->identifier_expr.decl->var.kind == VARDECL_CONST) - { - expr = expr->identifier_expr.decl->var.init_expr; - goto RETRY; - } - switch (expr->identifier_expr.decl->var.kind) + { + Decl *ident = expr->identifier_expr.decl; + if (ident->decl_kind != DECL_VAR) return true; + switch (ident->var.kind) { case VARDECL_CONST: + if (ident->is_extern) return false; + expr = ident->var.init_expr; + goto RETRY; case VARDECL_PARAM_CT_TYPE: case VARDECL_LOCAL_CT_TYPE: case VARDECL_LOCAL_CT: @@ -234,6 +234,7 @@ bool expr_is_constant_eval(Expr *expr, ConstantEvalKind eval_kind) default: return false; } + } case EXPR_EXPRESSION_LIST: return expr_list_is_constant_eval(expr->expression_list, eval_kind); case EXPR_TYPEID_INFO: diff --git a/src/compiler/llvm_codegen.c b/src/compiler/llvm_codegen.c index c9b50f21b..271fe8551 100644 --- a/src/compiler/llvm_codegen.c +++ b/src/compiler/llvm_codegen.c @@ -98,8 +98,7 @@ LLVMBuilderRef llvm_create_builder(GenContext *c) LLVMValueRef llvm_emit_is_no_opt(GenContext *c, LLVMValueRef error_value) { LLVMValueRef compare = LLVMBuildICmp(c->builder, LLVMIntEQ, error_value, llvm_get_zero(c, type_anyfault), "not_err"); - LLVMValueRef values[2] = { compare, LLVMConstInt(c->bool_type, 1, false) }; - return llvm_emit_call_intrinsic(c, intrinsic_id.expect, &c->bool_type, 1, values, 2); + return llvm_emit_expect_raw(c, compare); } LLVMValueRef llvm_emit_memclear_size_align(GenContext *c, LLVMValueRef ptr, uint64_t size, AlignSize align) @@ -934,7 +933,7 @@ void llvm_add_global_decl(GenContext *c, Decl *decl) { assert(decl->var.kind == VARDECL_GLOBAL || decl->var.kind == VARDECL_CONST); - bool same_module = decl->unit->module == c->code_module; + bool same_module = decl_module(decl) == c->code_module; const char *name = same_module ? "temp_global" : decl_get_extname(decl); decl->backend_ref = llvm_add_global(c, name, decl->type, decl->alignment); llvm_set_alignment(decl->backend_ref, decl->alignment); @@ -1053,7 +1052,7 @@ void llvm_append_function_attributes(GenContext *c, Decl *decl) } if (decl->is_export && arch_is_wasm(platform_target.arch)) { - if (c->code_module == decl->unit->module) + if (c->code_module == decl_module(decl)) { llvm_attribute_add_string(c, function, "wasm-export-name", decl_get_extname(decl), -1); } @@ -1113,7 +1112,7 @@ LLVMValueRef llvm_get_ref(GenContext *c, Decl *decl) } if (decl_is_local(decl)) { - assert(decl->unit->module == c->code_module); + assert(decl_module(decl) == c->code_module); llvm_set_internal_linkage(backend_ref); } return backend_ref; diff --git a/src/compiler/llvm_codegen_expr.c b/src/compiler/llvm_codegen_expr.c index d3308f519..82b79c95f 100644 --- a/src/compiler/llvm_codegen_expr.c +++ b/src/compiler/llvm_codegen_expr.c @@ -72,6 +72,22 @@ LLVMValueRef llvm_emit_exprid_to_rvalue(GenContext *c, ExprId expr_id) return value.value; } +void llvm_emit_assume_raw(GenContext *c, LLVMValueRef assume_true) +{ + llvm_emit_call_intrinsic(c, intrinsic_id.assume, NULL, 0, &assume_true, 1); +} + +LLVMValueRef llvm_emit_expect_false_raw(GenContext *c, LLVMValueRef expect_false) +{ + LLVMValueRef values[2] = { expect_false, LLVMConstNull(c->bool_type) }; + return llvm_emit_call_intrinsic(c, intrinsic_id.expect, &c->bool_type, 1, values, 2); +} + +LLVMValueRef llvm_emit_expect_raw(GenContext *c, LLVMValueRef expect_true) +{ + LLVMValueRef values[2] = { expect_true, LLVMConstInt(c->bool_type, 1, false) }; + return llvm_emit_call_intrinsic(c, intrinsic_id.expect, &c->bool_type, 1, values, 2); +} BEValue llvm_emit_assign_expr(GenContext *c, BEValue *ref, Expr *expr, LLVMValueRef optional) { assert(ref->kind == BE_ADDRESS || ref->kind == BE_ADDRESS_OPTIONAL); @@ -367,11 +383,11 @@ LLVMTypeRef llvm_coerce_expand_hi_offset(GenContext *c, LLVMValueRef *addr, ABIA if (info->coerce_expand.packed) { *align = type_min_alignment(*align, *align + info->coerce_expand.offset_hi); - llvm_emit_pointer_inbounds_gep_raw_index(c, c->byte_type, *addr, info->coerce_expand.offset_hi); + llvm_emit_const_ptradd_inbounds_raw(c, *addr, info->coerce_expand.offset_hi); return type2; } *align = type_min_alignment(*align, *align + llvm_store_size(c, type2) * info->coerce_expand.offset_hi); - llvm_emit_pointer_inbounds_gep_raw_index(c, type2, *addr, info->coerce_expand.offset_hi); + llvm_emit_const_ptradd_inbounds_raw(c, *addr, type_size(info->coerce_expand.hi) * info->coerce_expand.offset_hi); return type2; } /** @@ -576,13 +592,13 @@ static void llvm_emit_array_bounds_check(GenContext *c, BEValue *index, LLVMValu if (type_is_signed(index->type)) { llvm_emit_int_comp_raw(c, &result, index->type, index->type, index->value, - llvm_get_zero(c, index->type), BINARYOP_LT); + llvm_get_zero(c, index->type), BINARYOP_LT); llvm_emit_panic_if_true(c, &result, "Negative array indexing", loc, "Negative array indexing (index was %d)", index, NULL); } llvm_emit_int_comp_raw(c, &result, index->type, index->type, - index->value, array_max_index, - BINARYOP_GE); + index->value, array_max_index, + BINARYOP_GE); BEValue max; llvm_value_set(&max, array_max_index, index->type); llvm_emit_panic_if_true(c, &result, "Array index out of bounds", loc, "Array index out of bounds (array had size %d, index was %d)", &max, index); @@ -4117,18 +4133,7 @@ void llvm_emit_binary(GenContext *c, BEValue *be_value, Expr *expr, BEValue *lhs { val = LLVMBuildSub(c->builder, LLVMBuildPtrToInt(c->builder, lhs_value, int_vec_type, ""), LLVMBuildPtrToInt(c->builder, rhs_value, int_vec_type, ""), ""); - LLVMValueRef slots[256]; - LLVMValueRef *ptr = slots; - if (len > 256) - { - ptr = MALLOC(len * sizeof(LLVMValueRef)); - } - AlignSize diff = type_abi_alignment(element_type); - for (ArraySize i = 0; i < len; i++) - { - ptr[i] = llvm_const_int(c, type_isz, diff); - } - LLVMValueRef divisor = LLVMConstVector(ptr, len); + LLVMValueRef divisor = llvm_emit_const_vector(llvm_const_int(c, type_isz, type_abi_alignment(element_type)), len); val = LLVMBuildExactSDiv(c->builder, val, divisor, ""); break; } @@ -4964,32 +4969,29 @@ void llvm_emit_struct_member_ref(GenContext *c, BEValue *struct_ref, BEValue *me llvm_value_set_address(member_ref, ptr, struct_ref->type->decl->strukt.members[member_id]->type, align); } -LLVMValueRef llvm_emit_struct_gep_raw(GenContext *context, LLVMValueRef ptr, LLVMTypeRef struct_type, unsigned index, - unsigned struct_alignment, AlignSize *alignment) +LLVMValueRef llvm_emit_struct_gep_raw(GenContext *c, LLVMValueRef ptr, LLVMTypeRef struct_type, unsigned index, + unsigned struct_alignment, AlignSize *alignment) { - *alignment = type_min_alignment((AlignSize)LLVMOffsetOfElement(context->target_data, struct_type, index), struct_alignment); - if (llvm_is_const(ptr)) - { - LLVMValueRef idx[2] = { llvm_get_zero(context, type_int), llvm_const_int(context, type_int, index) }; - return LLVMBuildInBoundsGEP2(context->builder, struct_type, ptr, idx, 2, ""); - } - return LLVMBuildStructGEP2(context->builder, struct_type, ptr, index, ""); + *alignment = type_min_alignment((AlignSize)LLVMOffsetOfElement(c->target_data, struct_type, index), struct_alignment); + if (!index) return ptr; + ByteSize offset = LLVMOffsetOfElement(c->target_data, struct_type, index); + return llvm_emit_const_ptradd_inbounds_raw(c, ptr, offset); } LLVMValueRef llvm_emit_array_gep_raw_index(GenContext *c, LLVMValueRef ptr, LLVMTypeRef array_type, BEValue *index, AlignSize array_alignment, AlignSize *alignment) { LLVMValueRef index_val = llvm_load_value(c, index); + LLVMTypeRef element_type = LLVMGetElementType(array_type); Type *index_type = index->type; assert(type_is_integer(index_type)); + LLVMTypeRef idx_type = llvm_get_type(c, index_type); if (type_is_unsigned(index_type) && type_size(index_type) < type_size(type_usz)) { - index_type = type_usz->canonical; - index_val = llvm_zext_trunc(c, index_val, llvm_get_type(c, index_type)); + index_val = llvm_zext_trunc(c, index_val, idx_type); } - *alignment = type_min_alignment(llvm_store_size(c, LLVMGetElementType(array_type)), array_alignment); - LLVMValueRef idx[2] = { llvm_get_zero(c, index_type), index_val }; - return LLVMBuildInBoundsGEP2(c->builder, array_type, ptr, idx, 2, ""); + *alignment = type_min_alignment(llvm_store_size(c, element_type), array_alignment); + return llvm_emit_pointer_inbounds_gep_raw(c, element_type, ptr, index_val); } LLVMValueRef llvm_emit_array_gep_raw(GenContext *c, LLVMValueRef ptr, LLVMTypeRef array_type, unsigned index, AlignSize array_alignment, AlignSize *alignment) @@ -4999,20 +5001,80 @@ LLVMValueRef llvm_emit_array_gep_raw(GenContext *c, LLVMValueRef ptr, LLVMTypeRe return llvm_emit_array_gep_raw_index(c, ptr, array_type, &index_value, array_alignment, alignment); } +LLVMValueRef llvm_emit_ptradd_raw(GenContext *c, LLVMValueRef ptr, LLVMValueRef offset, ByteSize mult) +{ + if (LLVMIsConstant(offset) && LLVMIsNull(offset)) + { + return ptr; + } + if (mult == 1) return LLVMBuildGEP2(c->builder, c->byte_type, ptr, &offset, 1, "ptradd_any"); + return LLVMBuildGEP2(c->builder, LLVMArrayType(c->byte_type, mult), ptr, &offset, 1, "ptroffset_any"); +} + +LLVMValueRef llvm_emit_ptradd_inbounds_raw(GenContext *c, LLVMValueRef ptr, LLVMValueRef offset, ByteSize mult) +{ + if (LLVMIsConstant(offset) && LLVMIsNull(offset)) + { + return ptr; + } + if (mult == 1) return LLVMBuildInBoundsGEP2(c->builder, c->byte_type, ptr, &offset, 1, "ptradd"); + return LLVMBuildInBoundsGEP2(c->builder, LLVMArrayType(c->byte_type, mult), ptr, &offset, 1, "ptroffset"); +} + +LLVMValueRef llvm_emit_const_vector(LLVMValueRef value, ArraySize len) +{ + LLVMValueRef slots[256]; + LLVMValueRef *ptr = slots; + if (len > 256) + { + ptr = MALLOC(len * sizeof(LLVMValueRef)); + } + for (ArraySize i = 0; i < len; i++) + { + ptr[i] = value; + } + return LLVMConstVector(ptr, len); +} + + +LLVMValueRef llvm_ptr_mult(GenContext *c, LLVMValueRef offset, LLVMTypeRef pointee_type) +{ + ByteSize size = llvm_store_size(c, pointee_type); + if (size == 1) return offset; + + LLVMTypeRef offset_type = LLVMTypeOf(offset); + LLVMValueRef mult; + if (LLVMGetTypeKind(offset_type) == LLVMVectorTypeKind) + { + mult = llvm_emit_const_vector(LLVMConstInt(LLVMGetElementType(offset_type), size, false), LLVMGetVectorSize(offset_type)); + } + else + { + mult = LLVMConstInt(offset_type, size, false); + } + return LLVMBuildMul(c->builder, offset, mult, ""); +} LLVMValueRef llvm_emit_pointer_gep_raw(GenContext *c, LLVMTypeRef pointee_type, LLVMValueRef ptr, LLVMValueRef offset) { - return LLVMBuildGEP2(c->builder, pointee_type, ptr, &offset, 1, "ptroffset"); + if (LLVMIsConstant(offset)) + { + return llvm_emit_ptradd_raw(c, ptr, llvm_ptr_mult(c, offset, pointee_type), 1); + } + return llvm_emit_ptradd_raw(c, ptr, offset, llvm_store_size(c, pointee_type)); } LLVMValueRef llvm_emit_pointer_inbounds_gep_raw(GenContext *c, LLVMTypeRef pointee_type, LLVMValueRef ptr, LLVMValueRef offset) { - return LLVMBuildInBoundsGEP2(c->builder, pointee_type, ptr, &offset, 1, "ptroffset"); + if (LLVMIsConstant(offset)) + { + return llvm_emit_ptradd_inbounds_raw(c, ptr, llvm_ptr_mult(c, offset, pointee_type), 1); + } + return llvm_emit_ptradd_inbounds_raw(c, ptr, offset, llvm_store_size(c, pointee_type)); } -LLVMValueRef llvm_emit_pointer_inbounds_gep_raw_index(GenContext *c, LLVMTypeRef pointee_type, LLVMValueRef ptr, ByteSize offset) +LLVMValueRef llvm_emit_const_ptradd_inbounds_raw(GenContext *c, LLVMValueRef ptr, ByteSize offset) { - LLVMValueRef offset_val = LLVMConstInt(c->size_type, offset, false); - return LLVMBuildInBoundsGEP2(c->builder, pointee_type, ptr, &offset_val, 1, "ptroffset"); + return llvm_emit_ptradd_inbounds_raw(c, ptr, LLVMConstInt(c->size_type, offset, false), 1); } void llvm_emit_subarray_len(GenContext *c, BEValue *subarray, BEValue *len) diff --git a/src/compiler/llvm_codegen_function.c b/src/compiler/llvm_codegen_function.c index f98c4e8a3..b1c453422 100644 --- a/src/compiler/llvm_codegen_function.c +++ b/src/compiler/llvm_codegen_function.c @@ -441,6 +441,7 @@ void llvm_emit_body(GenContext *c, LLVMValueRef function, FunctionPrototype *pro c->debug.function = LLVMGetSubprogram(function); } + c->panic_blocks = NULL; c->cur_func.name = decl->name; c->cur_func.prototype = prototype; LLVMBasicBlockRef entry = LLVMAppendBasicBlockInContext(c->context, c->function, "entry"); @@ -510,6 +511,16 @@ void llvm_emit_body(GenContext *c, LLVMValueRef function, FunctionPrototype *pro llvm_emit_return_implicit(c); } + LLVMBasicBlockRef last_block = LLVMGetLastBasicBlock(c->function); + + // Move panic blocks last, this is just overall nicer to read, and might be better from + // a performance POV + FOREACH_BEGIN(LLVMBasicBlockRef panic_block, c->panic_blocks) + if (last_block == panic_block) continue; + LLVMMoveBasicBlockAfter(panic_block, last_block); + last_block = panic_block; + FOREACH_END(); + // erase alloca point if (LLVMGetInstructionParent(alloca_point)) { diff --git a/src/compiler/llvm_codegen_internal.h b/src/compiler/llvm_codegen_internal.h index 3307c92b2..3a652532c 100644 --- a/src/compiler/llvm_codegen_internal.h +++ b/src/compiler/llvm_codegen_internal.h @@ -83,6 +83,7 @@ typedef struct GenContext_ LLVMBuilderRef builder; LLVMBasicBlockRef current_block; LLVMBasicBlockRef catch_block; + LLVMBasicBlockRef *panic_blocks; LLVMValueRef *constructors; LLVMValueRef *destructors; ReusableConstant *reusable_constants; @@ -425,13 +426,16 @@ TypeSize llvm_alloc_size(GenContext *c, LLVMTypeRef type); /// -- Aggregates -- INLINE LLVMValueRef llvm_emit_insert_value(GenContext *c, LLVMValueRef agg, LLVMValueRef new_value, ArraySize index); LLVMValueRef llvm_emit_aggregate_two(GenContext *c, Type *type, LLVMValueRef value1, LLVMValueRef value2); -LLVMValueRef llvm_emit_struct_gep_raw(GenContext *context, LLVMValueRef ptr, LLVMTypeRef struct_type, unsigned index, - unsigned struct_alignment, AlignSize *alignment); +LLVMValueRef llvm_emit_const_vector(LLVMValueRef value, ArraySize len); +LLVMValueRef llvm_emit_struct_gep_raw(GenContext *c, LLVMValueRef ptr, LLVMTypeRef struct_type, unsigned index, + unsigned struct_alignment, AlignSize *alignment); LLVMValueRef llvm_emit_array_gep_raw(GenContext *c, LLVMValueRef ptr, LLVMTypeRef array_type, unsigned index, AlignSize array_alignment, AlignSize *alignment); LLVMValueRef llvm_emit_array_gep_raw_index(GenContext *c, LLVMValueRef ptr, LLVMTypeRef array_type, BEValue *index, AlignSize array_alignment, AlignSize *alignment); LLVMValueRef llvm_emit_pointer_gep_raw(GenContext *c, LLVMTypeRef pointee_type, LLVMValueRef ptr, LLVMValueRef offset); +LLVMValueRef llvm_emit_ptradd_raw(GenContext *c, LLVMValueRef ptr, LLVMValueRef offset, ByteSize mult); +LLVMValueRef llvm_emit_ptradd_inbounds_raw(GenContext *c, LLVMValueRef ptr, LLVMValueRef offset, ByteSize mult); +LLVMValueRef llvm_emit_const_ptradd_inbounds_raw(GenContext *c, LLVMValueRef ptr, ByteSize offset); LLVMValueRef llvm_emit_pointer_inbounds_gep_raw(GenContext *c, LLVMTypeRef pointee_type, LLVMValueRef ptr, LLVMValueRef offset); -LLVMValueRef llvm_emit_pointer_inbounds_gep_raw_index(GenContext *c, LLVMTypeRef pointee_type, LLVMValueRef ptr, ByteSize offset); LLVMTypeRef llvm_coerce_expand_hi_offset(GenContext *c, LLVMValueRef *addr, ABIArgInfo *info, AlignSize *align); void llvm_emit_ptr_from_array(GenContext *c, BEValue *value); void llvm_emit_struct_member_ref(GenContext *c, BEValue *struct_ref, BEValue *member_ref, unsigned member_id); @@ -482,7 +486,9 @@ void llvm_emit_panic_if_true(GenContext *c, BEValue *value, const char *panic_na BEValue *value_2); void llvm_emit_panic(GenContext *c, const char *message, SourceSpan loc, const char *fmt, BEValue *args); void llvm_emit_unreachable(GenContext *c); - +void llvm_emit_assume_raw(GenContext *c, LLVMValueRef assume_true); +LLVMValueRef llvm_emit_expect_raw(GenContext *c, LLVMValueRef expect_true); +LLVMValueRef llvm_emit_expect_false_raw(GenContext *c, LLVMValueRef expect_false); void llvm_emit_any_from_value(GenContext *c, BEValue *value, Type *type); void llvm_emit_subarray_len(GenContext *context, BEValue *subarray, BEValue *len); void llvm_emit_subarray_pointer(GenContext *context, BEValue *subarray, BEValue *pointer); diff --git a/src/compiler/llvm_codegen_stmt.c b/src/compiler/llvm_codegen_stmt.c index f2f11b628..2be2442b9 100644 --- a/src/compiler/llvm_codegen_stmt.c +++ b/src/compiler/llvm_codegen_stmt.c @@ -990,7 +990,7 @@ static inline void llvm_emit_assume(GenContext *c, Expr *expr) llvm_value_rvalue(c, &value); assert(value.kind == BE_BOOLEAN); EMIT_LOC(c, expr); - llvm_emit_call_intrinsic(c, intrinsic_id.assume, NULL, 0, &(value.value), 1); + llvm_emit_assume_raw(c, value.value); } } @@ -1392,8 +1392,11 @@ void llvm_emit_panic_if_true(GenContext *c, BEValue *value, const char *panic_na LLVMBasicBlockRef panic_block = llvm_basic_block_new(c, "panic"); LLVMBasicBlockRef ok_block = llvm_basic_block_new(c, "checkok"); assert(llvm_value_is_bool(value)); + value->value = llvm_emit_expect_false_raw(c, value->value); llvm_emit_cond_br(c, value, panic_block, ok_block); + llvm_emit_block(c, panic_block); + vec_add(c->panic_blocks, panic_block); BEValue *values = NULL; if (value_1) { diff --git a/src/compiler/llvm_codegen_type.c b/src/compiler/llvm_codegen_type.c index 8f8d9aff1..87f012c3f 100644 --- a/src/compiler/llvm_codegen_type.c +++ b/src/compiler/llvm_codegen_type.c @@ -493,7 +493,7 @@ static LLVMValueRef llvm_get_introspection_for_builtin_type(GenContext *c, Type static LLVMValueRef llvm_get_introspection_for_enum(GenContext *c, Type *type) { Decl *decl = type->decl; - bool is_external = decl->unit->module != c->code_module; + bool is_external = decl_module(decl) != c->code_module; bool is_dynamic = decl->is_dynamic; Decl **enum_vals = decl->enums.values; diff --git a/src/compiler/parse_global.c b/src/compiler/parse_global.c index b84e15ca0..22da880b3 100644 --- a/src/compiler/parse_global.c +++ b/src/compiler/parse_global.c @@ -777,7 +777,7 @@ Expr *parse_decl_or_expr(ParseContext *c, Decl **decl_ref) /** * const_decl ::= 'const' type? CONST_IDENT attributes? '=' const_expr */ -Decl *parse_const_declaration(ParseContext *c, bool is_global) +Decl *parse_const_declaration(ParseContext *c, bool is_global, bool is_extern) { advance_and_verify(c, TOKEN_CONST); @@ -805,6 +805,7 @@ Decl *parse_const_declaration(ParseContext *c, bool is_global) if (!parse_attributes(c, &decl->attributes, NULL, NULL, NULL)) return poisoned_decl; } + if (is_extern) return decl; // Required initializer CONSUME_OR_RET(TOKEN_EQ, poisoned_decl); if (!parse_decl_initializer(c, decl)) return poisoned_decl; @@ -1702,9 +1703,9 @@ static inline Decl *parse_bitstruct_declaration(ParseContext *c) } -static inline Decl *parse_top_level_const_declaration(ParseContext *c) +static inline Decl *parse_top_level_const_declaration(ParseContext *c, bool is_extern) { - ASSIGN_DECL_OR_RET(Decl * decl, parse_const_declaration(c, true), poisoned_decl); + ASSIGN_DECL_OR_RET(Decl *decl, parse_const_declaration(c, true, is_extern), poisoned_decl); CONSUME_EOS_OR_RET(poisoned_decl); return decl; } @@ -2694,7 +2695,7 @@ Decl *parse_top_level_statement(ParseContext *c, ParseContext **c_ref) break; case TOKEN_CONST: if (contracts) goto CONTRACT_NOT_ALLOWED; - decl = parse_top_level_const_declaration(c); + decl = parse_top_level_const_declaration(c, true); break; case TOKEN_IDENT: case TOKEN_TLOCAL: @@ -2791,7 +2792,7 @@ Decl *parse_top_level_statement(ParseContext *c, ParseContext **c_ref) break; case TOKEN_CONST: if (contracts) goto CONTRACT_NOT_ALLOWED; - decl = parse_top_level_const_declaration(c); + decl = parse_top_level_const_declaration(c, false); break; case TOKEN_STRUCT: case TOKEN_UNION: diff --git a/src/compiler/parse_stmt.c b/src/compiler/parse_stmt.c index b4b5430b1..246b19a7e 100644 --- a/src/compiler/parse_stmt.c +++ b/src/compiler/parse_stmt.c @@ -85,7 +85,7 @@ static inline Ast *parse_declaration_stmt(ParseContext *c) { // Consts don't have multiple declarations. Ast *decl_stmt = new_ast(AST_DECLARE_STMT, c->span); - ASSIGN_DECL_OR_RET(decl_stmt->declare_stmt, parse_const_declaration(c, false), poisoned_ast); + ASSIGN_DECL_OR_RET(decl_stmt->declare_stmt, parse_const_declaration(c, false, false), poisoned_ast); decl_stmt->declare_stmt->visibility = VISIBLE_LOCAL; RANGE_EXTEND_PREV(decl_stmt); CONSUME_EOS_OR_RET(poisoned_ast); diff --git a/src/compiler/parser_internal.h b/src/compiler/parser_internal.h index 9593d8945..62f2d44a7 100644 --- a/src/compiler/parser_internal.h +++ b/src/compiler/parser_internal.h @@ -36,7 +36,7 @@ TypeInfo *parse_optional_type(ParseContext *c); TypeInfo *parse_type_with_base(ParseContext *c, TypeInfo *type_info); Expr* parse_constant_expr(ParseContext *c); -Decl *parse_const_declaration(ParseContext *c, bool is_global); +Decl *parse_const_declaration(ParseContext *c, bool is_global, bool is_extern); Expr *parse_integer(ParseContext *c, Expr *left); Expr *parse_decl_or_expr(ParseContext *c, Decl **decl_ref); void recover_top_level(ParseContext *c); diff --git a/src/compiler/sema_decls.c b/src/compiler/sema_decls.c index c835304a7..e8ddcfb4b 100644 --- a/src/compiler/sema_decls.c +++ b/src/compiler/sema_decls.c @@ -1708,7 +1708,7 @@ static inline bool unit_add_method_like(CompilationUnit *unit, Type *parent_type vec_add(parent->methods, method_like); break; case VISIBLE_PRIVATE: - if (parent->unit && parent->unit->module == unit->module && parent->visibility >= VISIBLE_PRIVATE) + if (decl_module(parent) == unit->module && parent->visibility >= VISIBLE_PRIVATE) { vec_add(parent->methods, method_like); break; @@ -3206,7 +3206,12 @@ bool sema_analyse_var_decl(SemaContext *context, Decl *decl, bool local) scratch_buffer_append(decl->name); decl->extname = scratch_buffer_copy(); } - + if (decl->is_extern && decl->var.init_expr) + { + assert(is_global); + SEMA_ERROR(decl->var.init_expr, "Extern globals may not have initializers."); + return decl_poison(decl); + } if (erase_decl) { decl->decl_kind = DECL_ERASED; @@ -3603,7 +3608,7 @@ Decl *sema_analyse_parameterized_identifier(SemaContext *c, Path *decl_path, con Decl *alias = unit_resolve_parameterized_symbol(c->unit, &name_resolve); if (!decl_ok(alias)) return poisoned_decl; - Module *module = alias->unit->module; + Module *module = decl_module(alias); unsigned parameter_count = vec_size(module->parameters); assert(parameter_count > 0); if (parameter_count != vec_size(params)) diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 7df28fd68..0f82e5bde 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -54,7 +54,7 @@ static inline bool sema_expr_analyse_call(SemaContext *context, Expr *expr, bool static inline bool sema_expr_analyse_expr_block(SemaContext *context, Type *infer_type, Expr *expr); static inline bool sema_expr_analyse_optional(SemaContext *context, Expr *expr, bool *failed_ref); static inline bool sema_expr_analyse_compiler_const(SemaContext *context, Expr *expr, bool report_missing); -static inline bool sema_expr_analyse_ct_arg(SemaContext *context, Expr *expr); +static inline bool sema_expr_analyse_ct_arg(SemaContext *context, Type *infer_type, Expr *expr); static inline bool sema_expr_analyse_ct_stringify(SemaContext *context, Expr *expr); static inline bool sema_expr_analyse_ct_offsetof(SemaContext *context, Expr *expr); static inline bool sema_expr_analyse_ct_call(SemaContext *context, Expr *expr); @@ -752,6 +752,7 @@ static inline bool sema_cast_ident_rvalue(SemaContext *context, Expr *expr) switch (decl->var.kind) { case VARDECL_CONST: + if (decl->is_extern) return true; if (!expr_is_constant_eval(decl->var.init_expr, CONSTANT_EVAL_NO_SIDE_EFFECTS)) { UNREACHABLE @@ -928,7 +929,7 @@ static inline bool sema_expr_analyse_identifier(SemaContext *context, Type *to, if (decl_needs_prefix(decl)) { if (!sema_analyse_decl(context, decl)) return false; - if (decl->unit->module != context->unit->module && !expr->identifier_expr.path) + if (decl_module(decl) != context->unit->module && !expr->identifier_expr.path) { const char *message; switch (decl->decl_kind) @@ -3105,7 +3106,7 @@ static inline bool sema_expr_analyse_type_access(SemaContext *context, Expr *exp { RETURN_SEMA_ERROR(expr, "'%s' is an ambiguous name and so cannot be resolved, " "it may refer to method defined in '%s' or one in '%s'", - name, member->unit->module->name->module, ambiguous->unit->module->name->module); + name, decl_module(member)->name->module, decl_module(ambiguous)->name->module); } } if (!member) @@ -4157,7 +4158,7 @@ static inline bool sema_expr_analyse_access(SemaContext *context, Expr *expr, bo { RETURN_SEMA_ERROR(expr, "'%s' is an ambiguous name and so cannot be resolved, " "it may refer to method defined in '%s' or one in '%s'", - kw, method->unit->module->name->module, ambiguous->unit->module->name->module); + kw, decl_module(method)->name->module, decl_module(ambiguous)->name->module); } if (!method) { @@ -4201,7 +4202,7 @@ static inline bool sema_expr_analyse_access(SemaContext *context, Expr *expr, bo if (ambiguous) { SEMA_ERROR(expr, "'%s' is an ambiguous name and so cannot be resolved, it may refer to method defined in '%s' or one in '%s'", - kw, member->unit->module->name->module, ambiguous->unit->module->name->module); + kw, decl_module(member)->name->module, decl_module(ambiguous)->name->module); return false; } } @@ -7085,7 +7086,7 @@ static inline bool sema_expr_analyse_decl_element(SemaContext *context, Designat if (ambiguous) { sema_error_at(loc, "'%s' is an ambiguous name and so cannot be resolved, it may refer to method defined in '%s' or one in '%s'", - kw, member->unit->module->name->module, ambiguous->unit->module->name->module); + kw, decl_module(member)->name->module, decl_module(ambiguous)->name->module); return false; } if (is_missing) @@ -7205,7 +7206,7 @@ static inline bool sema_expr_analyse_ct_nameof(SemaContext *context, Expr *expr) return true; } scratch_buffer_clear(); - scratch_buffer_append(decl->unit->module->name->module); + scratch_buffer_append(decl_module(decl)->name->module); scratch_buffer_append("::"); scratch_buffer_append(decl->name); expr_rewrite_to_string(expr, scratch_buffer_copy()); @@ -7835,7 +7836,7 @@ static inline bool sema_expr_analyse_ct_defined(SemaContext *context, Expr *expr return true; } -static inline bool sema_expr_analyse_ct_arg(SemaContext *context, Expr *expr) +static inline bool sema_expr_analyse_ct_arg(SemaContext *context, Type *infer_type, Expr *expr) { assert(expr->resolve_status == RESOLVE_RUNNING); TokenType type = expr->ct_arg_expr.type; @@ -7871,6 +7872,10 @@ static inline bool sema_expr_analyse_ct_arg(SemaContext *context, Expr *expr) // Not found, so generate a new. if (!decl) { + if (type_is_invalid_storage_type(arg_expr->type)) + { + RETURN_SEMA_ERROR(expr, "The vararg doesn't have a valid runtime type."); + } decl = decl_new_generated_var(arg_expr->type, VARDECL_PARAM, arg_expr->span); decl->var.init_expr = arg_expr; decl->va_index = (uint16_t)index; @@ -8190,7 +8195,7 @@ static inline bool sema_analyse_expr_dispatch(SemaContext *context, Expr *expr) case EXPR_CT_AND_OR: return sema_expr_analyse_ct_and_or(context, expr); case EXPR_CT_ARG: - return sema_expr_analyse_ct_arg(context, expr); + return sema_expr_analyse_ct_arg(context, NULL, expr); case EXPR_STRINGIFY: if (!sema_expr_analyse_ct_stringify(context, expr)) return false; return true; @@ -8659,6 +8664,9 @@ bool sema_analyse_inferred_expr(SemaContext *context, Type *infer_type, Expr *ex case EXPR_LAMBDA: if (!sema_expr_analyse_lambda(context, infer_type, expr)) return expr_poison(expr); break; + case EXPR_CT_ARG: + if (!sema_expr_analyse_ct_arg(context, infer_type, expr)) return expr_poison(expr); + break; default: if (!sema_analyse_expr_dispatch(context, expr)) return expr_poison(expr); break; diff --git a/src/compiler/sema_name_resolution.c b/src/compiler/sema_name_resolution.c index 61388a429..c193bbcbc 100644 --- a/src/compiler/sema_name_resolution.c +++ b/src/compiler/sema_name_resolution.c @@ -212,46 +212,6 @@ Decl *sema_find_decl_in_modules(Module **module_list, Path *path, const char *in } return NULL; } -static Decl *sema_find_decl_in_global(DeclTable *table, Module **module_list, NameResolve *name_resolve, bool want_generic) -{ - const char *symbol = name_resolve->symbol; - Path *path = name_resolve->path; - DeclId decl_ids = decltable_get(table, symbol); - - // We might have no match at all. - if (!decl_ids) - { - // Update the path found - if (path && !name_resolve->path_found) name_resolve->path_found = sema_is_path_found(module_list, path, want_generic); - return NULL; - } - - Decl *decls = declptr(decl_ids); - // There might just be a single match. - if (decls->decl_kind != DECL_DECLARRAY) - { - if (path && !matches_subpath(decls->unit->module->name, path)) return false; - name_resolve->private_decl = NULL; - return decls; - } - - // Else go through the list - Decl **decl_list = decls->decl_list; - Decl *ambiguous = NULL; - Decl *decl = NULL; - VECEACH(decl_list, i) - { - Decl *candidate = decl_list[i]; - if (!ambiguous && (!path || matches_subpath(candidate->unit->module->name, path))) - { - ambiguous = decl; - decl = candidate; - } - } - if (ambiguous) name_resolve->ambiguous_other_decl = ambiguous; - name_resolve->private_decl = NULL; - return decl; -} static bool decl_is_visible(CompilationUnit *unit, Decl *decl) { @@ -289,7 +249,7 @@ static bool decl_is_visible(CompilationUnit *unit, Decl *decl) return false; } -static Decl *sema_find_decl_in_global_new(CompilationUnit *unit, DeclTable *table, Module **module_list, NameResolve *name_resolve, bool want_generic) +static Decl *sema_find_decl_in_global(CompilationUnit *unit, DeclTable *table, Module **module_list, NameResolve *name_resolve, bool want_generic) { const char *symbol = name_resolve->symbol; Path *path = name_resolve->path; @@ -307,7 +267,7 @@ static Decl *sema_find_decl_in_global_new(CompilationUnit *unit, DeclTable *tabl // There might just be a single match. if (decls->decl_kind != DECL_DECLARRAY) { - if (path && !matches_subpath(decls->unit->module->name, path)) return NULL; + if (path && !matches_subpath(decl_module(decls)->name, path)) return NULL; if (!decl_is_visible(unit, decls)) { name_resolve->maybe_decl = decls; @@ -324,7 +284,7 @@ static Decl *sema_find_decl_in_global_new(CompilationUnit *unit, DeclTable *tabl VECEACH(decl_list, i) { Decl *candidate = decl_list[i]; - if (path && !matches_subpath(candidate->unit->module->name, path)) continue; + if (path && !matches_subpath(decl_module(candidate)->name, path)) continue; if (!decl_is_visible(unit, candidate)) { maybe_decl = candidate; @@ -393,7 +353,7 @@ static Decl *sema_resolve_path_symbol(SemaContext *context, NameResolve *name_re decl = sema_find_decl_in_imports(unit->imports, name_resolve, false); // 4. Go to global search - return decl ? decl : sema_find_decl_in_global_new(unit, &global_context.symbols, global_context.module_list, name_resolve, false); + return decl ? decl : sema_find_decl_in_global(unit, &global_context.symbols, global_context.module_list, name_resolve, false); } static inline Decl *sema_find_ct_local(SemaContext *context, const char *symbol) @@ -435,18 +395,16 @@ static inline Decl *sema_find_local(SemaContext *context, const char *symbol) static Decl *sema_resolve_no_path_symbol(SemaContext *context, NameResolve *name_resolve) { - Decl *decl = NULL; - const char *symbol = name_resolve->symbol; assert(name_resolve->path == NULL); - Decl *found = sema_find_local(context, symbol); - if (found) return found; + Decl *decl = sema_find_local(context, symbol); + if (decl) return decl; CompilationUnit *unit = context->unit; // Search in file scope. - decl = htable_get(&unit->local_symbols, (void*)symbol); + decl = htable_get(&unit->local_symbols, (void *) symbol); if (decl) return decl; @@ -463,13 +421,13 @@ static Decl *sema_resolve_no_path_symbol(SemaContext *context, NameResolve *name { // Find the global NameResolve copy = *name_resolve; - Decl *global = sema_find_decl_in_global_new(context->unit, &global_context.symbols, NULL, name_resolve, false); + Decl *global = sema_find_decl_in_global(context->unit, &global_context.symbols, NULL, name_resolve, false); // If it exists and is autoimport, then prefer it. if (global && global->is_autoimport) return global; *name_resolve = copy; return decl; } - return decl ? decl : sema_find_decl_in_global_new(context->unit, &global_context.symbols, NULL, name_resolve, false); + return decl ? decl : sema_find_decl_in_global(context->unit, &global_context.symbols, NULL, name_resolve, false); } @@ -498,7 +456,7 @@ static void sema_report_error_on_decl(Decl *found, NameResolve *name_resolve) if (!found && name_resolve->maybe_decl) { const char *maybe_name = decl_to_name(name_resolve->maybe_decl); - const char *module_name = name_resolve->maybe_decl->unit->module->name->module; + const char *module_name = decl_module(name_resolve->maybe_decl)->name->module; if (path_name) { sema_error_at(span, "Did you mean the %s '%s::%s' in module %s? If so please add 'import %s'.", @@ -517,8 +475,8 @@ static void sema_report_error_on_decl(Decl *found, NameResolve *name_resolve) { assert(found); const char *symbol_type = decl_to_name(found); - const char *found_path = found->unit->module->name->module; - const char *other_path = name_resolve->ambiguous_other_decl->unit->module->name->module; + const char *found_path = decl_module(found)->name->module; + const char *other_path = decl_module(name_resolve->ambiguous_other_decl)->name->module; if (path_name) { sema_error_at(span, @@ -849,9 +807,9 @@ Decl *unit_resolve_parameterized_symbol(CompilationUnit *unit, NameResolve *name Decl *decl = sema_find_decl_in_imports(unit->imports, name_resolve, true); if (!decl) { - decl = sema_find_decl_in_global_new(unit, &global_context.generic_symbols, - global_context.generic_module_list, - name_resolve, true); + decl = sema_find_decl_in_global(unit, &global_context.generic_symbols, + global_context.generic_module_list, + name_resolve, true); } // 14. Error report if (!decl || name_resolve->ambiguous_other_decl) @@ -918,7 +876,7 @@ bool sema_symbol_is_defined_in_scope(SemaContext *c, const char *symbol) // Unknown symbol => not defined if (!decl) return false; // Defined in the same module => defined - if (decl->unit->module == c->unit->module) return true; + if (decl_module(decl) == c->unit->module) return true; // Not a variable or function => defined if (decl->decl_kind != DECL_VAR && decl->decl_kind != DECL_FUNC) return true; // Otherwise defined only if autoimport. @@ -995,8 +953,8 @@ bool sema_add_local(SemaContext *context, Decl *decl) if (is_var && decl->var.shadow) goto ADD_VAR; Decl *other = sema_find_local(context, decl->name); - assert(!other || other->unit->module); - if (other && (other->unit->module == current_unit->module || other->is_autoimport)) + assert(!other || decl_module(other)); + if (other && (decl_module(other) == current_unit->module || other->is_autoimport)) { sema_shadow_error(decl, other); decl_poison(decl); diff --git a/src/compiler/sema_stmts.c b/src/compiler/sema_stmts.c index 145aa2154..7fe605efb 100644 --- a/src/compiler/sema_stmts.c +++ b/src/compiler/sema_stmts.c @@ -1539,11 +1539,18 @@ static inline bool sema_analyse_foreach_stmt(SemaContext *context, Ast *statemen len_call->type = type_isz; } } + bool is_single_pass = array_len == 1; + if (is_single_pass) + { + is_reverse = false; + } + Decl *idx_decl = decl_new_generated_var(index_type, VARDECL_LOCAL, index ? index->span : enumerator->span); // IndexType __len$ = (IndexType)(@__enum$.len()) Decl *len_decl = NULL; + if (is_reverse) { if (!len_call) @@ -1607,6 +1614,10 @@ static inline bool sema_analyse_foreach_stmt(SemaContext *context, Ast *statemen update_stmt->expr_stmt = dec; ast_append(&succ, update_stmt); } + else if (is_single_pass) + { + cond = expr_new_const_bool(idx_decl->span, type_bool, false); + } else { // Create __idx$ < __len$ @@ -1648,7 +1659,14 @@ static inline bool sema_analyse_foreach_stmt(SemaContext *context, Ast *statemen enum_val = expr_variable(temp); if (is_addr) expr_rewrite_insert_deref(enum_val); subscript->subscript_expr.expr = exprid(enum_val); - subscript->subscript_expr.range.start = exprid(expr_variable(idx_decl)); + if (array_len == 1) + { + subscript->subscript_expr.range.start = exprid(expr_new_const_int(var->span, idx_decl->type, 0)); + } + else + { + subscript->subscript_expr.range.start = exprid(expr_variable(idx_decl)); + } if (value_by_ref) { Expr *addr = expr_new(EXPR_UNARY, subscript->span); @@ -1663,11 +1681,12 @@ static inline bool sema_analyse_foreach_stmt(SemaContext *context, Ast *statemen Ast *compound_stmt = new_ast(AST_COMPOUND_STMT, body_ast->span); compound_stmt->compound_stmt.first_stmt = first_stmt; FlowCommon flow = statement->foreach_stmt.flow; + flow.skip_first = is_single_pass; statement->for_stmt = (AstForStmt){ .init = exprid(init_expr), .cond = exprid(cond), .incr = update ? exprid(update) : 0, .flow = flow, - .body = astid(compound_stmt) + .body = astid(compound_stmt), }; statement->ast_kind = AST_FOR_STMT; return sema_analyse_for_stmt(context, statement); diff --git a/src/compiler/semantic_analyser.c b/src/compiler/semantic_analyser.c index 06ff9aa62..5ff91ff75 100644 --- a/src/compiler/semantic_analyser.c +++ b/src/compiler/semantic_analyser.c @@ -238,11 +238,17 @@ static void analyze_generic_module(Module *module) register_generic_decls(unit, unit->global_decls); register_generic_decls(unit, unit->global_cond_decls); } - sema_analyze_stage(module, ANALYSIS_MODULE_HIERARCHY); } static void sema_analyze_to_stage(AnalysisStage stage) { + if (stage <= ANALYSIS_MODULE_TOP) + { + VECEACH(global_context.generic_module_list, i) + { + sema_analyze_stage(global_context.generic_module_list[i], stage); + } + } VECEACH(global_context.module_list, i) { sema_analyze_stage(global_context.module_list[i], stage); diff --git a/src/compiler/types.c b/src/compiler/types.c index 3e9987ec9..a669f9fa3 100644 --- a/src/compiler/types.c +++ b/src/compiler/types.c @@ -226,10 +226,10 @@ const char *type_to_error_string(Type *type) case TYPE_INTERFACE: { Decl *decl = type->decl; - if (!decl || !decl->unit || !decl->unit->module->generic_suffix) return type->name; + if (!decl || !decl_module(decl)->generic_suffix) return type->name; scratch_buffer_clear(); scratch_buffer_append(decl->name); - scratch_buffer_append(decl->unit->module->generic_suffix); + scratch_buffer_append(decl_module(decl)->generic_suffix); return scratch_buffer_copy(); } case TYPE_FUNC: @@ -572,7 +572,7 @@ void type_mangle_introspect_name_to_buffer(Type *type) type = type->function.prototype->raw_type; if (type->function.decl) { - Module *module = type->function.decl->unit->module; + Module *module = decl_module(type->function.decl); scratch_buffer_append(module->extname ? module->extname : module->name->module); scratch_buffer_append_char('$'); scratch_buffer_append(type->name); @@ -2314,7 +2314,7 @@ Module *type_base_module(Type *type) type = type->pointer; goto RETRY; case TYPE_FUNC: - return type->function.decl ? type->function.decl->unit->module : NULL; + return type->function.decl ? decl_module(type->function.decl) : NULL; case TYPE_ENUM: case TYPE_STRUCT: case TYPE_UNION: diff --git a/src/version.h b/src/version.h index 161ae756a..76c9b1134 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define COMPILER_VERSION "0.5.2" +#define COMPILER_VERSION "0.5.3" diff --git a/test/test_suite/abi/darwin64_avx.c3t b/test/test_suite/abi/darwin64_avx.c3t index 2c1d346e0..0cd81ee08 100644 --- a/test/test_suite/abi/darwin64_avx.c3t +++ b/test/test_suite/abi/darwin64_avx.c3t @@ -111,8 +111,10 @@ fn void f61(SAtwo256 s) { declare void @f38(<8 x float>) #0 +; Function Attrs: declare void @f37(<8 x float>) #0 +; Function Attrs: define void @test.f39() #0 { entry: %0 = load <8 x float>, ptr @test.x38, align 32 @@ -122,24 +124,30 @@ entry: ret void } +; Function Attrs: declare void @func40(ptr byval(%Two128) align 16) #0 +; Function Attrs: define void @test.func41(ptr byval(%Two128) align 16 %0) #0 { entry: call void @func40(ptr byval(%Two128) align 16 %0) ret void } +; Function Attrs: declare void @func42(ptr byval(%Sa) align 16) #0 +; Function Attrs: define void @test.func43(ptr byval(%Sa) align 16 %0) #0 { entry: call void @func42(ptr byval(%Sa) align 16 %0) ret void } +; Function Attrs: declare void @f46(double, double, double, double, double, double, double, double, ptr byval(<2 x float>) align 8, ptr byval(<2 x float>) align 8) #0 +; Function Attrs: define void @test.test46() #0 { entry: %x = alloca <2 x float>, align 8 @@ -156,8 +164,10 @@ entry: ret void } +; Function Attrs: declare void @f47(i32, i32, i32, i32, i32, i32, i32) #0 +; Function Attrs: define void @test.test47(i32 %0, i32 %1) #0 { entry: %b = alloca %Vec47, align 4 @@ -167,31 +177,36 @@ entry: ret void } +; Function Attrs: declare void @test49_helper(double, ...) #0 +; Function Attrs: define void @test.test49(double %0, double %1) #0 { entry: call void (double, ...) @test49_helper(double %0, double %1) ret void } +; Function Attrs: declare void @test52_helper(i32, ...) #0 +; Function Attrs: define void @test.test52() #0 { entry: %literal = alloca %Complex, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 16, i1 false) %0 = load <8 x float>, ptr @test.x52, align 32 - %1 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 0 - %lo = load double, ptr %1, align 8 - %2 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 1 - %hi = load double, ptr %2, align 8 + %lo = load double, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 + %hi = load double, ptr %ptradd, align 8 call void (i32, ...) @test52_helper(i32 0, <8 x float> %0, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi) ret void } +; Function Attrs: declare void @test54_helper(<8 x float>, ...) #0 +; Function Attrs: define void @test.test54() #0 { entry: %literal = alloca %Complex, align 8 @@ -199,22 +214,24 @@ entry: call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.6, i32 16, i1 false) %0 = load <8 x float>, ptr @test.x54, align 32 %1 = load <8 x float>, ptr @test.x54, align 32 - %2 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 0 - %lo = load double, ptr %2, align 8 - %3 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 1 - %hi = load double, ptr %3, align 8 + %lo = load double, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 + %hi = load double, ptr %ptradd, align 8 call void (<8 x float>, ...) @test54_helper(<8 x float> %0, <8 x float> %1, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal1, ptr align 8 @.__const.7, i32 16, i1 false) - %4 = load <8 x float>, ptr @test.x54, align 32 - %5 = load <8 x float>, ptr @test.x54, align 32 - call void (<8 x float>, ...) @test54_helper(<8 x float> %4, <8 x float> %5, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1) + %2 = load <8 x float>, ptr @test.x54, align 32 + %3 = load <8 x float>, ptr @test.x54, align 32 + call void (<8 x float>, ...) @test54_helper(<8 x float> %2, <8 x float> %3, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1) ret void } +; Function Attrs: declare void @f55(ptr byval(%St512) align 64) #0 +; Function Attrs: declare void @f56(ptr byval(<16 x float>) align 64) #0 +; Function Attrs: define void @test.f57() #0 { entry: call void @f55(ptr byval(%St512) align 64 @test.x55) @@ -222,16 +239,20 @@ entry: ret void } +; Function Attrs: declare void @f58(ptr byval(%Two256) align 32) #0 +; Function Attrs: define void @test.f59(ptr byval(%Two256) align 32 %0) #0 { entry: call void @f58(ptr byval(%Two256) align 32 %0) ret void } +; Function Attrs: declare void @f60(ptr byval(%SAtwo256) align 32) #0 +; Function Attrs: define void @test.f61(ptr byval(%SAtwo256) align 32 %0) #0 { entry: call void @f60(ptr byval(%SAtwo256) align 32 %0) diff --git a/test/test_suite/abi/darwin64_avx512.c3t b/test/test_suite/abi/darwin64_avx512.c3t index 17aff93a1..b4ffedd01 100644 --- a/test/test_suite/abi/darwin64_avx512.c3t +++ b/test/test_suite/abi/darwin64_avx512.c3t @@ -61,10 +61,10 @@ fn void f64() { declare void @f55(<16 x float>) #0 - +; Function Attrs: declare void @f56(<16 x float>) #0 - +; Function Attrs: define void @test.f57() #0 { entry: %0 = load <16 x float>, ptr @test.x55, align 64 @@ -74,47 +74,46 @@ entry: ret void } - +; Function Attrs: declare void @f58(ptr byval(%Two256) align 32) #0 - +; Function Attrs: define void @test.f59(ptr byval(%Two256) align 32 %0) #0 { entry: call void @f58(ptr byval(%Two256) align 32 %0) ret void } - +; Function Attrs: declare void @f60(ptr byval(%SAtwo256) align 32) #0 - +; Function Attrs: define void @test.f61(ptr byval(%SAtwo256) align 32 %0) #0 { entry: call void @f60(ptr byval(%SAtwo256) align 32 %0) ret void } - +; Function Attrs: declare void @f62_helper(i32, ...) #0 - +; Function Attrs: define void @test.f62() #0 { entry: %literal = alloca %Complex, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 16, i1 false) %0 = load <16 x float>, ptr @test.x62, align 64 - %1 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 0 - %lo = load double, ptr %1, align 8 - %2 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 1 - %hi = load double, ptr %2, align 8 + %lo = load double, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 + %hi = load double, ptr %ptradd, align 8 call void (i32, ...) @f62_helper(i32 0, <16 x float> %0, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi) ret void } - +; Function Attrs: declare void @f64_helper(<16 x float>, ...) #0 - +; Function Attrs: define void @test.f64() #0 { entry: %literal = alloca %Complex, align 8 @@ -122,14 +121,13 @@ entry: call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.4, i32 16, i1 false) %0 = load <16 x float>, ptr @test.x64, align 64 %1 = load <16 x float>, ptr @test.x64, align 64 - %2 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 0 - %lo = load double, ptr %2, align 8 - %3 = getelementptr inbounds %Complex, ptr %literal, i32 0, i32 1 - %hi = load double, ptr %3, align 8 + %lo = load double, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 + %hi = load double, ptr %ptradd, align 8 call void (<16 x float>, ...) @f64_helper(<16 x float> %0, <16 x float> %1, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double %lo, double %hi) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal1, ptr align 8 @.__const.5, i32 16, i1 false) - %4 = load <16 x float>, ptr @test.x64, align 64 - %5 = load <16 x float>, ptr @test.x64, align 64 - call void (<16 x float>, ...) @f64_helper(<16 x float> %4, <16 x float> %5, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1) + %2 = load <16 x float>, ptr @test.x64, align 64 + %3 = load <16 x float>, ptr @test.x64, align 64 + call void (<16 x float>, ...) @f64_helper(<16 x float> %2, <16 x float> %3, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, ptr byval(%Complex) align 8 %literal1) ret void } diff --git a/test/test_suite/abi/darwin_arg.c3t b/test/test_suite/abi/darwin_arg.c3t index 9d52311ff..6f71ab845 100644 --- a/test/test_suite/abi/darwin_arg.c3t +++ b/test/test_suite/abi/darwin_arg.c3t @@ -21,5 +21,5 @@ fn void f9122143() declare void @d(i64, double) #0 %lo = load i64, ptr @test.ss, align 16 - %hi = load double, ptr getelementptr inbounds ({ i64, double }, ptr @test.ss, i32 0, i32 1), align 8 + %hi = load double, ptr getelementptr inbounds (i8, ptr @test.ss, i64 8), align 8 call void @d(i64 %lo, double %hi) diff --git a/test/test_suite/abi/riscv32-ilp32-abi.c3t b/test/test_suite/abi/riscv32-ilp32-abi.c3t index 57562548f..5fc8442d2 100644 --- a/test/test_suite/abi/riscv32-ilp32-abi.c3t +++ b/test/test_suite/abi/riscv32-ilp32-abi.c3t @@ -56,33 +56,32 @@ entry: ret i32 %add } - +; Function Attrs: define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, float %1, i64 %2, double %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 4 - %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 %fpsi = fptosi float %1 to i32 - store i32 %fpsi, ptr %8, align 4 - %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + store i32 %fpsi, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %zext = zext i8 %5 to i32 - store i32 %zext, ptr %9, align 4 - %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + store i32 %zext, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i32 8 %sext = sext i8 %6 to i32 - store i32 %sext, ptr %10, align 4 - %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - %zext1 = zext i8 %7 to i32 - store i32 %zext1, ptr %11, align 4 + store i32 %sext, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i32 12 + %zext3 = zext i8 %7 to i32 + store i32 %zext3, ptr %ptradd2, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) ret void } - +; Function Attrs: define void @test.f_scalar_stack_3(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) #0 { entry: ret void } - +; Function Attrs: define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) #0 { entry: %e = alloca %Tiny, align 1 diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-abi-1.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-abi-1.c3t index 862bfb30f..dedad0285 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-abi-1.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-abi-1.c3t @@ -53,29 +53,31 @@ entry: ret i32 %add } +; Function Attrs: define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, double %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 4 - %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 - store i32 %1, ptr %8, align 4 - %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + store i32 %1, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %zext = zext i8 %5 to i32 - store i32 %zext, ptr %9, align 4 - %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + store i32 %zext, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i32 8 %sext = sext i8 %6 to i32 - store i32 %sext, ptr %10, align 4 - %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - %zext1 = zext i8 %7 to i32 - store i32 %zext1, ptr %11, align 4 + store i32 %sext, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i32 12 + %zext3 = zext i8 %7 to i32 + store i32 %zext3, ptr %ptradd2, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) ret void } +; Function Attrs: define void @test.f_scalar_stack_3(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, i32 %6, double %7, fp128 %8) #0 { entry: ret void } +; Function Attrs: define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) #0 { entry: %e = alloca %Tiny, align 1 diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t index 7541921be..d3ec2fdb9 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-1.c3t @@ -184,70 +184,80 @@ entry: ret void } +; Function Attrs: define zeroext i8 @test.f_scalar_0(i8 zeroext %0) #0 { entry: ret i8 %0 } +; Function Attrs: define signext i8 @test.f_scalar_1(i8 signext %0) #0 { entry: ret i8 %0 } +; Function Attrs: define zeroext i8 @test.f_scalar_2(i8 zeroext %0) #0 { entry: ret i8 %0 } +; Function Attrs: define i32 @test.f_scalar_3(i32 %0) #0 { entry: ret i32 %0 } +; Function Attrs: define i64 @test.f_scalar_4(i64 %0) #0 { entry: ret i64 %0 } +; Function Attrs: define i128 @test.f_scalar_5(i128 %0) #0 { entry: ret i128 %0 } +; Function Attrs: define float @test.f_fp_scalar_1(float %0) #0 { entry: ret float %0 } +; Function Attrs: define double @test.f_fp_scalar_2(double %0) #0 { entry: ret double %0 } +; Function Attrs: define fp128 @test.f_fp_scalar_3(fp128 %0) #0 { entry: ret fp128 %0 } +; Function Attrs: define void @test.f_agg_tiny(i32 %0) #0 { entry: %x = alloca %Tiny, align 1 store i32 %0, ptr %x, align 1 - %1 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 0 - %2 = load i8, ptr %1, align 1 - %3 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 1 - %4 = load i8, ptr %3, align 1 - %add = add i8 %2, %4 - store i8 %add, ptr %1, align 1 - %5 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 2 - %6 = load i8, ptr %5, align 1 - %7 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 3 - %8 = load i8, ptr %7, align 1 - %add1 = add i8 %6, %8 - store i8 %add1, ptr %5, align 1 + %1 = load i8, ptr %x, align 1 + %ptradd = getelementptr inbounds i8, ptr %x, i32 1 + %2 = load i8, ptr %ptradd, align 1 + %add = add i8 %1, %2 + store i8 %add, ptr %x, align 1 + %ptradd1 = getelementptr inbounds i8, ptr %x, i32 2 + %3 = load i8, ptr %ptradd1, align 1 + %ptradd2 = getelementptr inbounds i8, ptr %x, i32 3 + %4 = load i8, ptr %ptradd2, align 1 + %add3 = add i8 %3, %4 + store i8 %add3, ptr %ptradd1, align 1 ret void } +; Function Attrs: define i32 @test.f_agg_tiny_ret() #0 { entry: %literal = alloca %Tiny, align 1 @@ -256,6 +266,7 @@ entry: ret i32 %0 } +; Function Attrs: define void @test.f_vec_tiny_v4i8(i32 %0) #0 { entry: %x = alloca <4 x i8>, align 4 @@ -273,6 +284,7 @@ entry: ret void } +; Function Attrs: define i32 @test.f_vec_tiny_v4i8_ret() #0 { entry: %taddr = alloca <4 x i8>, align 4 @@ -281,6 +293,7 @@ entry: ret i32 %0 } +; Function Attrs: define void @test.f_vec_tiny_v1i32(i32 %0) #0 { entry: %x = alloca <1 x i32>, align 4 @@ -291,6 +304,7 @@ entry: ret void } +; Function Attrs: define i32 @test.f_vec_tiny_v1i32_ret() #0 { entry: %taddr = alloca <1 x i32>, align 4 @@ -299,23 +313,23 @@ entry: ret i32 %0 } +; Function Attrs: define void @test.f_agg_small([2 x i32] %0) #0 { entry: %x = alloca %Small, align 4 store [2 x i32] %0, ptr %x, align 4 - %1 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - %3 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 - %4 = load ptr, ptr %3, align 4 - %5 = load i32, ptr %4, align 4 - %add = add i32 %2, %5 - store i32 %add, ptr %1, align 4 - %6 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 - %7 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 - store ptr %7, ptr %6, align 4 + %1 = load i32, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i32 4 + %2 = load ptr, ptr %ptradd, align 4 + %3 = load i32, ptr %2, align 4 + %add = add i32 %1, %3 + store i32 %add, ptr %x, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i32 4 + store ptr %x, ptr %ptradd1, align 4 ret void } +; Function Attrs: define [2 x i32] @test.f_agg_small_ret() #0 { entry: %literal = alloca %Small, align 4 @@ -324,6 +338,7 @@ entry: ret [2 x i32] %0 } +; Function Attrs: define void @test.f_vec_small_v8i8(i64 %0) #0 { entry: %x = alloca <8 x i8>, align 8 @@ -336,6 +351,7 @@ entry: ret void } +; Function Attrs: define i64 @test.f_vec_small_v8i8_ret() #0 { entry: %taddr = alloca <8 x i8>, align 8 @@ -344,6 +360,7 @@ entry: ret i64 %0 } +; Function Attrs: define void @test.f_vec_small_v1i64(i64 %0) #0 { entry: %x = alloca <1 x i64>, align 8 @@ -354,6 +371,7 @@ entry: ret void } +; Function Attrs: define i64 @test.f_vec_small_v1i64_ret() #0 { entry: %taddr = alloca <1 x i64>, align 8 @@ -362,19 +380,19 @@ entry: ret i64 %0 } +; Function Attrs: define void @test.f_agg_small_aligned(i64 %0) #0 { entry: %x = alloca %Small_aligned, align 8 store i64 %0, ptr %x, align 8 - %1 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 - %2 = load i64, ptr %1, align 8 - %3 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 - %4 = load i64, ptr %3, align 8 - %add = add i64 %2, %4 - store i64 %add, ptr %1, align 8 + %1 = load i64, ptr %x, align 8 + %2 = load i64, ptr %x, align 8 + %add = add i64 %1, %2 + store i64 %add, ptr %x, align 8 ret void } +; Function Attrs: define i64 @test.f_agg_small_aligned_ret(i64 %0) #0 { entry: %x = alloca %Small_aligned, align 8 @@ -385,21 +403,22 @@ entry: ret i64 %1 } +; Function Attrs: define void @test.f_agg_large(ptr align 4 %0) #0 { entry: - %1 = getelementptr inbounds %Large, ptr %0, i32 0, i32 0 - %2 = getelementptr inbounds %Large, ptr %0, i32 0, i32 1 - %3 = load i32, ptr %2, align 4 - %4 = getelementptr inbounds %Large, ptr %0, i32 0, i32 2 - %5 = load i32, ptr %4, align 4 - %add = add i32 %3, %5 - %6 = getelementptr inbounds %Large, ptr %0, i32 0, i32 3 - %7 = load i32, ptr %6, align 4 - %add1 = add i32 %add, %7 - store i32 %add1, ptr %1, align 4 + %ptradd = getelementptr inbounds i8, ptr %0, i32 4 + %1 = load i32, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %0, i32 8 + %2 = load i32, ptr %ptradd1, align 4 + %add = add i32 %1, %2 + %ptradd2 = getelementptr inbounds i8, ptr %0, i32 12 + %3 = load i32, ptr %ptradd2, align 4 + %add3 = add i32 %add, %3 + store i32 %add3, ptr %0, align 4 ret void } +; Function Attrs: define void @test.f_agg_large_ret(ptr noalias sret(%Large) align 4 %0, i32 %1, i8 signext %2) #0 { entry: %literal = alloca %Large, align 4 @@ -408,6 +427,7 @@ entry: ret void } +; Function Attrs: define void @test.f_vec_large_v16i8(ptr align 16 %0) #0 { entry: %1 = load <16 x i8>, ptr %0, align 16 @@ -418,12 +438,14 @@ entry: ret void } +; Function Attrs: define void @test.f_vec_large_v16i8_ret(ptr noalias sret(<16 x i8>) align 16 %0) #0 { entry: store <16 x i8> , ptr %0, align 16 ret void } +; Function Attrs: define i32 @test.f_scalar_stack_1(i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %3, i8 zeroext %4, i8 signext %5, i8 %6, i8 %7) #0 { entry: %a = alloca %Tiny, align 1 @@ -438,34 +460,37 @@ entry: ret i32 %add } +; Function Attrs: define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, i64 %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 4 - %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 - store i32 %1, ptr %8, align 4 - %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + store i32 %1, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %zext = zext i8 %5 to i32 - store i32 %zext, ptr %9, align 4 - %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + store i32 %zext, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i32 8 %sext = sext i8 %6 to i32 - store i32 %sext, ptr %10, align 4 - %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - %zext1 = zext i8 %7 to i32 - store i32 %zext1, ptr %11, align 4 + store i32 %sext, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i32 12 + %zext3 = zext i8 %7 to i32 + store i32 %zext3, ptr %ptradd2, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) ret void } +; Function Attrs: define fp128 @test.f_scalar_stack_4(i32 %0, i64 %1, i64 %2, fp128 %3, i8 zeroext %4, i8 %5, i8 %6) #0 { entry: ret fp128 %3 } +; Function Attrs: define void @test.f_scalar_stack_5(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) #0 { entry: ret void } +; Function Attrs: define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) #0 { entry: %e = alloca %Tiny, align 1 @@ -477,8 +502,10 @@ entry: ret void } +; Function Attrs: declare i32 @f_va_callee(i32, ...) #0 +; Function Attrs: define void @test.f_va_caller() #0 { entry: %literal = alloca %Tiny, align 1 diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t index 1c7dd14f9..7ec02c77e 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-2.c3t @@ -188,69 +188,68 @@ entry: ret i8 %0 } - +; Function Attrs: define zeroext i8 @test.f_scalar_2(i8 zeroext %0) #0 { entry: ret i8 %0 } - +; Function Attrs: define i32 @test.f_scalar_3(i32 %0) #0 { entry: ret i32 %0 } - +; Function Attrs: define i64 @test.f_scalar_4(i64 %0) #0 { entry: ret i64 %0 } - +; Function Attrs: define i128 @test.f_scalar_5(i128 %0) #0 { entry: ret i128 %0 } - +; Function Attrs: define float @test.f_fp_scalar_1(float %0) #0 { entry: ret float %0 } - +; Function Attrs: define double @test.f_fp_scalar_2(double %0) #0 { entry: ret double %0 } - +; Function Attrs: define fp128 @test.f_fp_scalar_3(fp128 %0) #0 { entry: ret fp128 %0 } - +; Function Attrs: define void @test.f_agg_tiny(i32 %0) #0 { entry: %x = alloca %Tiny, align 1 store i32 %0, ptr %x, align 1 - %1 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 0 - %2 = load i8, ptr %1, align 1 - %3 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 1 - %4 = load i8, ptr %3, align 1 - %add = add i8 %2, %4 - store i8 %add, ptr %1, align 1 - %5 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 2 - %6 = load i8, ptr %5, align 1 - %7 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 3 - %8 = load i8, ptr %7, align 1 - %add1 = add i8 %6, %8 - store i8 %add1, ptr %5, align 1 + %1 = load i8, ptr %x, align 1 + %ptradd = getelementptr inbounds i8, ptr %x, i32 1 + %2 = load i8, ptr %ptradd, align 1 + %add = add i8 %1, %2 + store i8 %add, ptr %x, align 1 + %ptradd1 = getelementptr inbounds i8, ptr %x, i32 2 + %3 = load i8, ptr %ptradd1, align 1 + %ptradd2 = getelementptr inbounds i8, ptr %x, i32 3 + %4 = load i8, ptr %ptradd2, align 1 + %add3 = add i8 %3, %4 + store i8 %add3, ptr %ptradd1, align 1 ret void } - +; Function Attrs: define i32 @test.f_agg_tiny_ret() #0 { entry: %literal = alloca %Tiny, align 1 @@ -259,7 +258,7 @@ entry: ret i32 %0 } - +; Function Attrs: define void @test.f_vec_tiny_v4i8(i32 %0) #0 { entry: %x = alloca <4 x i8>, align 4 @@ -277,7 +276,7 @@ entry: ret void } - +; Function Attrs: define i32 @test.f_vec_tiny_v4i8_ret() #0 { entry: %taddr = alloca <4 x i8>, align 4 @@ -286,7 +285,7 @@ entry: ret i32 %0 } - +; Function Attrs: define void @test.f_vec_tiny_v1i32(i32 %0) #0 { entry: %x = alloca <1 x i32>, align 4 @@ -297,7 +296,7 @@ entry: ret void } - +; Function Attrs: define i32 @test.f_vec_tiny_v1i32_ret() #0 { entry: %taddr = alloca <1 x i32>, align 4 @@ -306,25 +305,23 @@ entry: ret i32 %0 } - +; Function Attrs: define void @test.f_agg_small([2 x i32] %0) #0 { entry: %x = alloca %Small, align 4 store [2 x i32] %0, ptr %x, align 4 - %1 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - %3 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 - %4 = load ptr, ptr %3, align 4 - %5 = load i32, ptr %4, align 4 - %add = add i32 %2, %5 - store i32 %add, ptr %1, align 4 - %6 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 - %7 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 - store ptr %7, ptr %6, align 4 + %1 = load i32, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i32 4 + %2 = load ptr, ptr %ptradd, align 4 + %3 = load i32, ptr %2, align 4 + %add = add i32 %1, %3 + store i32 %add, ptr %x, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i32 4 + store ptr %x, ptr %ptradd1, align 4 ret void } - +; Function Attrs: define [2 x i32] @test.f_agg_small_ret() #0 { entry: %literal = alloca %Small, align 4 @@ -333,7 +330,7 @@ entry: ret [2 x i32] %0 } - +; Function Attrs: define void @test.f_vec_small_v8i8(i64 %0) #0 { entry: %x = alloca <8 x i8>, align 8 @@ -346,7 +343,7 @@ entry: ret void } - +; Function Attrs: define i64 @test.f_vec_small_v8i8_ret() #0 { entry: %taddr = alloca <8 x i8>, align 8 @@ -355,7 +352,7 @@ entry: ret i64 %0 } - +; Function Attrs: define void @test.f_vec_small_v1i64(i64 %0) #0 { entry: %x = alloca <1 x i64>, align 8 @@ -366,7 +363,7 @@ entry: ret void } - +; Function Attrs: define i64 @test.f_vec_small_v1i64_ret() #0 { entry: %taddr = alloca <1 x i64>, align 8 @@ -375,21 +372,19 @@ entry: ret i64 %0 } - +; Function Attrs: define void @test.f_agg_small_aligned(i64 %0) #0 { entry: %x = alloca %Small_aligned, align 8 store i64 %0, ptr %x, align 8 - %1 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 - %2 = load i64, ptr %1, align 8 - %3 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 - %4 = load i64, ptr %3, align 8 - %add = add i64 %2, %4 - store i64 %add, ptr %1, align 8 + %1 = load i64, ptr %x, align 8 + %2 = load i64, ptr %x, align 8 + %add = add i64 %1, %2 + store i64 %add, ptr %x, align 8 ret void } - +; Function Attrs: define i64 @test.f_agg_small_aligned_ret(i64 %0) #0 { entry: %x = alloca %Small_aligned, align 8 @@ -400,23 +395,22 @@ entry: ret i64 %1 } - +; Function Attrs: define void @test.f_agg_large(ptr align 4 %0) #0 { entry: - %1 = getelementptr inbounds %Large, ptr %0, i32 0, i32 0 - %2 = getelementptr inbounds %Large, ptr %0, i32 0, i32 1 - %3 = load i32, ptr %2, align 4 - %4 = getelementptr inbounds %Large, ptr %0, i32 0, i32 2 - %5 = load i32, ptr %4, align 4 - %add = add i32 %3, %5 - %6 = getelementptr inbounds %Large, ptr %0, i32 0, i32 3 - %7 = load i32, ptr %6, align 4 - %add1 = add i32 %add, %7 - store i32 %add1, ptr %1, align 4 + %ptradd = getelementptr inbounds i8, ptr %0, i32 4 + %1 = load i32, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %0, i32 8 + %2 = load i32, ptr %ptradd1, align 4 + %add = add i32 %1, %2 + %ptradd2 = getelementptr inbounds i8, ptr %0, i32 12 + %3 = load i32, ptr %ptradd2, align 4 + %add3 = add i32 %add, %3 + store i32 %add3, ptr %0, align 4 ret void } - +; Function Attrs: define void @test.f_agg_large_ret(ptr noalias sret(%Large) align 4 %0, i32 %1, i8 signext %2) #0 { entry: %literal = alloca %Large, align 4 @@ -425,7 +419,7 @@ entry: ret void } - +; Function Attrs: define void @test.f_vec_large_v16i8(ptr align 16 %0) #0 { entry: %1 = load <16 x i8>, ptr %0, align 16 @@ -436,14 +430,14 @@ entry: ret void } - +; Function Attrs: define void @test.f_vec_large_v16i8_ret(ptr noalias sret(<16 x i8>) align 16 %0) #0 { entry: store <16 x i8> , ptr %0, align 16 ret void } - +; Function Attrs: define i32 @test.f_scalar_stack_1(i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %3, i8 zeroext %4, i8 signext %5, i8 %6, i8 %7) #0 { entry: %a = alloca %Tiny, align 1 @@ -458,38 +452,37 @@ entry: ret i32 %add } - +; Function Attrs: define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, i64 %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 4 - %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 - store i32 %1, ptr %8, align 4 - %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + store i32 %1, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %zext = zext i8 %5 to i32 - store i32 %zext, ptr %9, align 4 - %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + store i32 %zext, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i32 8 %sext = sext i8 %6 to i32 - store i32 %sext, ptr %10, align 4 - %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - %zext1 = zext i8 %7 to i32 - store i32 %zext1, ptr %11, align 4 + store i32 %sext, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i32 12 + %zext3 = zext i8 %7 to i32 + store i32 %zext3, ptr %ptradd2, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) ret void } - +; Function Attrs: define fp128 @test.f_scalar_stack_4(i32 %0, i64 %1, i64 %2, fp128 %3, i8 zeroext %4, i8 %5, i8 %6) #0 { entry: ret fp128 %3 } - +; Function Attrs: define void @test.f_scalar_stack_5(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) #0 { entry: ret void } - +; Function Attrs: define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) #0 { entry: %e = alloca %Tiny, align 1 @@ -501,10 +494,10 @@ entry: ret void } - +; Function Attrs: declare i32 @f_va_callee(i32, ...) #0 - +; Function Attrs: define void @test.f_va_caller() #0 { entry: %literal = alloca %Tiny, align 1 diff --git a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t index 71428354e..063ea3af9 100644 --- a/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t +++ b/test/test_suite/abi/riscv32-ilp32-ilp32f-ilp32d-abi-3.c3t @@ -185,73 +185,80 @@ entry: ret void } +; Function Attrs: define zeroext i8 @test.f_scalar_0(i8 zeroext %0) #0 { entry: ret i8 %0 } +; Function Attrs: define signext i8 @test.f_scalar_1(i8 signext %0) #0 { entry: ret i8 %0 } +; Function Attrs: define zeroext i8 @test.f_scalar_2(i8 zeroext %0) #0 { entry: ret i8 %0 } +; Function Attrs: define i32 @test.f_scalar_3(i32 %0) #0 { entry: ret i32 %0 } +; Function Attrs: define i64 @test.f_scalar_4(i64 %0) #0 { entry: ret i64 %0 } +; Function Attrs: define i128 @test.f_scalar_5(i128 %0) #0 { entry: ret i128 %0 } +; Function Attrs: define float @test.f_fp_scalar_1(float %0) #0 { entry: ret float %0 } +; Function Attrs: define double @test.f_fp_scalar_2(double %0) #0 { entry: ret double %0 } - +; Function Attrs: define fp128 @test.f_fp_scalar_3(fp128 %0) #0 { entry: ret fp128 %0 } - +; Function Attrs: define void @test.f_agg_tiny(i32 %0) #0 { entry: %x = alloca %Tiny, align 1 store i32 %0, ptr %x, align 1 - %1 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 0 - %2 = load i8, ptr %1, align 1 - %3 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 1 - %4 = load i8, ptr %3, align 1 - %add = add i8 %2, %4 - store i8 %add, ptr %1, align 1 - %5 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 2 - %6 = load i8, ptr %5, align 1 - %7 = getelementptr inbounds %Tiny, ptr %x, i32 0, i32 3 - %8 = load i8, ptr %7, align 1 - %add1 = add i8 %6, %8 - store i8 %add1, ptr %5, align 1 + %1 = load i8, ptr %x, align 1 + %ptradd = getelementptr inbounds i8, ptr %x, i32 1 + %2 = load i8, ptr %ptradd, align 1 + %add = add i8 %1, %2 + store i8 %add, ptr %x, align 1 + %ptradd1 = getelementptr inbounds i8, ptr %x, i32 2 + %3 = load i8, ptr %ptradd1, align 1 + %ptradd2 = getelementptr inbounds i8, ptr %x, i32 3 + %4 = load i8, ptr %ptradd2, align 1 + %add3 = add i8 %3, %4 + store i8 %add3, ptr %ptradd1, align 1 ret void } - +; Function Attrs: define i32 @test.f_agg_tiny_ret() #0 { entry: %literal = alloca %Tiny, align 1 @@ -260,7 +267,7 @@ entry: ret i32 %0 } - +; Function Attrs: define void @test.f_vec_tiny_v4i8(i32 %0) #0 { entry: %x = alloca <4 x i8>, align 4 @@ -278,7 +285,7 @@ entry: ret void } - +; Function Attrs: define i32 @test.f_vec_tiny_v4i8_ret() #0 { entry: %taddr = alloca <4 x i8>, align 4 @@ -287,7 +294,7 @@ entry: ret i32 %0 } - +; Function Attrs: define void @test.f_vec_tiny_v1i32(i32 %0) #0 { entry: %x = alloca <1 x i32>, align 4 @@ -298,7 +305,7 @@ entry: ret void } - +; Function Attrs: define i32 @test.f_vec_tiny_v1i32_ret() #0 { entry: %taddr = alloca <1 x i32>, align 4 @@ -307,25 +314,23 @@ entry: ret i32 %0 } - +; Function Attrs: define void @test.f_agg_small([2 x i32] %0) #0 { entry: %x = alloca %Small, align 4 store [2 x i32] %0, ptr %x, align 4 - %1 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - %3 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 - %4 = load ptr, ptr %3, align 4 - %5 = load i32, ptr %4, align 4 - %add = add i32 %2, %5 - store i32 %add, ptr %1, align 4 - %6 = getelementptr inbounds %Small, ptr %x, i32 0, i32 1 - %7 = getelementptr inbounds %Small, ptr %x, i32 0, i32 0 - store ptr %7, ptr %6, align 4 + %1 = load i32, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i32 4 + %2 = load ptr, ptr %ptradd, align 4 + %3 = load i32, ptr %2, align 4 + %add = add i32 %1, %3 + store i32 %add, ptr %x, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i32 4 + store ptr %x, ptr %ptradd1, align 4 ret void } - +; Function Attrs: define [2 x i32] @test.f_agg_small_ret() #0 { entry: %literal = alloca %Small, align 4 @@ -334,7 +339,7 @@ entry: ret [2 x i32] %0 } - +; Function Attrs: define void @test.f_vec_small_v8i8(i64 %0) #0 { entry: %x = alloca <8 x i8>, align 8 @@ -347,7 +352,7 @@ entry: ret void } - +; Function Attrs: define i64 @test.f_vec_small_v8i8_ret() #0 { entry: %taddr = alloca <8 x i8>, align 8 @@ -356,7 +361,7 @@ entry: ret i64 %0 } - +; Function Attrs: define void @test.f_vec_small_v1i64(i64 %0) #0 { entry: %x = alloca <1 x i64>, align 8 @@ -367,7 +372,7 @@ entry: ret void } - +; Function Attrs: define i64 @test.f_vec_small_v1i64_ret() #0 { entry: %taddr = alloca <1 x i64>, align 8 @@ -376,21 +381,19 @@ entry: ret i64 %0 } - +; Function Attrs: define void @test.f_agg_small_aligned(i64 %0) #0 { entry: %x = alloca %Small_aligned, align 8 store i64 %0, ptr %x, align 8 - %1 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 - %2 = load i64, ptr %1, align 8 - %3 = getelementptr inbounds %Small_aligned, ptr %x, i32 0, i32 0 - %4 = load i64, ptr %3, align 8 - %add = add i64 %2, %4 - store i64 %add, ptr %1, align 8 + %1 = load i64, ptr %x, align 8 + %2 = load i64, ptr %x, align 8 + %add = add i64 %1, %2 + store i64 %add, ptr %x, align 8 ret void } - +; Function Attrs: define i64 @test.f_agg_small_aligned_ret(i64 %0) #0 { entry: %x = alloca %Small_aligned, align 8 @@ -401,23 +404,22 @@ entry: ret i64 %1 } - +; Function Attrs: define void @test.f_agg_large(ptr align 4 %0) #0 { entry: - %1 = getelementptr inbounds %Large, ptr %0, i32 0, i32 0 - %2 = getelementptr inbounds %Large, ptr %0, i32 0, i32 1 - %3 = load i32, ptr %2, align 4 - %4 = getelementptr inbounds %Large, ptr %0, i32 0, i32 2 - %5 = load i32, ptr %4, align 4 - %add = add i32 %3, %5 - %6 = getelementptr inbounds %Large, ptr %0, i32 0, i32 3 - %7 = load i32, ptr %6, align 4 - %add1 = add i32 %add, %7 - store i32 %add1, ptr %1, align 4 + %ptradd = getelementptr inbounds i8, ptr %0, i32 4 + %1 = load i32, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %0, i32 8 + %2 = load i32, ptr %ptradd1, align 4 + %add = add i32 %1, %2 + %ptradd2 = getelementptr inbounds i8, ptr %0, i32 12 + %3 = load i32, ptr %ptradd2, align 4 + %add3 = add i32 %add, %3 + store i32 %add3, ptr %0, align 4 ret void } - +; Function Attrs: define void @test.f_agg_large_ret(ptr noalias sret(%Large) align 4 %0, i32 %1, i8 signext %2) #0 { entry: %literal = alloca %Large, align 4 @@ -426,7 +428,7 @@ entry: ret void } - +; Function Attrs: define void @test.f_vec_large_v16i8(ptr align 16 %0) #0 { entry: %1 = load <16 x i8>, ptr %0, align 16 @@ -437,14 +439,14 @@ entry: ret void } - +; Function Attrs: define void @test.f_vec_large_v16i8_ret(ptr noalias sret(<16 x i8>) align 16 %0) #0 { entry: store <16 x i8> , ptr %0, align 16 ret void } - +; Function Attrs: define i32 @test.f_scalar_stack_1(i32 %0, [2 x i32] %1, i64 %2, ptr align 4 %3, i8 zeroext %4, i8 signext %5, i8 %6, i8 %7) #0 { entry: %a = alloca %Tiny, align 1 @@ -459,38 +461,37 @@ entry: ret i32 %add } - +; Function Attrs: define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 4 %0, i32 %1, i64 %2, i64 %3, fp128 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 4 - %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 - store i32 %1, ptr %8, align 4 - %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + store i32 %1, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %zext = zext i8 %5 to i32 - store i32 %zext, ptr %9, align 4 - %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + store i32 %zext, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i32 8 %sext = sext i8 %6 to i32 - store i32 %sext, ptr %10, align 4 - %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - %zext1 = zext i8 %7 to i32 - store i32 %zext1, ptr %11, align 4 + store i32 %sext, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i32 12 + %zext3 = zext i8 %7 to i32 + store i32 %zext3, ptr %ptradd2, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 16, i1 false) ret void } - +; Function Attrs: define fp128 @test.f_scalar_stack_4(i32 %0, i64 %1, i64 %2, fp128 %3, i8 zeroext %4, i8 %5, i8 %6) #0 { entry: ret fp128 %3 } - +; Function Attrs: define void @test.f_scalar_stack_5(double %0, i64 %1, double %2, i64 %3, i32 %4, i64 %5, float %6, double %7, fp128 %8) #0 { entry: ret void } - +; Function Attrs: define void @test.f_agg_stack(double %0, i64 %1, double %2, i64 %3, i32 %4, [2 x i32] %5, i64 %6, ptr align 4 %7) #0 { entry: %e = alloca %Tiny, align 1 @@ -502,10 +503,10 @@ entry: ret void } - +; Function Attrs: declare i32 @f_va_callee(i32, ...) #0 - +; Function Attrs: define void @test.f_va_caller() #0 { entry: %literal = alloca %Tiny, align 1 diff --git a/test/test_suite/abi/riscv32-ilp32d-abi.c3t b/test/test_suite/abi/riscv32-ilp32d-abi.c3t index dd247f639..e696a4994 100644 --- a/test/test_suite/abi/riscv32-ilp32d-abi.c3t +++ b/test/test_suite/abi/riscv32-ilp32d-abi.c3t @@ -202,7 +202,7 @@ define void @test.f_double_double_s_arg(double %0, double %1) #0 { entry: %a = alloca %Double_double_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds double, ptr %a, i32 1 + %ptradd = getelementptr inbounds i8, ptr %a, i32 8 store double %1, ptr %a, align 8 ret void } @@ -213,7 +213,7 @@ entry: %literal = alloca %Double_double_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.1, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds double, ptr %literal, i32 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 8 %1 = load double, ptr %literal, align 8 %2 = insertvalue { double, double } undef, double %0, 0 %3 = insertvalue { double, double } %2, double %1, 1 @@ -225,7 +225,7 @@ define void @test.f_double_float_s_arg(double %0, float %1) #0 { entry: %a = alloca %Double_float_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds float, ptr %a, i32 2 + %ptradd = getelementptr inbounds i8, ptr %a, i32 8 store float %1, ptr %a, align 8 ret void } @@ -236,7 +236,7 @@ entry: %literal = alloca %Double_float_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds float, ptr %literal, i32 2 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 8 %1 = load float, ptr %literal, align 8 %2 = insertvalue { double, float } undef, double %0, 0 %3 = insertvalue { double, float } %2, float %1, 1 @@ -254,7 +254,7 @@ define void @test.f_double_int8_s_arg(double %0, i8 %1) #0 { entry: %a = alloca %Double_int8_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i8, ptr %a, i32 8 + %ptradd = getelementptr inbounds i8, ptr %a, i32 8 store i8 %1, ptr %a, align 8 ret void } @@ -265,7 +265,7 @@ entry: %literal = alloca %Double_int8_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.3, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds i8, ptr %literal, i32 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 8 %1 = load i8, ptr %literal, align 8 %2 = insertvalue { double, i8 } undef, double %0, 0 %3 = insertvalue { double, i8 } %2, i8 %1, 1 @@ -277,7 +277,7 @@ define void @test.f_double_uint8_s_arg(double %0, i8 %1) #0 { entry: %a = alloca %Double_uint8_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i8, ptr %a, i32 8 + %ptradd = getelementptr inbounds i8, ptr %a, i32 8 store i8 %1, ptr %a, align 8 ret void } @@ -288,7 +288,7 @@ entry: %literal = alloca %Double_uint8_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.4, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds i8, ptr %literal, i32 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 8 %1 = load i8, ptr %literal, align 8 %2 = insertvalue { double, i8 } undef, double %0, 0 %3 = insertvalue { double, i8 } %2, i8 %1, 1 @@ -300,7 +300,7 @@ define void @test.f_double_int32_s_arg(double %0, i32 %1) #0 { entry: %a = alloca %Double_int32_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i32, ptr %a, i32 2 + %ptradd = getelementptr inbounds i8, ptr %a, i32 8 store i32 %1, ptr %a, align 8 ret void } @@ -311,7 +311,7 @@ entry: %literal = alloca %Double_int32_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.5, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds i32, ptr %literal, i32 2 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 8 %1 = load i32, ptr %literal, align 8 %2 = insertvalue { double, i32 } undef, double %0, 0 %3 = insertvalue { double, i32 } %2, i32 %1, 1 @@ -367,7 +367,7 @@ define void @test.f_doublearr2_s_arg(double %0, double %1) #0 { entry: %a = alloca %Doublearr2_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds double, ptr %a, i32 1 + %ptradd = getelementptr inbounds i8, ptr %a, i32 8 store double %1, ptr %a, align 8 ret void } @@ -378,7 +378,7 @@ entry: %literal = alloca %Doublearr2_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.8, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds double, ptr %literal, i32 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 8 %1 = load double, ptr %literal, align 8 %2 = insertvalue { double, double } undef, double %0, 0 %3 = insertvalue { double, double } %2, double %1, 1 @@ -390,7 +390,7 @@ define void @test.f_doublearr2_tricky1_s_arg(double %0, double %1) #0 { entry: %a = alloca %Doublearr2_tricky1_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds double, ptr %a, i32 1 + %ptradd = getelementptr inbounds i8, ptr %a, i32 8 store double %1, ptr %a, align 8 ret void } @@ -401,7 +401,7 @@ entry: %literal = alloca %Doublearr2_tricky1_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.9, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds double, ptr %literal, i32 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 8 %1 = load double, ptr %literal, align 8 %2 = insertvalue { double, double } undef, double %0, 0 %3 = insertvalue { double, double } %2, double %1, 1 @@ -476,11 +476,11 @@ entry: %h = alloca %Double_int32_s, align 8 %literal = alloca %Double_int32_s, align 8 store double %7, ptr %h, align 8 - %ptroffset = getelementptr inbounds i32, ptr %h, i32 2 + %ptradd = getelementptr inbounds i8, ptr %h, i32 8 store i32 %8, ptr %h, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.14, i32 16, i1 false) %9 = load double, ptr %literal, align 8 - %ptroffset1 = getelementptr inbounds i32, ptr %literal, i32 2 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i32 8 %10 = load i32, ptr %literal, align 8 %11 = insertvalue { double, i32 } undef, double %9, 0 %12 = insertvalue { double, i32 } %11, i32 %10, 1 @@ -493,11 +493,11 @@ entry: %h = alloca %Double_int32_s, align 8 %literal = alloca %Double_double_s, align 8 store double %7, ptr %h, align 8 - %ptroffset = getelementptr inbounds i32, ptr %h, i32 2 + %ptradd = getelementptr inbounds i8, ptr %h, i32 8 store i32 %8, ptr %h, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.15, i32 16, i1 false) %9 = load double, ptr %literal, align 8 - %ptroffset1 = getelementptr inbounds double, ptr %literal, i32 1 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i32 8 %10 = load double, ptr %literal, align 8 %11 = insertvalue { double, double } undef, double %9, 0 %12 = insertvalue { double, double } %11, double %10, 1 diff --git a/test/test_suite/abi/riscv32-ilp32f-ilp32d-abi-2.c3t b/test/test_suite/abi/riscv32-ilp32f-ilp32d-abi-2.c3t index 958fbf327..29668b915 100644 --- a/test/test_suite/abi/riscv32-ilp32f-ilp32d-abi-2.c3t +++ b/test/test_suite/abi/riscv32-ilp32f-ilp32d-abi-2.c3t @@ -177,7 +177,7 @@ define void @test.f_float_float_s_arg(float %0, float %1) #0 { entry: %a = alloca %Float_float_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds float, ptr %a, i32 1 + %ptradd = getelementptr inbounds i8, ptr %a, i32 4 store float %1, ptr %a, align 4 ret void } @@ -187,7 +187,7 @@ entry: %literal = alloca %Float_float_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds float, ptr %literal, i32 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %1 = load float, ptr %literal, align 4 %2 = insertvalue { float, float } undef, float %0, 0 %3 = insertvalue { float, float } %2, float %1, 1 @@ -207,7 +207,7 @@ define void @test.f_float_int8_s_arg(float %0, i8 %1) #0 { entry: %a = alloca %Float_int8_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds i8, ptr %a, i32 4 + %ptradd = getelementptr inbounds i8, ptr %a, i32 4 store i8 %1, ptr %a, align 4 ret void } @@ -218,7 +218,7 @@ entry: %literal = alloca %Float_int8_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.2, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds i8, ptr %literal, i32 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %1 = load i8, ptr %literal, align 4 %2 = insertvalue { float, i8 } undef, float %0, 0 %3 = insertvalue { float, i8 } %2, i8 %1, 1 @@ -230,7 +230,7 @@ define void @test.f_float_uint8_s_arg(float %0, i8 %1) #0 { entry: %a = alloca %Float_uint8_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds i8, ptr %a, i32 4 + %ptradd = getelementptr inbounds i8, ptr %a, i32 4 store i8 %1, ptr %a, align 4 ret void } @@ -241,7 +241,7 @@ entry: %literal = alloca %Float_uint8_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.3, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds i8, ptr %literal, i32 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %1 = load i8, ptr %literal, align 4 %2 = insertvalue { float, i8 } undef, float %0, 0 %3 = insertvalue { float, i8 } %2, i8 %1, 1 @@ -253,7 +253,7 @@ define void @test.f_float_int32_s_arg(float %0, i32 %1) #0 { entry: %a = alloca %Float_int32_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds i32, ptr %a, i32 1 + %ptradd = getelementptr inbounds i8, ptr %a, i32 4 store i32 %1, ptr %a, align 4 ret void } @@ -264,7 +264,7 @@ entry: %literal = alloca %Float_int32_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.4, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds i32, ptr %literal, i32 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %1 = load i32, ptr %literal, align 4 %2 = insertvalue { float, i32 } undef, float %0, 0 %3 = insertvalue { float, i32 } %2, i32 %1, 1 @@ -324,7 +324,7 @@ define void @test.f_floatarr2_s_arg(float %0, float %1) #0 { entry: %a = alloca %Floatarr2_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds float, ptr %a, i32 1 + %ptradd = getelementptr inbounds i8, ptr %a, i32 4 store float %1, ptr %a, align 4 ret void } @@ -335,7 +335,7 @@ entry: %literal = alloca %Floatarr2_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.7, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds float, ptr %literal, i32 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %1 = load float, ptr %literal, align 4 %2 = insertvalue { float, float } undef, float %0, 0 %3 = insertvalue { float, float } %2, float %1, 1 @@ -347,7 +347,7 @@ define void @test.f_floatarr2_tricky1_s_arg(float %0, float %1) #0 { entry: %a = alloca %Floatarr2_tricky1_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds float, ptr %a, i32 1 + %ptradd = getelementptr inbounds i8, ptr %a, i32 4 store float %1, ptr %a, align 4 ret void } @@ -358,7 +358,7 @@ entry: %literal = alloca %Floatarr2_tricky1_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.8, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds float, ptr %literal, i32 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 %1 = load float, ptr %literal, align 4 %2 = insertvalue { float, float } undef, float %0, 0 %3 = insertvalue { float, float } %2, float %1, 1 diff --git a/test/test_suite/abi/riscv64-lp64-abi.c3t b/test/test_suite/abi/riscv64-lp64-abi.c3t index 21578c008..cac4953fe 100644 --- a/test/test_suite/abi/riscv64-lp64-abi.c3t +++ b/test/test_suite/abi/riscv64-lp64-abi.c3t @@ -26,20 +26,20 @@ entry: %add = add i32 %zext, %zext1 ret i32 %add -define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 8 %0, double %1, i128 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) +; Function Attrs: +define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 8 %0, double %1, i128 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 8 - %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 %fpsi = fptosi double %1 to i64 - store i64 %fpsi, ptr %8, align 8 - %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + store i64 %fpsi, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %zext = zext i8 %5 to i64 - store i64 %zext, ptr %9, align 8 - %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + store i64 %zext, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i64 16 %sext = sext i8 %6 to i64 - store i64 %sext, ptr %10, align 8 - %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - %zext1 = zext i8 %7 to i64 - store i64 %zext1, ptr %11, align 8 + store i64 %sext, ptr %ptradd1, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i64 24 + %zext3 = zext i8 %7 to i64 + store i64 %zext3, ptr %ptradd2, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 32, i1 false) ret void diff --git a/test/test_suite/abi/riscv64-lp64-lp64f-abi-1.c3t b/test/test_suite/abi/riscv64-lp64-lp64f-abi-1.c3t index e2a2bec11..bd0ea226d 100644 --- a/test/test_suite/abi/riscv64-lp64-lp64f-abi-1.c3t +++ b/test/test_suite/abi/riscv64-lp64-lp64f-abi-1.c3t @@ -31,21 +31,21 @@ entry: ret i32 %add } +; Function Attrs: define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 8 %0, double %1, i128 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 8 - %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 %fpsi = fptosi double %1 to i64 - store i64 %fpsi, ptr %8, align 8 - %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + store i64 %fpsi, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %zext = zext i8 %5 to i64 - store i64 %zext, ptr %9, align 8 - %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + store i64 %zext, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i64 16 %sext = sext i8 %6 to i64 - store i64 %sext, ptr %10, align 8 - %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - %zext1 = zext i8 %7 to i64 - store i64 %zext1, ptr %11, align 8 + store i64 %sext, ptr %ptradd1, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i64 24 + %zext3 = zext i8 %7 to i64 + store i64 %zext3, ptr %ptradd2, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 32, i1 false) ret void } \ No newline at end of file diff --git a/test/test_suite/abi/riscv64-lp64-lp64f-abi-2.c3t b/test/test_suite/abi/riscv64-lp64-lp64f-abi-2.c3t index 48742faa1..d77e6f5bd 100644 --- a/test/test_suite/abi/riscv64-lp64-lp64f-abi-2.c3t +++ b/test/test_suite/abi/riscv64-lp64-lp64f-abi-2.c3t @@ -32,21 +32,21 @@ entry: ret i32 %add } +; Function Attrs: define void @test.f_scalar_stack_2(ptr noalias sret(%Large) align 8 %0, double %1, i128 %2, fp128 %3, ptr align 32 %4, i8 zeroext %5, i8 %6, i8 %7) #0 { entry: %literal = alloca %Large, align 8 - %8 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 0 %fpsi = fptosi double %1 to i64 - store i64 %fpsi, ptr %8, align 8 - %9 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 1 + store i64 %fpsi, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %zext = zext i8 %5 to i64 - store i64 %zext, ptr %9, align 8 - %10 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 2 + store i64 %zext, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i64 16 %sext = sext i8 %6 to i64 - store i64 %sext, ptr %10, align 8 - %11 = getelementptr inbounds %Large, ptr %literal, i32 0, i32 3 - %zext1 = zext i8 %7 to i64 - store i64 %zext1, ptr %11, align 8 + store i64 %sext, ptr %ptradd1, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i64 24 + %zext3 = zext i8 %7 to i64 + store i64 %zext3, ptr %ptradd2, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 32, i1 false) ret void } \ No newline at end of file diff --git a/test/test_suite/abi/riscv64-lp64d-abi.c3t b/test/test_suite/abi/riscv64-lp64d-abi.c3t index 78d2b47aa..fdbb448bd 100644 --- a/test/test_suite/abi/riscv64-lp64d-abi.c3t +++ b/test/test_suite/abi/riscv64-lp64d-abi.c3t @@ -180,7 +180,7 @@ define void @test.f_double_double_s_arg(double %0, double %1) #0 { entry: %a = alloca %Double_double_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds double, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store double %1, ptr %a, align 8 ret void } @@ -191,7 +191,7 @@ entry: %literal = alloca %Double_double_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.1, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds double, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load double, ptr %literal, align 8 %2 = insertvalue { double, double } undef, double %0, 0 %3 = insertvalue { double, double } %2, double %1, 1 @@ -203,7 +203,7 @@ define void @test.f_double_float_s_arg(double %0, float %1) #0 { entry: %a = alloca %Double_float_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds float, ptr %a, i64 2 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store float %1, ptr %a, align 8 ret void } @@ -214,7 +214,7 @@ entry: %literal = alloca %Double_float_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.2, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds float, ptr %literal, i64 2 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load float, ptr %literal, align 8 %2 = insertvalue { double, float } undef, double %0, 0 %3 = insertvalue { double, float } %2, float %1, 1 @@ -234,7 +234,7 @@ define void @test.f_double_int8_s_arg(double %0, i8 %1) #0 { entry: %a = alloca %Double_int8_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i8, ptr %a, i64 8 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store i8 %1, ptr %a, align 8 ret void } @@ -245,7 +245,7 @@ entry: %literal = alloca %Double_int8_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.3, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds i8, ptr %literal, i64 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load i8, ptr %literal, align 8 %2 = insertvalue { double, i8 } undef, double %0, 0 %3 = insertvalue { double, i8 } %2, i8 %1, 1 @@ -257,7 +257,7 @@ define void @test.f_double_uint8_s_arg(double %0, i8 %1) #0 { entry: %a = alloca %Double_uint8_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i8, ptr %a, i64 8 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store i8 %1, ptr %a, align 8 ret void } @@ -268,7 +268,7 @@ entry: %literal = alloca %Double_uint8_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.4, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds i8, ptr %literal, i64 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load i8, ptr %literal, align 8 %2 = insertvalue { double, i8 } undef, double %0, 0 %3 = insertvalue { double, i8 } %2, i8 %1, 1 @@ -280,7 +280,7 @@ define void @test.f_double_int32_s_arg(double %0, i32 %1) #0 { entry: %a = alloca %Double_int32_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i32, ptr %a, i64 2 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store i32 %1, ptr %a, align 8 ret void } @@ -291,7 +291,7 @@ entry: %literal = alloca %Double_int32_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.5, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds i32, ptr %literal, i64 2 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load i32, ptr %literal, align 8 %2 = insertvalue { double, i32 } undef, double %0, 0 %3 = insertvalue { double, i32 } %2, i32 %1, 1 @@ -303,7 +303,7 @@ define void @test.f_double_int64_s_arg(double %0, i64 %1) #0 { entry: %a = alloca %Double_int64_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i64, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store i64 %1, ptr %a, align 8 ret void } @@ -314,7 +314,7 @@ entry: %literal = alloca %Double_int64_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.6, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds i64, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load i64, ptr %literal, align 8 %2 = insertvalue { double, i64 } undef, double %0, 0 %3 = insertvalue { double, i64 } %2, i64 %1, 1 @@ -359,7 +359,7 @@ define void @test.f_doublearr2_s_arg(double %0, double %1) #0 { entry: %a = alloca %Doublearr2_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds double, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store double %1, ptr %a, align 8 ret void } @@ -370,7 +370,7 @@ entry: %literal = alloca %Doublearr2_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.8, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds double, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load double, ptr %literal, align 8 %2 = insertvalue { double, double } undef, double %0, 0 %3 = insertvalue { double, double } %2, double %1, 1 @@ -382,7 +382,7 @@ define void @test.f_doublearr2_tricky1_s_arg(double %0, double %1) #0 { entry: %a = alloca %Doublearr2_tricky1_s, align 8 store double %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds double, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store double %1, ptr %a, align 8 ret void } @@ -393,7 +393,7 @@ entry: %literal = alloca %Doublearr2_tricky1_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.9, i32 16, i1 false) %0 = load double, ptr %literal, align 8 - %ptroffset = getelementptr inbounds double, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load double, ptr %literal, align 8 %2 = insertvalue { double, double } undef, double %0, 0 %3 = insertvalue { double, double } %2, double %1, 1 diff --git a/test/test_suite/abi/riscv64-lp64f-lp64d-abi-2.c3t b/test/test_suite/abi/riscv64-lp64f-lp64d-abi-2.c3t index bba2af3f3..be6f8280e 100644 --- a/test/test_suite/abi/riscv64-lp64f-lp64d-abi-2.c3t +++ b/test/test_suite/abi/riscv64-lp64f-lp64d-abi-2.c3t @@ -158,7 +158,7 @@ define void @test.f_float_float_s_arg(float %0, float %1) #0 { entry: %a = alloca %Float_float_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds float, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 4 store float %1, ptr %a, align 4 ret void } @@ -169,7 +169,7 @@ entry: %literal = alloca %Float_float_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds float, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 %1 = load float, ptr %literal, align 4 %2 = insertvalue { float, float } undef, float %0, 0 %3 = insertvalue { float, float } %2, float %1, 1 @@ -189,7 +189,7 @@ define void @test.f_float_int8_s_arg(float %0, i8 %1) #0 { entry: %a = alloca %Float_int8_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds i8, ptr %a, i64 4 + %ptradd = getelementptr inbounds i8, ptr %a, i64 4 store i8 %1, ptr %a, align 4 ret void } @@ -200,7 +200,7 @@ entry: %literal = alloca %Float_int8_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.2, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds i8, ptr %literal, i64 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 %1 = load i8, ptr %literal, align 4 %2 = insertvalue { float, i8 } undef, float %0, 0 %3 = insertvalue { float, i8 } %2, i8 %1, 1 @@ -212,7 +212,7 @@ define void @test.f_float_uint8_s_arg(float %0, i8 %1) #0 { entry: %a = alloca %Float_uint8_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds i8, ptr %a, i64 4 + %ptradd = getelementptr inbounds i8, ptr %a, i64 4 store i8 %1, ptr %a, align 4 ret void } @@ -223,7 +223,7 @@ entry: %literal = alloca %Float_uint8_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.3, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds i8, ptr %literal, i64 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 %1 = load i8, ptr %literal, align 4 %2 = insertvalue { float, i8 } undef, float %0, 0 %3 = insertvalue { float, i8 } %2, i8 %1, 1 @@ -235,7 +235,7 @@ define void @test.f_float_int32_s_arg(float %0, i32 %1) #0 { entry: %a = alloca %Float_int32_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds i32, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 4 store i32 %1, ptr %a, align 4 ret void } @@ -246,7 +246,7 @@ entry: %literal = alloca %Float_int32_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.4, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds i32, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 %1 = load i32, ptr %literal, align 4 %2 = insertvalue { float, i32 } undef, float %0, 0 %3 = insertvalue { float, i32 } %2, i32 %1, 1 @@ -258,7 +258,7 @@ define void @test.f_float_int64_s_arg(float %0, i64 %1) #0 { entry: %a = alloca %Float_int64_s, align 8 store float %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i64, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 store i64 %1, ptr %a, align 8 ret void } @@ -269,7 +269,7 @@ entry: %literal = alloca %Float_int64_s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.5, i32 16, i1 false) %0 = load float, ptr %literal, align 8 - %ptroffset = getelementptr inbounds i64, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 %1 = load i64, ptr %literal, align 8 %2 = insertvalue { float, i64 } undef, float %0, 0 %3 = insertvalue { float, i64 } %2, i64 %1, 1 @@ -314,7 +314,7 @@ define void @test.f_floatarr2_s_arg(float %0, float %1) #0 { entry: %a = alloca %Floatarr2_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds float, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 4 store float %1, ptr %a, align 4 ret void } @@ -325,7 +325,7 @@ entry: %literal = alloca %Floatarr2_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.7, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds float, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 %1 = load float, ptr %literal, align 4 %2 = insertvalue { float, float } undef, float %0, 0 %3 = insertvalue { float, float } %2, float %1, 1 @@ -337,7 +337,7 @@ define void @test.f_floatarr2_tricky1_s_arg(float %0, float %1) #0 { entry: %a = alloca %Floatarr2_tricky1_s, align 4 store float %0, ptr %a, align 4 - %ptroffset = getelementptr inbounds float, ptr %a, i64 1 + %ptradd = getelementptr inbounds i8, ptr %a, i64 4 store float %1, ptr %a, align 4 ret void } @@ -348,7 +348,7 @@ entry: %literal = alloca %Floatarr2_tricky1_s, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.8, i32 8, i1 false) %0 = load float, ptr %literal, align 4 - %ptroffset = getelementptr inbounds float, ptr %literal, i64 1 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 %1 = load float, ptr %literal, align 4 %2 = insertvalue { float, float } undef, float %0, 0 %3 = insertvalue { float, float } %2, float %1, 1 diff --git a/test/test_suite/abi/small_struct_x64.c3t b/test/test_suite/abi/small_struct_x64.c3t index 292530165..984c6b2fc 100644 --- a/test/test_suite/abi/small_struct_x64.c3t +++ b/test/test_suite/abi/small_struct_x64.c3t @@ -25,7 +25,7 @@ fn Foo getFoo(Foo f) @"$ct.test.Foo" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 3, i64 0, i64 3, [0 x i64] zeroinitializer }, align 8 - +; Function Attrs: define i32 @test.testing() #0 { entry: %y = alloca %Foo, align 1 @@ -40,17 +40,16 @@ entry: store i24 %1, ptr %tempcoerce1, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %result, ptr align 4 %tempcoerce1, i32 3, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 %result, i32 3, i1 false) - %2 = getelementptr inbounds %Foo, ptr %y, i32 0, i32 0 - %3 = load i8, ptr %2, align 1 - %zext = zext i8 %3 to i32 - %4 = getelementptr inbounds %Foo, ptr %y, i32 0, i32 2 - %5 = load i8, ptr %4, align 1 - %zext2 = zext i8 %5 to i32 + %2 = load i8, ptr %y, align 1 + %zext = zext i8 %2 to i32 + %ptradd = getelementptr inbounds i8, ptr %y, i64 2 + %3 = load i8, ptr %ptradd, align 1 + %zext2 = zext i8 %3 to i32 %add = add i32 %zext, %zext2 ret i32 %add } - +; Function Attrs: define i24 @test.getFoo(i24 %0) #0 { entry: %f = alloca %Foo, align 1 diff --git a/test/test_suite/abi/sysv_direct_coerce.c3t b/test/test_suite/abi/sysv_direct_coerce.c3t index dfe30f64e..ab532c968 100644 --- a/test/test_suite/abi/sysv_direct_coerce.c3t +++ b/test/test_suite/abi/sysv_direct_coerce.c3t @@ -22,14 +22,13 @@ entry: %literal = alloca %Rectangle, align 4 %coerce = alloca %Rectangle, align 8 store <2 x float> %0, ptr %r, align 8 - %ptroffset = getelementptr inbounds <2 x float>, ptr %r, i64 1 - store <2 x float> %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %r, i64 8 + store <2 x float> %1, ptr %ptradd, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %coerce, ptr align 4 %literal, i32 16, i1 false) - %2 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %coerce, i32 0, i32 0 - %lo = load <2 x float>, ptr %2, align 8 - %3 = getelementptr inbounds { <2 x float>, <2 x float> }, ptr %coerce, i32 0, i32 1 - %hi = load <2 x float>, ptr %3, align 8 + %lo = load <2 x float>, ptr %coerce, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %coerce, i64 8 + %hi = load <2 x float>, ptr %ptradd1, align 8 call void @foo.test(<2 x float> %lo, <2 x float> %hi) ret void } \ No newline at end of file diff --git a/test/test_suite/abi/union_x64.c3t b/test/test_suite/abi/union_x64.c3t index c5bf6be56..b598969f4 100644 --- a/test/test_suite/abi/union_x64.c3t +++ b/test/test_suite/abi/union_x64.c3t @@ -20,16 +20,16 @@ fn void hello(Foo f) declare void @hello2(i64, i64) #0 +; Function Attrs: define void @unionx64.hello(i64 %0, i64 %1) #0 { entry: %f = alloca %Foo, align 8 store i64 %0, ptr %f, align 8 - %ptroffset = getelementptr inbounds i64, ptr %f, i64 1 - store i64 %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds { i64, i64 }, ptr %f, i32 0, i32 0 - %lo = load i64, ptr %2, align 8 - %3 = getelementptr inbounds { i64, i64 }, ptr %f, i32 0, i32 1 - %hi = load i64, ptr %3, align 8 + %ptradd = getelementptr inbounds i8, ptr %f, i64 8 + store i64 %1, ptr %ptradd, align 8 + %lo = load i64, ptr %f, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %f, i64 8 + %hi = load i64, ptr %ptradd1, align 8 call void @hello2(i64 %lo, i64 %hi) ret void } diff --git a/test/test_suite/abi/vec2_aarch64.c3t b/test/test_suite/abi/vec2_aarch64.c3t index 3e98933f6..47603cade 100644 --- a/test/test_suite/abi/vec2_aarch64.c3t +++ b/test/test_suite/abi/vec2_aarch64.c3t @@ -20,25 +20,25 @@ fn Vector2 vector2_subtract_value(Vector2 v, float sub) @extern("vector2_subtrac define %Vector2 @vector2_zero() #0 { entry: %literal = alloca %Vector2, align 4 - %0 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %1, align 4 - %2 = load %Vector2, ptr %literal, align 4 - ret %Vector2 %2 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %0 = load %Vector2, ptr %literal, align 4 + ret %Vector2 %0 } +; Function Attrs: define %Vector2 @vector2_one() #0 { entry: %literal = alloca %Vector2, align 4 - %0 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %1, align 4 - %2 = load %Vector2, ptr %literal, align 4 - ret %Vector2 %2 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %0 = load %Vector2, ptr %literal, align 4 + ret %Vector2 %0 } +; Function Attrs: define %Vector2 @vector2_add([2 x float] %0, [2 x float] %1) #0 { entry: %v1 = alloca %Vector2, align 4 @@ -46,27 +46,27 @@ entry: %literal = alloca %Vector2, align 4 store [2 x float] %0, ptr %v1, align 4 store [2 x float] %1, ptr %v2, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %3, align 4 - %4 = load %Vector2, ptr %literal, align 4 - ret %Vector2 %4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %2 = load %Vector2, ptr %literal, align 4 + ret %Vector2 %2 } +; Function Attrs: define %Vector2 @vector2_add_value([2 x float] %0, float %1) #0 { entry: %v = alloca %Vector2, align 4 %literal = alloca %Vector2, align 4 store [2 x float] %0, ptr %v, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %3, align 4 - %4 = load %Vector2, ptr %literal, align 4 - ret %Vector2 %4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %2 = load %Vector2, ptr %literal, align 4 + ret %Vector2 %2 } +; Function Attrs: define %Vector2 @vector2_subtract([2 x float] %0, [2 x float] %1) #0 { entry: %v1 = alloca %Vector2, align 4 @@ -74,23 +74,22 @@ entry: %literal = alloca %Vector2, align 4 store [2 x float] %0, ptr %v1, align 4 store [2 x float] %1, ptr %v2, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %3, align 4 - %4 = load %Vector2, ptr %literal, align 4 - ret %Vector2 %4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %2 = load %Vector2, ptr %literal, align 4 + ret %Vector2 %2 } +; Function Attrs: define %Vector2 @vector2_subtract_value([2 x float] %0, float %1) #0 { entry: %v = alloca %Vector2, align 4 %literal = alloca %Vector2, align 4 store [2 x float] %0, ptr %v, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %3, align 4 - %4 = load %Vector2, ptr %literal, align 4 - ret %Vector2 %4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %2 = load %Vector2, ptr %literal, align 4 + ret %Vector2 %2 } diff --git a/test/test_suite/abi/vec2_wasm.c3t b/test/test_suite/abi/vec2_wasm.c3t index 4e77717f9..d22fda662 100644 --- a/test/test_suite/abi/vec2_wasm.c3t +++ b/test/test_suite/abi/vec2_wasm.c3t @@ -21,65 +21,64 @@ target triple = "wasm32-unknown-unknown" define void @vector2_zero(ptr noalias sret(%Vector2) align 4 %0) #0 { entry: %literal = alloca %Vector2, align 4 - %1 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %1, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %2, align 4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 + store float 0.000000e+00, ptr %ptradd, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 8, i1 false) ret void } +; Function Attrs: define void @vector2_one(ptr noalias sret(%Vector2) align 4 %0) #0 { entry: %literal = alloca %Vector2, align 4 - %1 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %1, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %2, align 4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 + store float 0.000000e+00, ptr %ptradd, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 8, i1 false) ret void } +; Function Attrs: define void @vector2_add(ptr noalias sret(%Vector2) align 4 %0, ptr byval(%Vector2) align 4 %1, ptr byval(%Vector2) align 4 %2) #0 { entry: %literal = alloca %Vector2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %3, align 4 - %4 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %4, align 4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 + store float 0.000000e+00, ptr %ptradd, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 8, i1 false) ret void } +; Function Attrs: define void @vector2_add_value(ptr noalias sret(%Vector2) align 4 %0, ptr byval(%Vector2) align 4 %1, float %2) #0 { entry: %literal = alloca %Vector2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %3, align 4 - %4 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %4, align 4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 + store float 0.000000e+00, ptr %ptradd, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 8, i1 false) ret void } +; Function Attrs: define void @vector2_subtract(ptr noalias sret(%Vector2) align 4 %0, ptr byval(%Vector2) align 4 %1, ptr byval(%Vector2) align 4 %2) #0 { entry: %literal = alloca %Vector2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %3, align 4 - %4 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %4, align 4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 + store float 0.000000e+00, ptr %ptradd, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 8, i1 false) ret void } +; Function Attrs: define void @vector2_subtract_value(ptr noalias sret(%Vector2) align 4 %0, ptr byval(%Vector2) align 4 %1, float %2) #0 { entry: %literal = alloca %Vector2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %3, align 4 - %4 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %4, align 4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i32 4 + store float 0.000000e+00, ptr %ptradd, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %0, ptr align 4 %literal, i32 8, i1 false) ret void } diff --git a/test/test_suite/abi/vec2_x64.c3t b/test/test_suite/abi/vec2_x64.c3t index c1edebe4a..1915d1f0a 100644 --- a/test/test_suite/abi/vec2_x64.c3t +++ b/test/test_suite/abi/vec2_x64.c3t @@ -19,25 +19,25 @@ fn Vector2 vector2_subtract_value(Vector2 v, float sub) @extern("vector2_subtrac define <2 x float> @vector2_zero() #0 { entry: %literal = alloca %Vector2, align 4 - %0 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %1, align 4 - %2 = load <2 x float>, ptr %literal, align 4 - ret <2 x float> %2 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %0 = load <2 x float>, ptr %literal, align 4 + ret <2 x float> %0 } +; Function Attrs: define <2 x float> @vector2_one() #0 { entry: %literal = alloca %Vector2, align 4 - %0 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %1, align 4 - %2 = load <2 x float>, ptr %literal, align 4 - ret <2 x float> %2 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %0 = load <2 x float>, ptr %literal, align 4 + ret <2 x float> %0 } +; Function Attrs: define <2 x float> @vector2_add(<2 x float> %0, <2 x float> %1) #0 { entry: %v1 = alloca %Vector2, align 4 @@ -45,27 +45,27 @@ entry: %literal = alloca %Vector2, align 4 store <2 x float> %0, ptr %v1, align 4 store <2 x float> %1, ptr %v2, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %3, align 4 - %4 = load <2 x float>, ptr %literal, align 4 - ret <2 x float> %4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %2 = load <2 x float>, ptr %literal, align 4 + ret <2 x float> %2 } +; Function Attrs: define <2 x float> @vector2_add_value(<2 x float> %0, float %1) #0 { entry: %v = alloca %Vector2, align 4 %literal = alloca %Vector2, align 4 store <2 x float> %0, ptr %v, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %3, align 4 - %4 = load <2 x float>, ptr %literal, align 4 - ret <2 x float> %4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %2 = load <2 x float>, ptr %literal, align 4 + ret <2 x float> %2 } +; Function Attrs: define <2 x float> @vector2_subtract(<2 x float> %0, <2 x float> %1) #0 { entry: %v1 = alloca %Vector2, align 4 @@ -73,23 +73,22 @@ entry: %literal = alloca %Vector2, align 4 store <2 x float> %0, ptr %v1, align 4 store <2 x float> %1, ptr %v2, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %3, align 4 - %4 = load <2 x float>, ptr %literal, align 4 - ret <2 x float> %4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %2 = load <2 x float>, ptr %literal, align 4 + ret <2 x float> %2 } +; Function Attrs: define <2 x float> @vector2_subtract_value(<2 x float> %0, float %1) #0 { entry: %v = alloca %Vector2, align 4 %literal = alloca %Vector2, align 4 store <2 x float> %0, ptr %v, align 4 - %2 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Vector2, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %3, align 4 - %4 = load <2 x float>, ptr %literal, align 4 - ret <2 x float> %4 + store float 0.000000e+00, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %2 = load <2 x float>, ptr %literal, align 4 + ret <2 x float> %2 } diff --git a/test/test_suite/abi/x64alignarray.c3t b/test/test_suite/abi/x64alignarray.c3t index 892d45fe0..31f5d990b 100644 --- a/test/test_suite/abi/x64alignarray.c3t +++ b/test/test_suite/abi/x64alignarray.c3t @@ -14,14 +14,13 @@ fn void test1_g() define void @test.test1_g() #0 { entry: %x = alloca [4 x float], align 16 - %0 = getelementptr inbounds [4 x float], ptr %x, i64 0, i64 0 - store float 0.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds [4 x float], ptr %x, i64 0, i64 1 - store float 0.000000e+00, ptr %1, align 4 - %2 = getelementptr inbounds [4 x float], ptr %x, i64 0, i64 2 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds [4 x float], ptr %x, i64 0, i64 3 - store float 0.000000e+00, ptr %3, align 4 + store float 0.000000e+00, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + store float 0.000000e+00, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %x, i64 12 + store float 0.000000e+00, ptr %ptradd2, align 4 call void @test1_f(ptr %x) ret void } diff --git a/test/test_suite/any/variant_assign.c3t b/test/test_suite/any/variant_assign.c3t index bb1b63835..8e709a18b 100644 --- a/test/test_suite/any/variant_assign.c3t +++ b/test/test_suite/any/variant_assign.c3t @@ -66,85 +66,83 @@ define void @foo.test(i64 %0, ptr %1) #0 { entry: %z = alloca %"any*", align 8 %switch = alloca i64, align 8 - %z1 = alloca ptr, align 8 - %z8 = alloca ptr, align 8 + %z3 = alloca ptr, align 8 + %z11 = alloca ptr, align 8 store i64 %0, ptr %z, align 8 - %ptroffset = getelementptr inbounds ptr, ptr %z, i64 1 - store ptr %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - store i64 %3, ptr %switch, align 8 + %ptradd = getelementptr inbounds i8, ptr %z, i64 8 + store ptr %1, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %z, i64 8 + %2 = load i64, ptr %ptradd1, align 8 + store i64 %2, ptr %switch, align 8 br label %switch.entry switch.entry: ; preds = %entry - %4 = load i64, ptr %switch, align 8 + %3 = load i64, ptr %switch, align 8 br label %check_subtype check_subtype: ; preds = %parent_type_block, %switch.entry - %5 = phi i64 [ %4, %switch.entry ], [ %typeid.parent, %parent_type_block ] - %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %5 + %4 = phi i64 [ %3, %switch.entry ], [ %typeid.parent, %parent_type_block ] + %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %4 br i1 %eq, label %result_block, label %parent_type_block parent_type_block: ; preds = %check_subtype - %6 = inttoptr i64 %5 to ptr - %7 = getelementptr inbounds %.introspect, ptr %6, i32 0, i32 1 - %typeid.parent = load i64, ptr %7, align 8 - %8 = icmp eq i64 %typeid.parent, 0 - br i1 %8, label %result_block, label %check_subtype + %5 = inttoptr i64 %4 to ptr + %ptradd2 = getelementptr inbounds i8, ptr %5, i64 8 + %typeid.parent = load i64, ptr %ptradd2, align 8 + %6 = icmp eq i64 %typeid.parent, 0 + br i1 %6, label %result_block, label %check_subtype result_block: ; preds = %parent_type_block, %check_subtype - %9 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] - br i1 %9, label %switch.case, label %next_if + %7 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] + br i1 %7, label %switch.case, label %next_if switch.case: ; preds = %result_block - %10 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - store ptr %11, ptr %z1, align 8 - %12 = load ptr, ptr %z1, align 8 - %13 = load i32, ptr %12, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %13) + %8 = load ptr, ptr %z, align 8 + store ptr %8, ptr %z3, align 8 + %9 = load ptr, ptr %z3, align 8 + %10 = load i32, ptr %9, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %10) br label %switch.exit next_if: ; preds = %result_block - br label %check_subtype2 - -check_subtype2: ; preds = %parent_type_block4, %next_if - %14 = phi i64 [ %4, %next_if ], [ %typeid.parent5, %parent_type_block4 ] - %eq3 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %14 - br i1 %eq3, label %result_block6, label %parent_type_block4 - -parent_type_block4: ; preds = %check_subtype2 - %15 = inttoptr i64 %14 to ptr - %16 = getelementptr inbounds %.introspect, ptr %15, i32 0, i32 1 - %typeid.parent5 = load i64, ptr %16, align 8 - %17 = icmp eq i64 %typeid.parent5, 0 - br i1 %17, label %result_block6, label %check_subtype2 - -result_block6: ; preds = %parent_type_block4, %check_subtype2 - %18 = phi i1 [ false, %parent_type_block4 ], [ true, %check_subtype2 ] - br i1 %18, label %switch.case7, label %next_if9 - -switch.case7: ; preds = %result_block6 - %19 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 0 - %20 = load ptr, ptr %19, align 8 - store ptr %20, ptr %z8, align 8 - %21 = load ptr, ptr %z8, align 8 - %22 = load double, ptr %21, align 8 - call void (ptr, ...) @printf(ptr @.str.1, double %22) + br label %check_subtype4 + +check_subtype4: ; preds = %parent_type_block6, %next_if + %11 = phi i64 [ %3, %next_if ], [ %typeid.parent8, %parent_type_block6 ] + %eq5 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %11 + br i1 %eq5, label %result_block9, label %parent_type_block6 + +parent_type_block6: ; preds = %check_subtype4 + %12 = inttoptr i64 %11 to ptr + %ptradd7 = getelementptr inbounds i8, ptr %12, i64 8 + %typeid.parent8 = load i64, ptr %ptradd7, align 8 + %13 = icmp eq i64 %typeid.parent8, 0 + br i1 %13, label %result_block9, label %check_subtype4 + +result_block9: ; preds = %parent_type_block6, %check_subtype4 + %14 = phi i1 [ false, %parent_type_block6 ], [ true, %check_subtype4 ] + br i1 %14, label %switch.case10, label %next_if12 + +switch.case10: ; preds = %result_block9 + %15 = load ptr, ptr %z, align 8 + store ptr %15, ptr %z11, align 8 + %16 = load ptr, ptr %z11, align 8 + %17 = load double, ptr %16, align 8 + call void (ptr, ...) @printf(ptr @.str.1, double %17) br label %switch.exit -next_if9: ; preds = %result_block6 +next_if12: ; preds = %result_block9 br label %switch.default -switch.default: ; preds = %next_if9 +switch.default: ; preds = %next_if12 call void (ptr, ...) @printf(ptr @.str.2) br label %switch.exit -switch.exit: ; preds = %switch.default, %switch.case7, %switch.case +switch.exit: ; preds = %switch.default, %switch.case10, %switch.case ret void } - +; Function Attrs: define void @foo.test2(i64 %0, ptr %1) #0 { entry: %y = alloca %"any*", align 8 @@ -152,273 +150,261 @@ entry: %switch = alloca i64, align 8 %z = alloca ptr, align 8 %taddr = alloca i32, align 4 - %z7 = alloca ptr, align 8 + %z10 = alloca ptr, align 8 store i64 %0, ptr %y, align 8 - %ptroffset = getelementptr inbounds ptr, ptr %y, i64 1 - store ptr %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %y, i64 8 + store ptr %1, ptr %ptradd, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %.anon, ptr align 8 %y, i32 16, i1 false) - %2 = getelementptr inbounds %"any*", ptr %y, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - store i64 %3, ptr %switch, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 8 + %2 = load i64, ptr %ptradd1, align 8 + store i64 %2, ptr %switch, align 8 br label %switch.entry switch.entry: ; preds = %entry - %4 = load i64, ptr %switch, align 8 + %3 = load i64, ptr %switch, align 8 br label %check_subtype check_subtype: ; preds = %parent_type_block, %switch.entry - %5 = phi i64 [ %4, %switch.entry ], [ %typeid.parent, %parent_type_block ] - %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %5 + %4 = phi i64 [ %3, %switch.entry ], [ %typeid.parent, %parent_type_block ] + %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %4 br i1 %eq, label %result_block, label %parent_type_block parent_type_block: ; preds = %check_subtype - %6 = inttoptr i64 %5 to ptr - %7 = getelementptr inbounds %.introspect, ptr %6, i32 0, i32 1 - %typeid.parent = load i64, ptr %7, align 8 - %8 = icmp eq i64 %typeid.parent, 0 - br i1 %8, label %result_block, label %check_subtype + %5 = inttoptr i64 %4 to ptr + %ptradd2 = getelementptr inbounds i8, ptr %5, i64 8 + %typeid.parent = load i64, ptr %ptradd2, align 8 + %6 = icmp eq i64 %typeid.parent, 0 + br i1 %6, label %result_block, label %check_subtype result_block: ; preds = %parent_type_block, %check_subtype - %9 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] - br i1 %9, label %switch.case, label %next_if + %7 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] + br i1 %7, label %switch.case, label %next_if switch.case: ; preds = %result_block - %10 = getelementptr inbounds %"any*", ptr %.anon, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - store ptr %11, ptr %z, align 8 + %8 = load ptr, ptr %.anon, align 8 + store ptr %8, ptr %z, align 8 store i32 12, ptr %taddr, align 4 - %12 = insertvalue %"any*" undef, ptr %taddr, 0 - %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %13, ptr %y, align 8 - %14 = load ptr, ptr %z, align 8 - %15 = load i32, ptr %14, align 4 - call void (ptr, ...) @printf(ptr @.str.3, i32 %15) + %9 = insertvalue %"any*" undef, ptr %taddr, 0 + %10 = insertvalue %"any*" %9, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %10, ptr %y, align 8 + %11 = load ptr, ptr %z, align 8 + %12 = load i32, ptr %11, align 4 + call void (ptr, ...) @printf(ptr @.str.3, i32 %12) br label %switch.exit next_if: ; preds = %result_block - br label %check_subtype1 - -check_subtype1: ; preds = %parent_type_block3, %next_if - %16 = phi i64 [ %4, %next_if ], [ %typeid.parent4, %parent_type_block3 ] - %eq2 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %16 - br i1 %eq2, label %result_block5, label %parent_type_block3 - -parent_type_block3: ; preds = %check_subtype1 - %17 = inttoptr i64 %16 to ptr - %18 = getelementptr inbounds %.introspect, ptr %17, i32 0, i32 1 - %typeid.parent4 = load i64, ptr %18, align 8 - %19 = icmp eq i64 %typeid.parent4, 0 - br i1 %19, label %result_block5, label %check_subtype1 - -result_block5: ; preds = %parent_type_block3, %check_subtype1 - %20 = phi i1 [ false, %parent_type_block3 ], [ true, %check_subtype1 ] - br i1 %20, label %switch.case6, label %next_if8 - -switch.case6: ; preds = %result_block5 - %21 = getelementptr inbounds %"any*", ptr %.anon, i32 0, i32 0 - %22 = load ptr, ptr %21, align 8 - store ptr %22, ptr %z7, align 8 - %23 = load ptr, ptr %z7, align 8 - %24 = load double, ptr %23, align 8 - call void (ptr, ...) @printf(ptr @.str.4, double %24) + br label %check_subtype3 + +check_subtype3: ; preds = %parent_type_block5, %next_if + %13 = phi i64 [ %3, %next_if ], [ %typeid.parent7, %parent_type_block5 ] + %eq4 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %13 + br i1 %eq4, label %result_block8, label %parent_type_block5 + +parent_type_block5: ; preds = %check_subtype3 + %14 = inttoptr i64 %13 to ptr + %ptradd6 = getelementptr inbounds i8, ptr %14, i64 8 + %typeid.parent7 = load i64, ptr %ptradd6, align 8 + %15 = icmp eq i64 %typeid.parent7, 0 + br i1 %15, label %result_block8, label %check_subtype3 + +result_block8: ; preds = %parent_type_block5, %check_subtype3 + %16 = phi i1 [ false, %parent_type_block5 ], [ true, %check_subtype3 ] + br i1 %16, label %switch.case9, label %next_if11 + +switch.case9: ; preds = %result_block8 + %17 = load ptr, ptr %.anon, align 8 + store ptr %17, ptr %z10, align 8 + %18 = load ptr, ptr %z10, align 8 + %19 = load double, ptr %18, align 8 + call void (ptr, ...) @printf(ptr @.str.4, double %19) br label %switch.exit -next_if8: ; preds = %result_block5 +next_if11: ; preds = %result_block8 br label %switch.default -switch.default: ; preds = %next_if8 +switch.default: ; preds = %next_if11 call void (ptr, ...) @printf(ptr @.str.5) br label %switch.exit -switch.exit: ; preds = %switch.default, %switch.case6, %switch.case +switch.exit: ; preds = %switch.default, %switch.case9, %switch.case ret void } - +; Function Attrs: define void @foo.test3(i64 %0, ptr %1) #0 { entry: %y = alloca %"any*", align 8 %.anon = alloca %"any*", align 8 %switch = alloca i64, align 8 %z = alloca i32, align 4 - %z7 = alloca double, align 8 + %z10 = alloca double, align 8 store i64 %0, ptr %y, align 8 - %ptroffset = getelementptr inbounds ptr, ptr %y, i64 1 - store ptr %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %y, i64 8 + store ptr %1, ptr %ptradd, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %.anon, ptr align 8 %y, i32 16, i1 false) - %2 = getelementptr inbounds %"any*", ptr %y, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - store i64 %3, ptr %switch, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 8 + %2 = load i64, ptr %ptradd1, align 8 + store i64 %2, ptr %switch, align 8 br label %switch.entry switch.entry: ; preds = %entry - %4 = load i64, ptr %switch, align 8 + %3 = load i64, ptr %switch, align 8 br label %check_subtype check_subtype: ; preds = %parent_type_block, %switch.entry - %5 = phi i64 [ %4, %switch.entry ], [ %typeid.parent, %parent_type_block ] - %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %5 + %4 = phi i64 [ %3, %switch.entry ], [ %typeid.parent, %parent_type_block ] + %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %4 br i1 %eq, label %result_block, label %parent_type_block parent_type_block: ; preds = %check_subtype - %6 = inttoptr i64 %5 to ptr - %7 = getelementptr inbounds %.introspect, ptr %6, i32 0, i32 1 - %typeid.parent = load i64, ptr %7, align 8 - %8 = icmp eq i64 %typeid.parent, 0 - br i1 %8, label %result_block, label %check_subtype + %5 = inttoptr i64 %4 to ptr + %ptradd2 = getelementptr inbounds i8, ptr %5, i64 8 + %typeid.parent = load i64, ptr %ptradd2, align 8 + %6 = icmp eq i64 %typeid.parent, 0 + br i1 %6, label %result_block, label %check_subtype result_block: ; preds = %parent_type_block, %check_subtype - %9 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] - br i1 %9, label %switch.case, label %next_if + %7 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] + br i1 %7, label %switch.case, label %next_if switch.case: ; preds = %result_block - %10 = getelementptr inbounds %"any*", ptr %.anon, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - %12 = load i32, ptr %11, align 4 - store i32 %12, ptr %z, align 4 - %13 = load i32, ptr %z, align 4 - call void (ptr, ...) @printf(ptr @.str.6, i32 %13) + %8 = load ptr, ptr %.anon, align 8 + %9 = load i32, ptr %8, align 4 + store i32 %9, ptr %z, align 4 + %10 = load i32, ptr %z, align 4 + call void (ptr, ...) @printf(ptr @.str.6, i32 %10) br label %switch.exit next_if: ; preds = %result_block - br label %check_subtype1 - -check_subtype1: ; preds = %parent_type_block3, %next_if - %14 = phi i64 [ %4, %next_if ], [ %typeid.parent4, %parent_type_block3 ] - %eq2 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %14 - br i1 %eq2, label %result_block5, label %parent_type_block3 - -parent_type_block3: ; preds = %check_subtype1 - %15 = inttoptr i64 %14 to ptr - %16 = getelementptr inbounds %.introspect, ptr %15, i32 0, i32 1 - %typeid.parent4 = load i64, ptr %16, align 8 - %17 = icmp eq i64 %typeid.parent4, 0 - br i1 %17, label %result_block5, label %check_subtype1 - -result_block5: ; preds = %parent_type_block3, %check_subtype1 - %18 = phi i1 [ false, %parent_type_block3 ], [ true, %check_subtype1 ] - br i1 %18, label %switch.case6, label %next_if8 - -switch.case6: ; preds = %result_block5 - %19 = getelementptr inbounds %"any*", ptr %.anon, i32 0, i32 0 - %20 = load ptr, ptr %19, align 8 - %21 = load double, ptr %20, align 8 - store double %21, ptr %z7, align 8 - %22 = load double, ptr %z7, align 8 - call void (ptr, ...) @printf(ptr @.str.7, double %22) + br label %check_subtype3 + +check_subtype3: ; preds = %parent_type_block5, %next_if + %11 = phi i64 [ %3, %next_if ], [ %typeid.parent7, %parent_type_block5 ] + %eq4 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %11 + br i1 %eq4, label %result_block8, label %parent_type_block5 + +parent_type_block5: ; preds = %check_subtype3 + %12 = inttoptr i64 %11 to ptr + %ptradd6 = getelementptr inbounds i8, ptr %12, i64 8 + %typeid.parent7 = load i64, ptr %ptradd6, align 8 + %13 = icmp eq i64 %typeid.parent7, 0 + br i1 %13, label %result_block8, label %check_subtype3 + +result_block8: ; preds = %parent_type_block5, %check_subtype3 + %14 = phi i1 [ false, %parent_type_block5 ], [ true, %check_subtype3 ] + br i1 %14, label %switch.case9, label %next_if11 + +switch.case9: ; preds = %result_block8 + %15 = load ptr, ptr %.anon, align 8 + %16 = load double, ptr %15, align 8 + store double %16, ptr %z10, align 8 + %17 = load double, ptr %z10, align 8 + call void (ptr, ...) @printf(ptr @.str.7, double %17) br label %switch.exit -next_if8: ; preds = %result_block5 +next_if11: ; preds = %result_block8 br label %switch.default -switch.default: ; preds = %next_if8 +switch.default: ; preds = %next_if11 call void (ptr, ...) @printf(ptr @.str.8) br label %switch.exit -switch.exit: ; preds = %switch.default, %switch.case6, %switch.case +switch.exit: ; preds = %switch.default, %switch.case9, %switch.case ret void } +; Function Attrs: define i32 @main() #0 { entry: %taddr = alloca double, align 8 %taddr1 = alloca %"any*", align 8 %taddr2 = alloca i32, align 4 %taddr3 = alloca %"any*", align 8 - %taddr6 = alloca i8, align 1 - %taddr7 = alloca %"any*", align 8 - %taddr10 = alloca double, align 8 - %taddr11 = alloca %"any*", align 8 - %taddr14 = alloca i32, align 4 - %taddr15 = alloca %"any*", align 8 - %taddr18 = alloca i8, align 1 - %taddr19 = alloca %"any*", align 8 - %taddr22 = alloca double, align 8 + %taddr7 = alloca i8, align 1 + %taddr8 = alloca %"any*", align 8 + %taddr12 = alloca double, align 8 + %taddr13 = alloca %"any*", align 8 + %taddr17 = alloca i32, align 4 + %taddr18 = alloca %"any*", align 8 + %taddr22 = alloca i8, align 1 %taddr23 = alloca %"any*", align 8 - %taddr26 = alloca i32, align 4 - %taddr27 = alloca %"any*", align 8 - %taddr30 = alloca i8, align 1 - %taddr31 = alloca %"any*", align 8 + %taddr27 = alloca double, align 8 + %taddr28 = alloca %"any*", align 8 + %taddr32 = alloca i32, align 4 + %taddr33 = alloca %"any*", align 8 + %taddr37 = alloca i8, align 1 + %taddr38 = alloca %"any*", align 8 store double 1.230000e+02, ptr %taddr, align 8 %0 = insertvalue %"any*" undef, ptr %taddr, 0 %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.double" to i64), 1 store %"any*" %1, ptr %taddr1, align 8 - %2 = getelementptr inbounds { i64, ptr }, ptr %taddr1, i32 0, i32 0 - %lo = load i64, ptr %2, align 8 - %3 = getelementptr inbounds { i64, ptr }, ptr %taddr1, i32 0, i32 1 - %hi = load ptr, ptr %3, align 8 + %lo = load i64, ptr %taddr1, align 8 + %ptradd = getelementptr inbounds i8, ptr %taddr1, i64 8 + %hi = load ptr, ptr %ptradd, align 8 call void @foo.test(i64 %lo, ptr %hi) store i32 1, ptr %taddr2, align 4 - %4 = insertvalue %"any*" undef, ptr %taddr2, 0 - %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %5, ptr %taddr3, align 8 - %6 = getelementptr inbounds { i64, ptr }, ptr %taddr3, i32 0, i32 0 - %lo4 = load i64, ptr %6, align 8 - %7 = getelementptr inbounds { i64, ptr }, ptr %taddr3, i32 0, i32 1 - %hi5 = load ptr, ptr %7, align 8 - call void @foo.test(i64 %lo4, ptr %hi5) - store i8 1, ptr %taddr6, align 1 - %8 = insertvalue %"any*" undef, ptr %taddr6, 0 - %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - store %"any*" %9, ptr %taddr7, align 8 - %10 = getelementptr inbounds { i64, ptr }, ptr %taddr7, i32 0, i32 0 - %lo8 = load i64, ptr %10, align 8 - %11 = getelementptr inbounds { i64, ptr }, ptr %taddr7, i32 0, i32 1 - %hi9 = load ptr, ptr %11, align 8 - call void @foo.test(i64 %lo8, ptr %hi9) - store double 1.235000e+02, ptr %taddr10, align 8 - %12 = insertvalue %"any*" undef, ptr %taddr10, 0 + %2 = insertvalue %"any*" undef, ptr %taddr2, 0 + %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %3, ptr %taddr3, align 8 + %lo4 = load i64, ptr %taddr3, align 8 + %ptradd5 = getelementptr inbounds i8, ptr %taddr3, i64 8 + %hi6 = load ptr, ptr %ptradd5, align 8 + call void @foo.test(i64 %lo4, ptr %hi6) + store i8 1, ptr %taddr7, align 1 + %4 = insertvalue %"any*" undef, ptr %taddr7, 0 + %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %5, ptr %taddr8, align 8 + %lo9 = load i64, ptr %taddr8, align 8 + %ptradd10 = getelementptr inbounds i8, ptr %taddr8, i64 8 + %hi11 = load ptr, ptr %ptradd10, align 8 + call void @foo.test(i64 %lo9, ptr %hi11) + store double 1.235000e+02, ptr %taddr12, align 8 + %6 = insertvalue %"any*" undef, ptr %taddr12, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.double" to i64), 1 + store %"any*" %7, ptr %taddr13, align 8 + %lo14 = load i64, ptr %taddr13, align 8 + %ptradd15 = getelementptr inbounds i8, ptr %taddr13, i64 8 + %hi16 = load ptr, ptr %ptradd15, align 8 + call void @foo.test2(i64 %lo14, ptr %hi16) + store i32 1, ptr %taddr17, align 4 + %8 = insertvalue %"any*" undef, ptr %taddr17, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %9, ptr %taddr18, align 8 + %lo19 = load i64, ptr %taddr18, align 8 + %ptradd20 = getelementptr inbounds i8, ptr %taddr18, i64 8 + %hi21 = load ptr, ptr %ptradd20, align 8 + call void @foo.test2(i64 %lo19, ptr %hi21) + store i8 1, ptr %taddr22, align 1 + %10 = insertvalue %"any*" undef, ptr %taddr22, 0 + %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %11, ptr %taddr23, align 8 + %lo24 = load i64, ptr %taddr23, align 8 + %ptradd25 = getelementptr inbounds i8, ptr %taddr23, i64 8 + %hi26 = load ptr, ptr %ptradd25, align 8 + call void @foo.test2(i64 %lo24, ptr %hi26) + store double 1.240000e+02, ptr %taddr27, align 8 + %12 = insertvalue %"any*" undef, ptr %taddr27, 0 %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.double" to i64), 1 - store %"any*" %13, ptr %taddr11, align 8 - %14 = getelementptr inbounds { i64, ptr }, ptr %taddr11, i32 0, i32 0 - %lo12 = load i64, ptr %14, align 8 - %15 = getelementptr inbounds { i64, ptr }, ptr %taddr11, i32 0, i32 1 - %hi13 = load ptr, ptr %15, align 8 - call void @foo.test2(i64 %lo12, ptr %hi13) - store i32 1, ptr %taddr14, align 4 - %16 = insertvalue %"any*" undef, ptr %taddr14, 0 - %17 = insertvalue %"any*" %16, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %17, ptr %taddr15, align 8 - %18 = getelementptr inbounds { i64, ptr }, ptr %taddr15, i32 0, i32 0 - %lo16 = load i64, ptr %18, align 8 - %19 = getelementptr inbounds { i64, ptr }, ptr %taddr15, i32 0, i32 1 - %hi17 = load ptr, ptr %19, align 8 - call void @foo.test2(i64 %lo16, ptr %hi17) - store i8 1, ptr %taddr18, align 1 - %20 = insertvalue %"any*" undef, ptr %taddr18, 0 - %21 = insertvalue %"any*" %20, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - store %"any*" %21, ptr %taddr19, align 8 - %22 = getelementptr inbounds { i64, ptr }, ptr %taddr19, i32 0, i32 0 - %lo20 = load i64, ptr %22, align 8 - %23 = getelementptr inbounds { i64, ptr }, ptr %taddr19, i32 0, i32 1 - %hi21 = load ptr, ptr %23, align 8 - call void @foo.test2(i64 %lo20, ptr %hi21) - store double 1.240000e+02, ptr %taddr22, align 8 - %24 = insertvalue %"any*" undef, ptr %taddr22, 0 - %25 = insertvalue %"any*" %24, i64 ptrtoint (ptr @"$ct.double" to i64), 1 - store %"any*" %25, ptr %taddr23, align 8 - %26 = getelementptr inbounds { i64, ptr }, ptr %taddr23, i32 0, i32 0 - %lo24 = load i64, ptr %26, align 8 - %27 = getelementptr inbounds { i64, ptr }, ptr %taddr23, i32 0, i32 1 - %hi25 = load ptr, ptr %27, align 8 - call void @foo.test3(i64 %lo24, ptr %hi25) - store i32 2, ptr %taddr26, align 4 - %28 = insertvalue %"any*" undef, ptr %taddr26, 0 - %29 = insertvalue %"any*" %28, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %29, ptr %taddr27, align 8 - %30 = getelementptr inbounds { i64, ptr }, ptr %taddr27, i32 0, i32 0 - %lo28 = load i64, ptr %30, align 8 - %31 = getelementptr inbounds { i64, ptr }, ptr %taddr27, i32 0, i32 1 - %hi29 = load ptr, ptr %31, align 8 - call void @foo.test3(i64 %lo28, ptr %hi29) - store i8 1, ptr %taddr30, align 1 - %32 = insertvalue %"any*" undef, ptr %taddr30, 0 - %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - store %"any*" %33, ptr %taddr31, align 8 - %34 = getelementptr inbounds { i64, ptr }, ptr %taddr31, i32 0, i32 0 - %lo32 = load i64, ptr %34, align 8 - %35 = getelementptr inbounds { i64, ptr }, ptr %taddr31, i32 0, i32 1 - %hi33 = load ptr, ptr %35, align 8 - call void @foo.test3(i64 %lo32, ptr %hi33) + store %"any*" %13, ptr %taddr28, align 8 + %lo29 = load i64, ptr %taddr28, align 8 + %ptradd30 = getelementptr inbounds i8, ptr %taddr28, i64 8 + %hi31 = load ptr, ptr %ptradd30, align 8 + call void @foo.test3(i64 %lo29, ptr %hi31) + store i32 2, ptr %taddr32, align 4 + %14 = insertvalue %"any*" undef, ptr %taddr32, 0 + %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %15, ptr %taddr33, align 8 + %lo34 = load i64, ptr %taddr33, align 8 + %ptradd35 = getelementptr inbounds i8, ptr %taddr33, i64 8 + %hi36 = load ptr, ptr %ptradd35, align 8 + call void @foo.test3(i64 %lo34, ptr %hi36) + store i8 1, ptr %taddr37, align 1 + %16 = insertvalue %"any*" undef, ptr %taddr37, 0 + %17 = insertvalue %"any*" %16, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %17, ptr %taddr38, align 8 + %lo39 = load i64, ptr %taddr38, align 8 + %ptradd40 = getelementptr inbounds i8, ptr %taddr38, i64 8 + %hi41 = load ptr, ptr %ptradd40, align 8 + call void @foo.test3(i64 %lo39, ptr %hi41) ret i32 0 } diff --git a/test/test_suite/any/variant_switch.c3t b/test/test_suite/any/variant_switch.c3t index 6820a8780..b5d3d95e6 100644 --- a/test/test_suite/any/variant_switch.c3t +++ b/test/test_suite/any/variant_switch.c3t @@ -38,134 +38,128 @@ define void @foo.test(i64 %0, ptr %1) #0 { entry: %z = alloca %"any*", align 8 %switch = alloca i64, align 8 - %z1 = alloca ptr, align 8 - %z8 = alloca ptr, align 8 + %z3 = alloca ptr, align 8 + %z11 = alloca ptr, align 8 store i64 %0, ptr %z, align 8 - %ptroffset = getelementptr inbounds ptr, ptr %z, i64 1 - store ptr %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - store i64 %3, ptr %switch, align 8 + %ptradd = getelementptr inbounds i8, ptr %z, i64 8 + store ptr %1, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %z, i64 8 + %2 = load i64, ptr %ptradd1, align 8 + store i64 %2, ptr %switch, align 8 br label %switch.entry switch.entry: ; preds = %entry - %4 = load i64, ptr %switch, align 8 + %3 = load i64, ptr %switch, align 8 br label %check_subtype check_subtype: ; preds = %parent_type_block, %switch.entry - %5 = phi i64 [ %4, %switch.entry ], [ %typeid.parent, %parent_type_block ] - %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %5 + %4 = phi i64 [ %3, %switch.entry ], [ %typeid.parent, %parent_type_block ] + %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %4 br i1 %eq, label %result_block, label %parent_type_block parent_type_block: ; preds = %check_subtype - %6 = inttoptr i64 %5 to ptr - %7 = getelementptr inbounds %.introspect, ptr %6, i32 0, i32 1 - %typeid.parent = load i64, ptr %7, align 8 - %8 = icmp eq i64 %typeid.parent, 0 - br i1 %8, label %result_block, label %check_subtype + %5 = inttoptr i64 %4 to ptr + %ptradd2 = getelementptr inbounds i8, ptr %5, i64 8 + %typeid.parent = load i64, ptr %ptradd2, align 8 + %6 = icmp eq i64 %typeid.parent, 0 + br i1 %6, label %result_block, label %check_subtype result_block: ; preds = %parent_type_block, %check_subtype - %9 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] - br i1 %9, label %switch.case, label %next_if + %7 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] + br i1 %7, label %switch.case, label %next_if switch.case: ; preds = %result_block - %10 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - store ptr %11, ptr %z1, align 8 - %12 = load ptr, ptr %z1, align 8 - %13 = load i32, ptr %12, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %13) - %14 = load ptr, ptr %z1, align 8 - store i32 3, ptr %14, align 4 + %8 = load ptr, ptr %z, align 8 + store ptr %8, ptr %z3, align 8 + %9 = load ptr, ptr %z3, align 8 + %10 = load i32, ptr %9, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %10) + %11 = load ptr, ptr %z3, align 8 + store i32 3, ptr %11, align 4 br label %switch.exit next_if: ; preds = %result_block - br label %check_subtype2 - -check_subtype2: ; preds = %parent_type_block4, %next_if - %15 = phi i64 [ %4, %next_if ], [ %typeid.parent5, %parent_type_block4 ] - %eq3 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %15 - br i1 %eq3, label %result_block6, label %parent_type_block4 - -parent_type_block4: ; preds = %check_subtype2 - %16 = inttoptr i64 %15 to ptr - %17 = getelementptr inbounds %.introspect, ptr %16, i32 0, i32 1 - %typeid.parent5 = load i64, ptr %17, align 8 - %18 = icmp eq i64 %typeid.parent5, 0 - br i1 %18, label %result_block6, label %check_subtype2 - -result_block6: ; preds = %parent_type_block4, %check_subtype2 - %19 = phi i1 [ false, %parent_type_block4 ], [ true, %check_subtype2 ] - br i1 %19, label %switch.case7, label %next_if9 - -switch.case7: ; preds = %result_block6 - %20 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 0 - %21 = load ptr, ptr %20, align 8 - store ptr %21, ptr %z8, align 8 - %22 = load ptr, ptr %z8, align 8 - %23 = load double, ptr %22, align 8 - call void (ptr, ...) @printf(ptr @.str.1, double %23) + br label %check_subtype4 + +check_subtype4: ; preds = %parent_type_block6, %next_if + %12 = phi i64 [ %3, %next_if ], [ %typeid.parent8, %parent_type_block6 ] + %eq5 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %12 + br i1 %eq5, label %result_block9, label %parent_type_block6 + +parent_type_block6: ; preds = %check_subtype4 + %13 = inttoptr i64 %12 to ptr + %ptradd7 = getelementptr inbounds i8, ptr %13, i64 8 + %typeid.parent8 = load i64, ptr %ptradd7, align 8 + %14 = icmp eq i64 %typeid.parent8, 0 + br i1 %14, label %result_block9, label %check_subtype4 + +result_block9: ; preds = %parent_type_block6, %check_subtype4 + %15 = phi i1 [ false, %parent_type_block6 ], [ true, %check_subtype4 ] + br i1 %15, label %switch.case10, label %next_if12 + +switch.case10: ; preds = %result_block9 + %16 = load ptr, ptr %z, align 8 + store ptr %16, ptr %z11, align 8 + %17 = load ptr, ptr %z11, align 8 + %18 = load double, ptr %17, align 8 + call void (ptr, ...) @printf(ptr @.str.1, double %18) br label %switch.exit -next_if9: ; preds = %result_block6 +next_if12: ; preds = %result_block9 br label %switch.default -switch.default: ; preds = %next_if9 +switch.default: ; preds = %next_if12 call void (ptr, ...) @printf(ptr @.str.2) br label %switch.exit -switch.exit: ; preds = %switch.default, %switch.case7, %switch.case - %24 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 1 - %25 = load i64, ptr %24, align 8 - %eq10 = icmp eq i64 %25, ptrtoint (ptr @"$ct.int" to i64) - br i1 %eq10, label %if.then, label %if.exit +switch.exit: ; preds = %switch.default, %switch.case10, %switch.case + %ptradd13 = getelementptr inbounds i8, ptr %z, i64 8 + %19 = load i64, ptr %ptradd13, align 8 + %eq14 = icmp eq i64 %19, ptrtoint (ptr @"$ct.int" to i64) + br i1 %eq14, label %if.then, label %if.exit if.then: ; preds = %switch.exit - %26 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 0 - %27 = load ptr, ptr %26, align 8 - %28 = load i32, ptr %27, align 4 - call void (ptr, ...) @printf(ptr @.str.3, i32 %28) + %20 = load ptr, ptr %z, align 8 + %21 = load i32, ptr %20, align 4 + call void (ptr, ...) @printf(ptr @.str.3, i32 %21) br label %if.exit if.exit: ; preds = %if.then, %switch.exit ret void } - +; Function Attrs: define i32 @main() #0 { entry: %taddr = alloca double, align 8 %taddr1 = alloca %"any*", align 8 %taddr2 = alloca i32, align 4 %taddr3 = alloca %"any*", align 8 - %taddr6 = alloca i8, align 1 - %taddr7 = alloca %"any*", align 8 + %taddr7 = alloca i8, align 1 + %taddr8 = alloca %"any*", align 8 store double 1.230000e+02, ptr %taddr, align 8 %0 = insertvalue %"any*" undef, ptr %taddr, 0 %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.double" to i64), 1 store %"any*" %1, ptr %taddr1, align 8 - %2 = getelementptr inbounds { i64, ptr }, ptr %taddr1, i32 0, i32 0 - %lo = load i64, ptr %2, align 8 - %3 = getelementptr inbounds { i64, ptr }, ptr %taddr1, i32 0, i32 1 - %hi = load ptr, ptr %3, align 8 + %lo = load i64, ptr %taddr1, align 8 + %ptradd = getelementptr inbounds i8, ptr %taddr1, i64 8 + %hi = load ptr, ptr %ptradd, align 8 call void @foo.test(i64 %lo, ptr %hi) store i32 1, ptr %taddr2, align 4 - %4 = insertvalue %"any*" undef, ptr %taddr2, 0 - %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %5, ptr %taddr3, align 8 - %6 = getelementptr inbounds { i64, ptr }, ptr %taddr3, i32 0, i32 0 - %lo4 = load i64, ptr %6, align 8 - %7 = getelementptr inbounds { i64, ptr }, ptr %taddr3, i32 0, i32 1 - %hi5 = load ptr, ptr %7, align 8 - call void @foo.test(i64 %lo4, ptr %hi5) - store i8 1, ptr %taddr6, align 1 - %8 = insertvalue %"any*" undef, ptr %taddr6, 0 - %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - store %"any*" %9, ptr %taddr7, align 8 - %10 = getelementptr inbounds { i64, ptr }, ptr %taddr7, i32 0, i32 0 - %lo8 = load i64, ptr %10, align 8 - %11 = getelementptr inbounds { i64, ptr }, ptr %taddr7, i32 0, i32 1 - %hi9 = load ptr, ptr %11, align 8 - call void @foo.test(i64 %lo8, ptr %hi9) + %2 = insertvalue %"any*" undef, ptr %taddr2, 0 + %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %3, ptr %taddr3, align 8 + %lo4 = load i64, ptr %taddr3, align 8 + %ptradd5 = getelementptr inbounds i8, ptr %taddr3, i64 8 + %hi6 = load ptr, ptr %ptradd5, align 8 + call void @foo.test(i64 %lo4, ptr %hi6) + store i8 1, ptr %taddr7, align 1 + %4 = insertvalue %"any*" undef, ptr %taddr7, 0 + %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %5, ptr %taddr8, align 8 + %lo9 = load i64, ptr %taddr8, align 8 + %ptradd10 = getelementptr inbounds i8, ptr %taddr8, i64 8 + %hi11 = load ptr, ptr %ptradd10, align 8 + call void @foo.test(i64 %lo9, ptr %hi11) ret i32 0 } diff --git a/test/test_suite/any/variant_test.c3t b/test/test_suite/any/variant_test.c3t index 28e1a7532..d7c6df48a 100644 --- a/test/test_suite/any/variant_test.c3t +++ b/test/test_suite/any/variant_test.c3t @@ -76,132 +76,158 @@ entry: %x = alloca %"any*", align 8 %switch = alloca i64, align 8 store i64 %0, ptr %x, align 8 - %ptroffset = getelementptr inbounds ptr, ptr %x, i64 1 - store ptr %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"any*", ptr %x, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - store i64 %3, ptr %switch, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + store ptr %1, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + %2 = load i64, ptr %ptradd1, align 8 + store i64 %2, ptr %switch, align 8 br label %switch.entry + switch.entry: ; preds = %entry - %4 = load i64, ptr %switch, align 8 + %3 = load i64, ptr %switch, align 8 br label %check_subtype + check_subtype: ; preds = %parent_type_block, %switch.entry - %5 = phi i64 [ %4, %switch.entry ], [ %typeid.parent, %parent_type_block ] - %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %5 + %4 = phi i64 [ %3, %switch.entry ], [ %typeid.parent, %parent_type_block ] + %eq = icmp eq i64 ptrtoint (ptr @"$ct.int" to i64), %4 br i1 %eq, label %result_block, label %parent_type_block + parent_type_block: ; preds = %check_subtype - %6 = inttoptr i64 %5 to ptr - %7 = getelementptr inbounds %.introspect, ptr %6, i32 0, i32 1 - %typeid.parent = load i64, ptr %7, align 8 - %8 = icmp eq i64 %typeid.parent, 0 - br i1 %8, label %result_block, label %check_subtype + %5 = inttoptr i64 %4 to ptr + %ptradd2 = getelementptr inbounds i8, ptr %5, i64 8 + %typeid.parent = load i64, ptr %ptradd2, align 8 + %6 = icmp eq i64 %typeid.parent, 0 + br i1 %6, label %result_block, label %check_subtype + result_block: ; preds = %parent_type_block, %check_subtype - %9 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] - br i1 %9, label %switch.case, label %next_if + %7 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] + br i1 %7, label %switch.case, label %next_if + switch.case: ; preds = %result_block call void (ptr, ...) @printf(ptr @.str) br label %switch.exit + next_if: ; preds = %result_block - br label %check_subtype1 -check_subtype1: ; preds = %parent_type_block3, %next_if - %10 = phi i64 [ %4, %next_if ], [ %typeid.parent4, %parent_type_block3 ] - %eq2 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %10 - br i1 %eq2, label %result_block5, label %parent_type_block3 -parent_type_block3: ; preds = %check_subtype1 - %11 = inttoptr i64 %10 to ptr - %12 = getelementptr inbounds %.introspect, ptr %11, i32 0, i32 1 - %typeid.parent4 = load i64, ptr %12, align 8 - %13 = icmp eq i64 %typeid.parent4, 0 - br i1 %13, label %result_block5, label %check_subtype1 -result_block5: ; preds = %parent_type_block3, %check_subtype1 - %14 = phi i1 [ false, %parent_type_block3 ], [ true, %check_subtype1 ] - br i1 %14, label %switch.case6, label %next_if7 -switch.case6: ; preds = %result_block5 + br label %check_subtype3 + +check_subtype3: ; preds = %parent_type_block5, %next_if + %8 = phi i64 [ %3, %next_if ], [ %typeid.parent7, %parent_type_block5 ] + %eq4 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %8 + br i1 %eq4, label %result_block8, label %parent_type_block5 + +parent_type_block5: ; preds = %check_subtype3 + %9 = inttoptr i64 %8 to ptr + %ptradd6 = getelementptr inbounds i8, ptr %9, i64 8 + %typeid.parent7 = load i64, ptr %ptradd6, align 8 + %10 = icmp eq i64 %typeid.parent7, 0 + br i1 %10, label %result_block8, label %check_subtype3 + +result_block8: ; preds = %parent_type_block5, %check_subtype3 + %11 = phi i1 [ false, %parent_type_block5 ], [ true, %check_subtype3 ] + br i1 %11, label %switch.case9, label %next_if10 + +switch.case9: ; preds = %result_block8 call void (ptr, ...) @printf(ptr @.str.1) br label %switch.exit -next_if7: ; preds = %result_block5 - br label %check_subtype8 -check_subtype8: ; preds = %parent_type_block10, %next_if7 - %15 = phi i64 [ %4, %next_if7 ], [ %typeid.parent11, %parent_type_block10 ] - %eq9 = icmp eq i64 ptrtoint (ptr @"$ct.any$" to i64), %15 - br i1 %eq9, label %result_block12, label %parent_type_block10 -parent_type_block10: ; preds = %check_subtype8 - %16 = inttoptr i64 %15 to ptr - %17 = getelementptr inbounds %.introspect, ptr %16, i32 0, i32 1 - %typeid.parent11 = load i64, ptr %17, align 8 - %18 = icmp eq i64 %typeid.parent11, 0 - br i1 %18, label %result_block12, label %check_subtype8 -result_block12: ; preds = %parent_type_block10, %check_subtype8 - %19 = phi i1 [ false, %parent_type_block10 ], [ true, %check_subtype8 ] - br i1 %19, label %switch.case13, label %next_if14 -switch.case13: ; preds = %result_block12 + +next_if10: ; preds = %result_block8 + br label %check_subtype11 + +check_subtype11: ; preds = %parent_type_block13, %next_if10 + %12 = phi i64 [ %3, %next_if10 ], [ %typeid.parent15, %parent_type_block13 ] + %eq12 = icmp eq i64 ptrtoint (ptr @"$ct.any$" to i64), %12 + br i1 %eq12, label %result_block16, label %parent_type_block13 + +parent_type_block13: ; preds = %check_subtype11 + %13 = inttoptr i64 %12 to ptr + %ptradd14 = getelementptr inbounds i8, ptr %13, i64 8 + %typeid.parent15 = load i64, ptr %ptradd14, align 8 + %14 = icmp eq i64 %typeid.parent15, 0 + br i1 %14, label %result_block16, label %check_subtype11 + +result_block16: ; preds = %parent_type_block13, %check_subtype11 + %15 = phi i1 [ false, %parent_type_block13 ], [ true, %check_subtype11 ] + br i1 %15, label %switch.case17, label %next_if18 + +switch.case17: ; preds = %result_block16 call void (ptr, ...) @printf(ptr @.str.2) br label %switch.exit -next_if14: ; preds = %result_block12 - br label %check_subtype15 -check_subtype15: ; preds = %parent_type_block17, %next_if14 - %20 = phi i64 [ %4, %next_if14 ], [ %typeid.parent18, %parent_type_block17 ] - %eq16 = icmp eq i64 ptrtoint (ptr @"$ct.p$int" to i64), %20 - br i1 %eq16, label %result_block19, label %parent_type_block17 -parent_type_block17: ; preds = %check_subtype15 - %21 = inttoptr i64 %20 to ptr - %22 = getelementptr inbounds %.introspect, ptr %21, i32 0, i32 1 - %typeid.parent18 = load i64, ptr %22, align 8 - %23 = icmp eq i64 %typeid.parent18, 0 - br i1 %23, label %result_block19, label %check_subtype15 -result_block19: ; preds = %parent_type_block17, %check_subtype15 - %24 = phi i1 [ false, %parent_type_block17 ], [ true, %check_subtype15 ] - br i1 %24, label %switch.case20, label %next_if21 -switch.case20: ; preds = %result_block19 + +next_if18: ; preds = %result_block16 + br label %check_subtype19 + +check_subtype19: ; preds = %parent_type_block21, %next_if18 + %16 = phi i64 [ %3, %next_if18 ], [ %typeid.parent23, %parent_type_block21 ] + %eq20 = icmp eq i64 ptrtoint (ptr @"$ct.p$int" to i64), %16 + br i1 %eq20, label %result_block24, label %parent_type_block21 + +parent_type_block21: ; preds = %check_subtype19 + %17 = inttoptr i64 %16 to ptr + %ptradd22 = getelementptr inbounds i8, ptr %17, i64 8 + %typeid.parent23 = load i64, ptr %ptradd22, align 8 + %18 = icmp eq i64 %typeid.parent23, 0 + br i1 %18, label %result_block24, label %check_subtype19 + +result_block24: ; preds = %parent_type_block21, %check_subtype19 + %19 = phi i1 [ false, %parent_type_block21 ], [ true, %check_subtype19 ] + br i1 %19, label %switch.case25, label %next_if26 + +switch.case25: ; preds = %result_block24 call void (ptr, ...) @printf(ptr @.str.3) br label %switch.exit -next_if21: ; preds = %result_block19 + +next_if26: ; preds = %result_block24 br label %switch.default -switch.default: ; preds = %next_if21 + +switch.default: ; preds = %next_if26 call void (ptr, ...) @printf(ptr @.str.4) br label %switch.exit -switch.exit: ; preds = %switch.default, %switch.case20, %switch.case13, %switch.case6, %switch.case + +switch.exit: ; preds = %switch.default, %switch.case25, %switch.case17, %switch.case9, %switch.case ret void } +; Function Attrs: define void @foo.test_all(ptr %0, i64 %1) #0 { entry: %y = alloca %"any*[]", align 8 %.anon = alloca i64, align 8 - %.anon1 = alloca i64, align 8 + %.anon2 = alloca i64, align 8 %element = alloca %"any*", align 8 store ptr %0, ptr %y, align 8 - %ptroffset = getelementptr inbounds i64, ptr %y, i64 1 - store i64 %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"any*[]", ptr %y, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - store i64 %3, ptr %.anon, align 8 - store i64 0, ptr %.anon1, align 8 + %ptradd = getelementptr inbounds i8, ptr %y, i64 8 + store i64 %1, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 8 + %2 = load i64, ptr %ptradd1, align 8 + store i64 %2, ptr %.anon, align 8 + store i64 0, ptr %.anon2, align 8 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry - %4 = load i64, ptr %.anon1, align 8 - %5 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %4, %5 + %3 = load i64, ptr %.anon2, align 8 + %4 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %3, %4 br i1 %lt, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond - %6 = getelementptr inbounds %"any*[]", ptr %y, i32 0, i32 0 - %7 = load ptr, ptr %6, align 8 - %8 = load i64, ptr %.anon1, align 8 - %ptroffset2 = getelementptr inbounds %"any*", ptr %7, i64 %8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %element, ptr align 8 %ptroffset2, i32 16, i1 false) - %9 = getelementptr inbounds { i64, ptr }, ptr %element, i32 0, i32 0 - %lo = load i64, ptr %9, align 8 - %10 = getelementptr inbounds { i64, ptr }, ptr %element, i32 0, i32 1 - %hi = load ptr, ptr %10, align 8 + %5 = load ptr, ptr %y, align 8 + %6 = load i64, ptr %.anon2, align 8 + %ptroffset = getelementptr inbounds [16 x i8], ptr %5, i64 %6 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %element, ptr align 8 %ptroffset, i32 16, i1 false) + %lo = load i64, ptr %element, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %element, i64 8 + %hi = load ptr, ptr %ptradd3, align 8 call void @foo.test(i64 %lo, ptr %hi) - %11 = load i64, ptr %.anon1, align 8 - %add = add i64 %11, 1 - store i64 %add, ptr %.anon1, align 8 + %7 = load i64, ptr %.anon2, align 8 + %add = add i64 %7, 1 + store i64 %add, ptr %.anon2, align 8 br label %loop.cond + loop.exit: ; preds = %loop.cond ret void } +; Function Attrs: define void @foo.main() #0 { entry: %x = alloca %"any*", align 8 @@ -210,16 +236,16 @@ entry: %y = alloca %"any*", align 8 %g = alloca i64, align 8 %h = alloca i64, align 8 - %taddr4 = alloca double, align 8 - %taddr11 = alloca double, align 8 - %taddr12 = alloca %"any*", align 8 - %taddr15 = alloca i32, align 4 - %taddr16 = alloca %"any*", align 8 - %taddr19 = alloca i8, align 1 - %taddr20 = alloca %"any*", align 8 + %taddr7 = alloca double, align 8 + %taddr17 = alloca double, align 8 + %taddr18 = alloca %"any*", align 8 + %taddr22 = alloca i32, align 4 + %taddr23 = alloca %"any*", align 8 + %taddr27 = alloca i8, align 1 + %taddr28 = alloca %"any*", align 8 %df = alloca ptr, align 8 %varargslots = alloca [5 x %"any*"], align 16 - %taddr23 = alloca double, align 8 + %taddr33 = alloca double, align 8 store i32 1, ptr %taddr, align 4 %0 = insertvalue %"any*" undef, ptr %taddr, 0 %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.int" to i64), 1 @@ -228,102 +254,105 @@ entry: %2 = insertvalue %"any*" undef, ptr %z, 0 %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.int" to i64), 1 store %"any*" %3, ptr %y, align 8 - %4 = getelementptr inbounds %"any*", ptr %y, i32 0, i32 1 - %5 = load i64, ptr %4, align 8 - store i64 %5, ptr %g, align 8 - %6 = getelementptr inbounds %"any*", ptr %x, i32 0, i32 1 - %7 = load i64, ptr %6, align 8 - store i64 %7, ptr %h, align 8 - %8 = getelementptr inbounds %"any*", ptr %y, i32 0, i32 1 - %9 = load i64, ptr %8, align 8 - %eq = icmp eq i64 %9, ptrtoint (ptr @"$ct.int" to i64) + %ptradd = getelementptr inbounds i8, ptr %y, i64 8 + %4 = load i64, ptr %ptradd, align 8 + store i64 %4, ptr %g, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + %5 = load i64, ptr %ptradd1, align 8 + store i64 %5, ptr %h, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %y, i64 8 + %6 = load i64, ptr %ptradd2, align 8 + %eq = icmp eq i64 %6, ptrtoint (ptr @"$ct.int" to i64) br i1 %eq, label %if.then, label %if.exit + if.then: ; preds = %entry call void (ptr, ...) @printf(ptr @.str.5) br label %if.exit + if.exit: ; preds = %if.then, %entry - %10 = getelementptr inbounds %"any*", ptr %x, i32 0, i32 1 - %11 = load i64, ptr %10, align 8 - %eq1 = icmp eq i64 %11, ptrtoint (ptr @"$ct.int" to i64) - br i1 %eq1, label %if.then2, label %if.exit3 -if.then2: ; preds = %if.exit + %ptradd3 = getelementptr inbounds i8, ptr %x, i64 8 + %7 = load i64, ptr %ptradd3, align 8 + %eq4 = icmp eq i64 %7, ptrtoint (ptr @"$ct.int" to i64) + br i1 %eq4, label %if.then5, label %if.exit6 + +if.then5: ; preds = %if.exit call void (ptr, ...) @printf(ptr @.str.6) - br label %if.exit3 -if.exit3: ; preds = %if.then2, %if.exit - store double 1.000000e+00, ptr %taddr4, align 8 - %12 = insertvalue %"any*" undef, ptr %taddr4, 0 - %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.double" to i64), 1 - store %"any*" %13, ptr %y, align 8 - %14 = insertvalue %"any*" undef, ptr %x, 0 - %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.any$" to i64), 1 - store %"any*" %15, ptr %x, align 8 - %16 = getelementptr inbounds %"any*", ptr %y, i32 0, i32 1 - %17 = load i64, ptr %16, align 8 - %eq5 = icmp eq i64 %17, ptrtoint (ptr @"$ct.int" to i64) - br i1 %eq5, label %if.then6, label %if.exit7 -if.then6: ; preds = %if.exit3 + br label %if.exit6 + +if.exit6: ; preds = %if.then5, %if.exit + store double 1.000000e+00, ptr %taddr7, align 8 + %8 = insertvalue %"any*" undef, ptr %taddr7, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.double" to i64), 1 + store %"any*" %9, ptr %y, align 8 + %10 = insertvalue %"any*" undef, ptr %x, 0 + %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.any$" to i64), 1 + store %"any*" %11, ptr %x, align 8 + %ptradd8 = getelementptr inbounds i8, ptr %y, i64 8 + %12 = load i64, ptr %ptradd8, align 8 + %eq9 = icmp eq i64 %12, ptrtoint (ptr @"$ct.int" to i64) + br i1 %eq9, label %if.then10, label %if.exit11 + +if.then10: ; preds = %if.exit6 call void (ptr, ...) @printf(ptr @.str.7) - br label %if.exit7 -if.exit7: ; preds = %if.then6, %if.exit3 - %18 = getelementptr inbounds %"any*", ptr %x, i32 0, i32 1 - %19 = load i64, ptr %18, align 8 - %eq8 = icmp eq i64 %19, ptrtoint (ptr @"$ct.int" to i64) - br i1 %eq8, label %if.then9, label %if.exit10 -if.then9: ; preds = %if.exit7 + br label %if.exit11 + +if.exit11: ; preds = %if.then10, %if.exit6 + %ptradd12 = getelementptr inbounds i8, ptr %x, i64 8 + %13 = load i64, ptr %ptradd12, align 8 + %eq13 = icmp eq i64 %13, ptrtoint (ptr @"$ct.int" to i64) + br i1 %eq13, label %if.then14, label %if.exit15 + +if.then14: ; preds = %if.exit11 call void (ptr, ...) @printf(ptr @.str.8) - br label %if.exit10 -if.exit10: ; preds = %if.then9, %if.exit7 - %20 = getelementptr inbounds { i64, ptr }, ptr %x, i32 0, i32 0 - %lo = load i64, ptr %20, align 8 - %21 = getelementptr inbounds { i64, ptr }, ptr %x, i32 0, i32 1 - %hi = load ptr, ptr %21, align 8 + br label %if.exit15 + +if.exit15: ; preds = %if.then14, %if.exit11 + %lo = load i64, ptr %x, align 8 + %ptradd16 = getelementptr inbounds i8, ptr %x, i64 8 + %hi = load ptr, ptr %ptradd16, align 8 call void @foo.test(i64 %lo, ptr %hi) - store double 1.000000e+00, ptr %taddr11, align 8 - %22 = insertvalue %"any*" undef, ptr %taddr11, 0 - %23 = insertvalue %"any*" %22, i64 ptrtoint (ptr @"$ct.double" to i64), 1 - store %"any*" %23, ptr %taddr12, align 8 - %24 = getelementptr inbounds { i64, ptr }, ptr %taddr12, i32 0, i32 0 - %lo13 = load i64, ptr %24, align 8 - %25 = getelementptr inbounds { i64, ptr }, ptr %taddr12, i32 0, i32 1 - %hi14 = load ptr, ptr %25, align 8 - call void @foo.test(i64 %lo13, ptr %hi14) - store i32 1, ptr %taddr15, align 4 - %26 = insertvalue %"any*" undef, ptr %taddr15, 0 - %27 = insertvalue %"any*" %26, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %27, ptr %taddr16, align 8 - %28 = getelementptr inbounds { i64, ptr }, ptr %taddr16, i32 0, i32 0 - %lo17 = load i64, ptr %28, align 8 - %29 = getelementptr inbounds { i64, ptr }, ptr %taddr16, i32 0, i32 1 - %hi18 = load ptr, ptr %29, align 8 - call void @foo.test(i64 %lo17, ptr %hi18) - store i8 1, ptr %taddr19, align 1 - %30 = insertvalue %"any*" undef, ptr %taddr19, 0 - %31 = insertvalue %"any*" %30, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - store %"any*" %31, ptr %taddr20, align 8 - %32 = getelementptr inbounds { i64, ptr }, ptr %taddr20, i32 0, i32 0 - %lo21 = load i64, ptr %32, align 8 - %33 = getelementptr inbounds { i64, ptr }, ptr %taddr20, i32 0, i32 1 - %hi22 = load ptr, ptr %33, align 8 - call void @foo.test(i64 %lo21, ptr %hi22) + store double 1.000000e+00, ptr %taddr17, align 8 + %14 = insertvalue %"any*" undef, ptr %taddr17, 0 + %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.double" to i64), 1 + store %"any*" %15, ptr %taddr18, align 8 + %lo19 = load i64, ptr %taddr18, align 8 + %ptradd20 = getelementptr inbounds i8, ptr %taddr18, i64 8 + %hi21 = load ptr, ptr %ptradd20, align 8 + call void @foo.test(i64 %lo19, ptr %hi21) + store i32 1, ptr %taddr22, align 4 + %16 = insertvalue %"any*" undef, ptr %taddr22, 0 + %17 = insertvalue %"any*" %16, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %17, ptr %taddr23, align 8 + %lo24 = load i64, ptr %taddr23, align 8 + %ptradd25 = getelementptr inbounds i8, ptr %taddr23, i64 8 + %hi26 = load ptr, ptr %ptradd25, align 8 + call void @foo.test(i64 %lo24, ptr %hi26) + store i8 1, ptr %taddr27, align 1 + %18 = insertvalue %"any*" undef, ptr %taddr27, 0 + %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %19, ptr %taddr28, align 8 + %lo29 = load i64, ptr %taddr28, align 8 + %ptradd30 = getelementptr inbounds i8, ptr %taddr28, i64 8 + %hi31 = load ptr, ptr %ptradd30, align 8 + call void @foo.test(i64 %lo29, ptr %hi31) call void (ptr, ...) @printf(ptr @.str.9) store ptr null, ptr %df, align 8 - %34 = getelementptr inbounds [5 x %"any*"], ptr %varargslots, i64 0, i64 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 16 %34, ptr align 8 %x, i32 16, i1 false) - %35 = getelementptr inbounds [5 x %"any*"], ptr %varargslots, i64 0, i64 1 - call void @llvm.memcpy.p0.p0.i32(ptr align 16 %35, ptr align 8 %x, i32 16, i1 false) - store double 1.000000e+00, ptr %taddr23, align 8 - %36 = insertvalue %"any*" undef, ptr %taddr23, 0 - %37 = insertvalue %"any*" %36, i64 ptrtoint (ptr @"$ct.double" to i64), 1 - %38 = getelementptr inbounds [5 x %"any*"], ptr %varargslots, i64 0, i64 2 - store %"any*" %37, ptr %38, align 16 - %39 = insertvalue %"any*" undef, ptr %x, 0 - %40 = insertvalue %"any*" %39, i64 ptrtoint (ptr @"$ct.any$" to i64), 1 - %41 = getelementptr inbounds [5 x %"any*"], ptr %varargslots, i64 0, i64 3 - store %"any*" %40, ptr %41, align 16 - %42 = insertvalue %"any*" undef, ptr %df, 0 - %43 = insertvalue %"any*" %42, i64 ptrtoint (ptr @"$ct.p$int" to i64), 1 - %44 = getelementptr inbounds [5 x %"any*"], ptr %varargslots, i64 0, i64 4 - store %"any*" %43, ptr %44, align 16 + call void @llvm.memcpy.p0.p0.i32(ptr align 16 %varargslots, ptr align 8 %x, i32 16, i1 false) + %ptradd32 = getelementptr inbounds i8, ptr %varargslots, i64 16 + call void @llvm.memcpy.p0.p0.i32(ptr align 16 %ptradd32, ptr align 8 %x, i32 16, i1 false) + store double 1.000000e+00, ptr %taddr33, align 8 + %20 = insertvalue %"any*" undef, ptr %taddr33, 0 + %21 = insertvalue %"any*" %20, i64 ptrtoint (ptr @"$ct.double" to i64), 1 + %ptradd34 = getelementptr inbounds i8, ptr %varargslots, i64 32 + store %"any*" %21, ptr %ptradd34, align 16 + %22 = insertvalue %"any*" undef, ptr %x, 0 + %23 = insertvalue %"any*" %22, i64 ptrtoint (ptr @"$ct.any$" to i64), 1 + %ptradd35 = getelementptr inbounds i8, ptr %varargslots, i64 48 + store %"any*" %23, ptr %ptradd35, align 16 + %24 = insertvalue %"any*" undef, ptr %df, 0 + %25 = insertvalue %"any*" %24, i64 ptrtoint (ptr @"$ct.p$int" to i64), 1 + %ptradd36 = getelementptr inbounds i8, ptr %varargslots, i64 64 + store %"any*" %25, ptr %ptradd36, align 16 call void @foo.test_all(ptr %varargslots, i64 5) ret void } diff --git a/test/test_suite/arrays/array_bounds_check.c3t b/test/test_suite/arrays/array_bounds_check.c3t index 7b1171eeb..433fd9f66 100644 --- a/test/test_suite/arrays/array_bounds_check.c3t +++ b/test/test_suite/arrays/array_bounds_check.c3t @@ -27,6 +27,20 @@ loop.cond: ; preds = %checkok, %entry loop.body: ; preds = %loop.cond %1 = load i64, ptr %i, align 8 %ge = icmp uge i64 %1, 2 - br i1 %ge, label %panic, label %checkok + %2 = call i1 @llvm.expect.i1(i1 %ge, i1 false) + br i1 %2, label %panic, label %checkok + +checkok: ; preds = %loop.body + %ptroffset = getelementptr inbounds [4 x i8], ptr @testing.FOO, i64 %1 + %3 = load i32, ptr %ptroffset, align 4 + store i32 %3, ptr %x, align 4 + %4 = load i64, ptr %i, align 8 + %add = add i64 %4, 1 + store i64 %add, ptr %i, align 8 + br label %loop.cond + +loop.exit: ; preds = %loop.cond + ret i64 0 + panic: ; preds = %loop.body store i64 2, ptr %taddr, align 8 diff --git a/test/test_suite/arrays/array_casts.c3t b/test/test_suite/arrays/array_casts.c3t index 04c31c96b..f769e4678 100644 --- a/test/test_suite/arrays/array_casts.c3t +++ b/test/test_suite/arrays/array_casts.c3t @@ -18,15 +18,14 @@ entry: %x = alloca [3 x i32], align 4 %y = alloca ptr, align 8 %z = alloca %"int[]", align 8 - %0 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 0 - store i32 0, ptr %0, align 4 - %1 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - store i32 0, ptr %1, align 4 - %2 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 2 - store i32 0, ptr %2, align 4 + store i32 0, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + store i32 0, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + store i32 0, ptr %ptradd1, align 4 store ptr %x, ptr %y, align 8 - %3 = insertvalue %"int[]" undef, ptr %x, 0 - %4 = insertvalue %"int[]" %3, i64 3, 1 - store %"int[]" %4, ptr %z, align 8 + %0 = insertvalue %"int[]" undef, ptr %x, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + store %"int[]" %1, ptr %z, align 8 ret void } \ No newline at end of file diff --git a/test/test_suite/arrays/array_comparison.c3t b/test/test_suite/arrays/array_comparison.c3t index 57eb87003..38b1f4359 100644 --- a/test/test_suite/arrays/array_comparison.c3t +++ b/test/test_suite/arrays/array_comparison.c3t @@ -78,150 +78,138 @@ entry: %y3 = alloca i8, align 1 call void @get(ptr %a) call void @get(ptr %b) - %0 = getelementptr inbounds [2 x double], ptr %a, i64 0, i64 0 - %1 = getelementptr inbounds [2 x double], ptr %b, i64 0, i64 0 - %2 = load double, ptr %0, align 8 - %3 = load double, ptr %1, align 8 - %eq = fcmp oeq double %2, %3 + %0 = load double, ptr %a, align 8 + %1 = load double, ptr %b, align 8 + %eq = fcmp oeq double %0, %1 br i1 %eq, label %next_check, label %exit next_check: ; preds = %entry - %4 = getelementptr inbounds [2 x double], ptr %a, i64 0, i64 1 - %5 = getelementptr inbounds [2 x double], ptr %b, i64 0, i64 1 - %6 = load double, ptr %4, align 8 - %7 = load double, ptr %5, align 8 - %eq1 = fcmp oeq double %6, %7 - br i1 %eq1, label %match, label %exit + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 + %ptradd1 = getelementptr inbounds i8, ptr %b, i64 8 + %2 = load double, ptr %ptradd, align 8 + %3 = load double, ptr %ptradd1, align 8 + %eq2 = fcmp oeq double %2, %3 + br i1 %eq2, label %match, label %exit match: ; preds = %next_check br label %exit exit: ; preds = %match, %next_check, %entry %array_cmp_phi = phi i1 [ false, %entry ], [ false, %next_check ], [ true, %match ] - %8 = zext i1 %array_cmp_phi to i8 - store i8 %8, ptr %x, align 1 - %9 = getelementptr inbounds [2 x double], ptr %a, i64 0, i64 0 - %10 = getelementptr inbounds [2 x double], ptr %b, i64 0, i64 0 - %11 = load double, ptr %9, align 8 - %12 = load double, ptr %10, align 8 - %eq2 = fcmp oeq double %11, %12 - br i1 %eq2, label %next_check3, label %exit6 - -next_check3: ; preds = %exit - %13 = getelementptr inbounds [2 x double], ptr %a, i64 0, i64 1 - %14 = getelementptr inbounds [2 x double], ptr %b, i64 0, i64 1 - %15 = load double, ptr %13, align 8 - %16 = load double, ptr %14, align 8 - %eq4 = fcmp oeq double %15, %16 - br i1 %eq4, label %match5, label %exit6 - -match5: ; preds = %next_check3 - br label %exit6 - -exit6: ; preds = %match5, %next_check3, %exit - %array_cmp_phi7 = phi i1 [ true, %exit ], [ true, %next_check3 ], [ false, %match5 ] - %17 = zext i1 %array_cmp_phi7 to i8 - store i8 %17, ptr %y, align 1 + %4 = zext i1 %array_cmp_phi to i8 + store i8 %4, ptr %x, align 1 + %5 = load double, ptr %a, align 8 + %6 = load double, ptr %b, align 8 + %eq3 = fcmp oeq double %5, %6 + br i1 %eq3, label %next_check4, label %exit9 + +next_check4: ; preds = %exit + %ptradd5 = getelementptr inbounds i8, ptr %a, i64 8 + %ptradd6 = getelementptr inbounds i8, ptr %b, i64 8 + %7 = load double, ptr %ptradd5, align 8 + %8 = load double, ptr %ptradd6, align 8 + %eq7 = fcmp oeq double %7, %8 + br i1 %eq7, label %match8, label %exit9 + +match8: ; preds = %next_check4 + br label %exit9 + +exit9: ; preds = %match8, %next_check4, %exit + %array_cmp_phi10 = phi i1 [ true, %exit ], [ true, %next_check4 ], [ false, %match8 ] + %9 = zext i1 %array_cmp_phi10 to i8 + store i8 %9, ptr %y, align 1 call void @get2(ptr %a2) call void @get2(ptr %b2) - %18 = getelementptr inbounds [2 x i32], ptr %a2, i64 0, i64 0 - %19 = getelementptr inbounds [2 x i32], ptr %b2, i64 0, i64 0 - %20 = load i32, ptr %18, align 4 - %21 = load i32, ptr %19, align 4 - %eq8 = icmp eq i32 %20, %21 - br i1 %eq8, label %next_check9, label %exit12 - -next_check9: ; preds = %exit6 - %22 = getelementptr inbounds [2 x i32], ptr %a2, i64 0, i64 1 - %23 = getelementptr inbounds [2 x i32], ptr %b2, i64 0, i64 1 - %24 = load i32, ptr %22, align 4 - %25 = load i32, ptr %23, align 4 - %eq10 = icmp eq i32 %24, %25 - br i1 %eq10, label %match11, label %exit12 - -match11: ; preds = %next_check9 - br label %exit12 - -exit12: ; preds = %match11, %next_check9, %exit6 - %array_cmp_phi13 = phi i1 [ false, %exit6 ], [ false, %next_check9 ], [ true, %match11 ] - %26 = zext i1 %array_cmp_phi13 to i8 - store i8 %26, ptr %x2, align 1 - %27 = getelementptr inbounds [2 x i32], ptr %a2, i64 0, i64 0 - %28 = getelementptr inbounds [2 x i32], ptr %b2, i64 0, i64 0 - %29 = load i32, ptr %27, align 4 - %30 = load i32, ptr %28, align 4 - %eq14 = icmp eq i32 %29, %30 - br i1 %eq14, label %next_check15, label %exit18 - -next_check15: ; preds = %exit12 - %31 = getelementptr inbounds [2 x i32], ptr %a2, i64 0, i64 1 - %32 = getelementptr inbounds [2 x i32], ptr %b2, i64 0, i64 1 - %33 = load i32, ptr %31, align 4 - %34 = load i32, ptr %32, align 4 - %eq16 = icmp eq i32 %33, %34 - br i1 %eq16, label %match17, label %exit18 - -match17: ; preds = %next_check15 - br label %exit18 - -exit18: ; preds = %match17, %next_check15, %exit12 - %array_cmp_phi19 = phi i1 [ true, %exit12 ], [ true, %next_check15 ], [ false, %match17 ] - %35 = zext i1 %array_cmp_phi19 to i8 - store i8 %35, ptr %y2, align 1 + %10 = load i32, ptr %a2, align 4 + %11 = load i32, ptr %b2, align 4 + %eq11 = icmp eq i32 %10, %11 + br i1 %eq11, label %next_check12, label %exit17 + +next_check12: ; preds = %exit9 + %ptradd13 = getelementptr inbounds i8, ptr %a2, i64 4 + %ptradd14 = getelementptr inbounds i8, ptr %b2, i64 4 + %12 = load i32, ptr %ptradd13, align 4 + %13 = load i32, ptr %ptradd14, align 4 + %eq15 = icmp eq i32 %12, %13 + br i1 %eq15, label %match16, label %exit17 + +match16: ; preds = %next_check12 + br label %exit17 + +exit17: ; preds = %match16, %next_check12, %exit9 + %array_cmp_phi18 = phi i1 [ false, %exit9 ], [ false, %next_check12 ], [ true, %match16 ] + %14 = zext i1 %array_cmp_phi18 to i8 + store i8 %14, ptr %x2, align 1 + %15 = load i32, ptr %a2, align 4 + %16 = load i32, ptr %b2, align 4 + %eq19 = icmp eq i32 %15, %16 + br i1 %eq19, label %next_check20, label %exit25 + +next_check20: ; preds = %exit17 + %ptradd21 = getelementptr inbounds i8, ptr %a2, i64 4 + %ptradd22 = getelementptr inbounds i8, ptr %b2, i64 4 + %17 = load i32, ptr %ptradd21, align 4 + %18 = load i32, ptr %ptradd22, align 4 + %eq23 = icmp eq i32 %17, %18 + br i1 %eq23, label %match24, label %exit25 + +match24: ; preds = %next_check20 + br label %exit25 + +exit25: ; preds = %match24, %next_check20, %exit17 + %array_cmp_phi26 = phi i1 [ true, %exit17 ], [ true, %next_check20 ], [ false, %match24 ] + %19 = zext i1 %array_cmp_phi26 to i8 + store i8 %19, ptr %y2, align 1 call void @get3(ptr %a3) call void @get3(ptr %b3) - %36 = getelementptr inbounds [2 x i8], ptr %a3, i64 0, i64 0 - %37 = getelementptr inbounds [2 x i8], ptr %b3, i64 0, i64 0 - %38 = load i8, ptr %36, align 1 - %39 = trunc i8 %38 to i1 - %40 = load i8, ptr %37, align 1 - %41 = trunc i8 %40 to i1 - %eq20 = icmp eq i1 %39, %41 - br i1 %eq20, label %next_check21, label %exit24 - -next_check21: ; preds = %exit18 - %42 = getelementptr inbounds [2 x i8], ptr %a3, i64 0, i64 1 - %43 = getelementptr inbounds [2 x i8], ptr %b3, i64 0, i64 1 - %44 = load i8, ptr %42, align 1 - %45 = trunc i8 %44 to i1 - %46 = load i8, ptr %43, align 1 - %47 = trunc i8 %46 to i1 - %eq22 = icmp eq i1 %45, %47 - br i1 %eq22, label %match23, label %exit24 - -match23: ; preds = %next_check21 - br label %exit24 - -exit24: ; preds = %match23, %next_check21, %exit18 - %array_cmp_phi25 = phi i1 [ false, %exit18 ], [ false, %next_check21 ], [ true, %match23 ] - %48 = zext i1 %array_cmp_phi25 to i8 - store i8 %48, ptr %x3, align 1 - %49 = getelementptr inbounds [2 x i8], ptr %a3, i64 0, i64 0 - %50 = getelementptr inbounds [2 x i8], ptr %b3, i64 0, i64 0 - %51 = load i8, ptr %49, align 1 - %52 = trunc i8 %51 to i1 - %53 = load i8, ptr %50, align 1 - %54 = trunc i8 %53 to i1 - %eq26 = icmp eq i1 %52, %54 - br i1 %eq26, label %next_check27, label %exit30 - -next_check27: ; preds = %exit24 - %55 = getelementptr inbounds [2 x i8], ptr %a3, i64 0, i64 1 - %56 = getelementptr inbounds [2 x i8], ptr %b3, i64 0, i64 1 - %57 = load i8, ptr %55, align 1 - %58 = trunc i8 %57 to i1 - %59 = load i8, ptr %56, align 1 - %60 = trunc i8 %59 to i1 - %eq28 = icmp eq i1 %58, %60 - br i1 %eq28, label %match29, label %exit30 - -match29: ; preds = %next_check27 - br label %exit30 - -exit30: ; preds = %match29, %next_check27, %exit24 - %array_cmp_phi31 = phi i1 [ true, %exit24 ], [ true, %next_check27 ], [ false, %match29 ] - %61 = zext i1 %array_cmp_phi31 to i8 - store i8 %61, ptr %y3, align 1 + %20 = load i8, ptr %a3, align 1 + %21 = trunc i8 %20 to i1 + %22 = load i8, ptr %b3, align 1 + %23 = trunc i8 %22 to i1 + %eq27 = icmp eq i1 %21, %23 + br i1 %eq27, label %next_check28, label %exit33 + +next_check28: ; preds = %exit25 + %ptradd29 = getelementptr inbounds i8, ptr %a3, i64 1 + %ptradd30 = getelementptr inbounds i8, ptr %b3, i64 1 + %24 = load i8, ptr %ptradd29, align 1 + %25 = trunc i8 %24 to i1 + %26 = load i8, ptr %ptradd30, align 1 + %27 = trunc i8 %26 to i1 + %eq31 = icmp eq i1 %25, %27 + br i1 %eq31, label %match32, label %exit33 + +match32: ; preds = %next_check28 + br label %exit33 + +exit33: ; preds = %match32, %next_check28, %exit25 + %array_cmp_phi34 = phi i1 [ false, %exit25 ], [ false, %next_check28 ], [ true, %match32 ] + %28 = zext i1 %array_cmp_phi34 to i8 + store i8 %28, ptr %x3, align 1 + %29 = load i8, ptr %a3, align 1 + %30 = trunc i8 %29 to i1 + %31 = load i8, ptr %b3, align 1 + %32 = trunc i8 %31 to i1 + %eq35 = icmp eq i1 %30, %32 + br i1 %eq35, label %next_check36, label %exit41 + +next_check36: ; preds = %exit33 + %ptradd37 = getelementptr inbounds i8, ptr %a3, i64 1 + %ptradd38 = getelementptr inbounds i8, ptr %b3, i64 1 + %33 = load i8, ptr %ptradd37, align 1 + %34 = trunc i8 %33 to i1 + %35 = load i8, ptr %ptradd38, align 1 + %36 = trunc i8 %35 to i1 + %eq39 = icmp eq i1 %34, %36 + br i1 %eq39, label %match40, label %exit41 + +match40: ; preds = %next_check36 + br label %exit41 + +exit41: ; preds = %match40, %next_check36, %exit33 + %array_cmp_phi42 = phi i1 [ true, %exit33 ], [ true, %next_check36 ], [ false, %match40 ] + %37 = zext i1 %array_cmp_phi42 to i8 + store i8 %37, ptr %y3, align 1 ret void } define void @test.test2() #0 { @@ -231,19 +219,19 @@ entry: %x = alloca i8, align 1 %cmp.idx = alloca i64, align 8 %y = alloca i8, align 1 - %cmp.idx1 = alloca i64, align 8 + %cmp.idx2 = alloca i64, align 8 %a2 = alloca [200 x i32], align 16 %b2 = alloca [200 x i32], align 16 %x2 = alloca i8, align 1 - %cmp.idx9 = alloca i64, align 8 + %cmp.idx12 = alloca i64, align 8 %y2 = alloca i8, align 1 - %cmp.idx17 = alloca i64, align 8 + %cmp.idx22 = alloca i64, align 8 %a3 = alloca [200 x i8], align 16 %b3 = alloca [200 x i8], align 16 %x3 = alloca i8, align 1 - %cmp.idx25 = alloca i64, align 8 + %cmp.idx32 = alloca i64, align 8 %y3 = alloca i8, align 1 - %cmp.idx33 = alloca i64, align 8 + %cmp.idx41 = alloca i64, align 8 call void @aget(ptr %a) call void @aget(ptr %b) store i64 0, ptr %cmp.idx, align 8 @@ -251,11 +239,11 @@ entry: array_loop_start: ; preds = %array_loop_comparison, %entry %0 = load i64, ptr %cmp.idx, align 8 - %1 = getelementptr inbounds [200 x double], ptr %a, i64 0, i64 %0 - %2 = getelementptr inbounds [200 x double], ptr %b, i64 0, i64 %0 - %3 = load double, ptr %1, align 8 - %4 = load double, ptr %2, align 8 - %eq = fcmp oeq double %3, %4 + %ptroffset = getelementptr inbounds [8 x i8], ptr %a, i64 %0 + %ptroffset1 = getelementptr inbounds [8 x i8], ptr %b, i64 %0 + %1 = load double, ptr %ptroffset, align 8 + %2 = load double, ptr %ptroffset1, align 8 + %eq = fcmp oeq double %1, %2 br i1 %eq, label %array_loop_comparison, label %array_cmp_exit array_loop_comparison: ; preds = %array_loop_start @@ -266,125 +254,125 @@ array_loop_comparison: ; preds = %array_loop_start array_cmp_exit: ; preds = %array_loop_comparison, %array_loop_start %array_cmp_phi = phi i1 [ true, %array_loop_comparison ], [ false, %array_loop_start ] - %5 = zext i1 %array_cmp_phi to i8 - store i8 %5, ptr %x, align 1 - store i64 0, ptr %cmp.idx1, align 8 - br label %array_loop_start2 - -array_loop_start2: ; preds = %array_loop_comparison4, %array_cmp_exit - %6 = load i64, ptr %cmp.idx1, align 8 - %7 = getelementptr inbounds [200 x double], ptr %a, i64 0, i64 %6 - %8 = getelementptr inbounds [200 x double], ptr %b, i64 0, i64 %6 - %9 = load double, ptr %7, align 8 - %10 = load double, ptr %8, align 8 - %eq3 = fcmp oeq double %9, %10 - br i1 %eq3, label %array_loop_comparison4, label %array_cmp_exit7 - -array_loop_comparison4: ; preds = %array_loop_start2 - %inc5 = add i64 %6, 1 - store i64 %inc5, ptr %cmp.idx1, align 8 - %lt6 = icmp ult i64 %inc5, 200 - br i1 %lt6, label %array_loop_start2, label %array_cmp_exit7 - -array_cmp_exit7: ; preds = %array_loop_comparison4, %array_loop_start2 - %array_cmp_phi8 = phi i1 [ false, %array_loop_comparison4 ], [ true, %array_loop_start2 ] - %11 = zext i1 %array_cmp_phi8 to i8 - store i8 %11, ptr %y, align 1 + %3 = zext i1 %array_cmp_phi to i8 + store i8 %3, ptr %x, align 1 + store i64 0, ptr %cmp.idx2, align 8 + br label %array_loop_start3 + +array_loop_start3: ; preds = %array_loop_comparison7, %array_cmp_exit + %4 = load i64, ptr %cmp.idx2, align 8 + %ptroffset4 = getelementptr inbounds [8 x i8], ptr %a, i64 %4 + %ptroffset5 = getelementptr inbounds [8 x i8], ptr %b, i64 %4 + %5 = load double, ptr %ptroffset4, align 8 + %6 = load double, ptr %ptroffset5, align 8 + %eq6 = fcmp oeq double %5, %6 + br i1 %eq6, label %array_loop_comparison7, label %array_cmp_exit10 + +array_loop_comparison7: ; preds = %array_loop_start3 + %inc8 = add i64 %4, 1 + store i64 %inc8, ptr %cmp.idx2, align 8 + %lt9 = icmp ult i64 %inc8, 200 + br i1 %lt9, label %array_loop_start3, label %array_cmp_exit10 + +array_cmp_exit10: ; preds = %array_loop_comparison7, %array_loop_start3 + %array_cmp_phi11 = phi i1 [ false, %array_loop_comparison7 ], [ true, %array_loop_start3 ] + %7 = zext i1 %array_cmp_phi11 to i8 + store i8 %7, ptr %y, align 1 call void @aget2(ptr %a2) call void @aget2(ptr %b2) - store i64 0, ptr %cmp.idx9, align 8 - br label %array_loop_start10 - -array_loop_start10: ; preds = %array_loop_comparison12, %array_cmp_exit7 - %12 = load i64, ptr %cmp.idx9, align 8 - %13 = getelementptr inbounds [200 x i32], ptr %a2, i64 0, i64 %12 - %14 = getelementptr inbounds [200 x i32], ptr %b2, i64 0, i64 %12 - %15 = load i32, ptr %13, align 4 - %16 = load i32, ptr %14, align 4 - %eq11 = icmp eq i32 %15, %16 - br i1 %eq11, label %array_loop_comparison12, label %array_cmp_exit15 - -array_loop_comparison12: ; preds = %array_loop_start10 - %inc13 = add i64 %12, 1 - store i64 %inc13, ptr %cmp.idx9, align 8 - %lt14 = icmp ult i64 %inc13, 200 - br i1 %lt14, label %array_loop_start10, label %array_cmp_exit15 - -array_cmp_exit15: ; preds = %array_loop_comparison12, %array_loop_start10 - %array_cmp_phi16 = phi i1 [ true, %array_loop_comparison12 ], [ false, %array_loop_start10 ] - %17 = zext i1 %array_cmp_phi16 to i8 - store i8 %17, ptr %x2, align 1 - store i64 0, ptr %cmp.idx17, align 8 - br label %array_loop_start18 - -array_loop_start18: ; preds = %array_loop_comparison20, %array_cmp_exit15 - %18 = load i64, ptr %cmp.idx17, align 8 - %19 = getelementptr inbounds [200 x i32], ptr %a2, i64 0, i64 %18 - %20 = getelementptr inbounds [200 x i32], ptr %b2, i64 0, i64 %18 - %21 = load i32, ptr %19, align 4 - %22 = load i32, ptr %20, align 4 - %eq19 = icmp eq i32 %21, %22 - br i1 %eq19, label %array_loop_comparison20, label %array_cmp_exit23 - -array_loop_comparison20: ; preds = %array_loop_start18 - %inc21 = add i64 %18, 1 - store i64 %inc21, ptr %cmp.idx17, align 8 - %lt22 = icmp ult i64 %inc21, 200 - br i1 %lt22, label %array_loop_start18, label %array_cmp_exit23 - -array_cmp_exit23: ; preds = %array_loop_comparison20, %array_loop_start18 - %array_cmp_phi24 = phi i1 [ false, %array_loop_comparison20 ], [ true, %array_loop_start18 ] - %23 = zext i1 %array_cmp_phi24 to i8 - store i8 %23, ptr %y2, align 1 + store i64 0, ptr %cmp.idx12, align 8 + br label %array_loop_start13 + +array_loop_start13: ; preds = %array_loop_comparison17, %array_cmp_exit10 + %8 = load i64, ptr %cmp.idx12, align 8 + %ptroffset14 = getelementptr inbounds [4 x i8], ptr %a2, i64 %8 + %ptroffset15 = getelementptr inbounds [4 x i8], ptr %b2, i64 %8 + %9 = load i32, ptr %ptroffset14, align 4 + %10 = load i32, ptr %ptroffset15, align 4 + %eq16 = icmp eq i32 %9, %10 + br i1 %eq16, label %array_loop_comparison17, label %array_cmp_exit20 + +array_loop_comparison17: ; preds = %array_loop_start13 + %inc18 = add i64 %8, 1 + store i64 %inc18, ptr %cmp.idx12, align 8 + %lt19 = icmp ult i64 %inc18, 200 + br i1 %lt19, label %array_loop_start13, label %array_cmp_exit20 + +array_cmp_exit20: ; preds = %array_loop_comparison17, %array_loop_start13 + %array_cmp_phi21 = phi i1 [ true, %array_loop_comparison17 ], [ false, %array_loop_start13 ] + %11 = zext i1 %array_cmp_phi21 to i8 + store i8 %11, ptr %x2, align 1 + store i64 0, ptr %cmp.idx22, align 8 + br label %array_loop_start23 + +array_loop_start23: ; preds = %array_loop_comparison27, %array_cmp_exit20 + %12 = load i64, ptr %cmp.idx22, align 8 + %ptroffset24 = getelementptr inbounds [4 x i8], ptr %a2, i64 %12 + %ptroffset25 = getelementptr inbounds [4 x i8], ptr %b2, i64 %12 + %13 = load i32, ptr %ptroffset24, align 4 + %14 = load i32, ptr %ptroffset25, align 4 + %eq26 = icmp eq i32 %13, %14 + br i1 %eq26, label %array_loop_comparison27, label %array_cmp_exit30 + +array_loop_comparison27: ; preds = %array_loop_start23 + %inc28 = add i64 %12, 1 + store i64 %inc28, ptr %cmp.idx22, align 8 + %lt29 = icmp ult i64 %inc28, 200 + br i1 %lt29, label %array_loop_start23, label %array_cmp_exit30 + +array_cmp_exit30: ; preds = %array_loop_comparison27, %array_loop_start23 + %array_cmp_phi31 = phi i1 [ false, %array_loop_comparison27 ], [ true, %array_loop_start23 ] + %15 = zext i1 %array_cmp_phi31 to i8 + store i8 %15, ptr %y2, align 1 call void @aget3(ptr %a3) call void @aget3(ptr %b3) - store i64 0, ptr %cmp.idx25, align 8 - br label %array_loop_start26 - -array_loop_start26: ; preds = %array_loop_comparison28, %array_cmp_exit23 - %24 = load i64, ptr %cmp.idx25, align 8 - %25 = getelementptr inbounds [200 x i8], ptr %a3, i64 0, i64 %24 - %26 = getelementptr inbounds [200 x i8], ptr %b3, i64 0, i64 %24 - %27 = load i8, ptr %25, align 1 - %28 = trunc i8 %27 to i1 - %29 = load i8, ptr %26, align 1 - %30 = trunc i8 %29 to i1 - %eq27 = icmp eq i1 %28, %30 - br i1 %eq27, label %array_loop_comparison28, label %array_cmp_exit31 - -array_loop_comparison28: ; preds = %array_loop_start26 - %inc29 = add i64 %24, 1 - store i64 %inc29, ptr %cmp.idx25, align 8 - %lt30 = icmp ult i64 %inc29, 200 - br i1 %lt30, label %array_loop_start26, label %array_cmp_exit31 - -array_cmp_exit31: ; preds = %array_loop_comparison28, %array_loop_start26 - %array_cmp_phi32 = phi i1 [ true, %array_loop_comparison28 ], [ false, %array_loop_start26 ] - %31 = zext i1 %array_cmp_phi32 to i8 - store i8 %31, ptr %x3, align 1 - store i64 0, ptr %cmp.idx33, align 8 - br label %array_loop_start34 - -array_loop_start34: ; preds = %array_loop_comparison36, %array_cmp_exit31 - %32 = load i64, ptr %cmp.idx33, align 8 - %33 = getelementptr inbounds [200 x i8], ptr %a3, i64 0, i64 %32 - %34 = getelementptr inbounds [200 x i8], ptr %b3, i64 0, i64 %32 - %35 = load i8, ptr %33, align 1 - %36 = trunc i8 %35 to i1 - %37 = load i8, ptr %34, align 1 - %38 = trunc i8 %37 to i1 - %eq35 = icmp eq i1 %36, %38 + store i64 0, ptr %cmp.idx32, align 8 + br label %array_loop_start33 + +array_loop_start33: ; preds = %array_loop_comparison36, %array_cmp_exit30 + %16 = load i64, ptr %cmp.idx32, align 8 + %ptradd = getelementptr inbounds i8, ptr %a3, i64 %16 + %ptradd34 = getelementptr inbounds i8, ptr %b3, i64 %16 + %17 = load i8, ptr %ptradd, align 1 + %18 = trunc i8 %17 to i1 + %19 = load i8, ptr %ptradd34, align 1 + %20 = trunc i8 %19 to i1 + %eq35 = icmp eq i1 %18, %20 br i1 %eq35, label %array_loop_comparison36, label %array_cmp_exit39 -array_loop_comparison36: ; preds = %array_loop_start34 - %inc37 = add i64 %32, 1 - store i64 %inc37, ptr %cmp.idx33, align 8 +array_loop_comparison36: ; preds = %array_loop_start33 + %inc37 = add i64 %16, 1 + store i64 %inc37, ptr %cmp.idx32, align 8 %lt38 = icmp ult i64 %inc37, 200 - br i1 %lt38, label %array_loop_start34, label %array_cmp_exit39 - -array_cmp_exit39: ; preds = %array_loop_comparison36, %array_loop_start34 - %array_cmp_phi40 = phi i1 [ false, %array_loop_comparison36 ], [ true, %array_loop_start34 ] - %39 = zext i1 %array_cmp_phi40 to i8 - store i8 %39, ptr %y3, align 1 + br i1 %lt38, label %array_loop_start33, label %array_cmp_exit39 + +array_cmp_exit39: ; preds = %array_loop_comparison36, %array_loop_start33 + %array_cmp_phi40 = phi i1 [ true, %array_loop_comparison36 ], [ false, %array_loop_start33 ] + %21 = zext i1 %array_cmp_phi40 to i8 + store i8 %21, ptr %x3, align 1 + store i64 0, ptr %cmp.idx41, align 8 + br label %array_loop_start42 + +array_loop_start42: ; preds = %array_loop_comparison46, %array_cmp_exit39 + %22 = load i64, ptr %cmp.idx41, align 8 + %ptradd43 = getelementptr inbounds i8, ptr %a3, i64 %22 + %ptradd44 = getelementptr inbounds i8, ptr %b3, i64 %22 + %23 = load i8, ptr %ptradd43, align 1 + %24 = trunc i8 %23 to i1 + %25 = load i8, ptr %ptradd44, align 1 + %26 = trunc i8 %25 to i1 + %eq45 = icmp eq i1 %24, %26 + br i1 %eq45, label %array_loop_comparison46, label %array_cmp_exit49 + +array_loop_comparison46: ; preds = %array_loop_start42 + %inc47 = add i64 %22, 1 + store i64 %inc47, ptr %cmp.idx41, align 8 + %lt48 = icmp ult i64 %inc47, 200 + br i1 %lt48, label %array_loop_start42, label %array_cmp_exit49 + +array_cmp_exit49: ; preds = %array_loop_comparison46, %array_loop_start42 + %array_cmp_phi50 = phi i1 [ false, %array_loop_comparison46 ], [ true, %array_loop_start42 ] + %27 = zext i1 %array_cmp_phi50 to i8 + store i8 %27, ptr %y3, align 1 ret void } diff --git a/test/test_suite/arrays/array_comparison_2.c3t b/test/test_suite/arrays/array_comparison_2.c3t index 60a1faa9a..673f16b87 100644 --- a/test/test_suite/arrays/array_comparison_2.c3t +++ b/test/test_suite/arrays/array_comparison_2.c3t @@ -21,136 +21,139 @@ entry: %z = alloca [8 x [2 x [2 x i32]]], align 16 %w = alloca [8 x [2 x [2 x i32]]], align 16 %cmp.idx = alloca i64, align 8 - %0 = getelementptr inbounds [2 x [2 x i32]], ptr %x, i64 0, i64 0 - %1 = getelementptr inbounds [2 x i32], ptr %0, i64 0, i64 0 - store i32 0, ptr %1, align 4 - %2 = getelementptr inbounds [2 x i32], ptr %0, i64 0, i64 1 - store i32 0, ptr %2, align 4 - %3 = getelementptr inbounds [2 x [2 x i32]], ptr %x, i64 0, i64 1 - %4 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 0 - store i32 0, ptr %4, align 4 - %5 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 1 - store i32 0, ptr %5, align 4 - %6 = getelementptr inbounds [2 x [2 x i32]], ptr %y, i64 0, i64 0 - %7 = getelementptr inbounds [2 x i32], ptr %6, i64 0, i64 0 - store i32 0, ptr %7, align 4 - %8 = getelementptr inbounds [2 x i32], ptr %6, i64 0, i64 1 - store i32 0, ptr %8, align 4 - %9 = getelementptr inbounds [2 x [2 x i32]], ptr %y, i64 0, i64 1 - %10 = getelementptr inbounds [2 x i32], ptr %9, i64 0, i64 0 - store i32 0, ptr %10, align 4 - %11 = getelementptr inbounds [2 x i32], ptr %9, i64 0, i64 1 - store i32 0, ptr %11, align 4 - %12 = getelementptr inbounds [2 x [2 x i32]], ptr %x, i64 0, i64 0 - %13 = getelementptr inbounds [2 x [2 x i32]], ptr %y, i64 0, i64 0 - %14 = getelementptr inbounds [2 x i32], ptr %12, i64 0, i64 0 - %15 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 0 - %16 = load i32, ptr %14, align 4 - %17 = load i32, ptr %15, align 4 - %eq = icmp eq i32 %16, %17 + store i32 0, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + store i32 0, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + store i32 0, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %ptradd1, i64 4 + store i32 0, ptr %ptradd2, align 4 + store i32 0, ptr %y, align 4 + %ptradd3 = getelementptr inbounds i8, ptr %y, i64 4 + store i32 0, ptr %ptradd3, align 4 + %ptradd4 = getelementptr inbounds i8, ptr %y, i64 8 + store i32 0, ptr %ptradd4, align 4 + %ptradd5 = getelementptr inbounds i8, ptr %ptradd4, i64 4 + store i32 0, ptr %ptradd5, align 4 + %0 = load i32, ptr %x, align 4 + %1 = load i32, ptr %y, align 4 + %eq = icmp eq i32 %0, %1 br i1 %eq, label %next_check, label %exit + next_check: ; preds = %entry - %18 = getelementptr inbounds [2 x i32], ptr %12, i64 0, i64 1 - %19 = getelementptr inbounds [2 x i32], ptr %13, i64 0, i64 1 - %20 = load i32, ptr %18, align 4 - %21 = load i32, ptr %19, align 4 - %eq1 = icmp eq i32 %20, %21 - br i1 %eq1, label %match2, label %exit -match2: ; preds = %next_check + %ptradd6 = getelementptr inbounds i8, ptr %x, i64 4 + %ptradd7 = getelementptr inbounds i8, ptr %y, i64 4 + %2 = load i32, ptr %ptradd6, align 4 + %3 = load i32, ptr %ptradd7, align 4 + %eq8 = icmp eq i32 %2, %3 + br i1 %eq8, label %match9, label %exit + +match9: ; preds = %next_check br label %exit -exit: ; preds = %match2, %next_check, %entry - %array_cmp_phi = phi i1 [ false, %entry ], [ false, %next_check ], [ true, %match2 ] - br i1 %array_cmp_phi, label %next_check3, label %exit11 -next_check3: ; preds = %exit - %22 = getelementptr inbounds [2 x [2 x i32]], ptr %x, i64 0, i64 1 - %23 = getelementptr inbounds [2 x [2 x i32]], ptr %y, i64 0, i64 1 - %24 = getelementptr inbounds [2 x i32], ptr %22, i64 0, i64 0 - %25 = getelementptr inbounds [2 x i32], ptr %23, i64 0, i64 0 - %26 = load i32, ptr %24, align 4 - %27 = load i32, ptr %25, align 4 - %eq4 = icmp eq i32 %26, %27 - br i1 %eq4, label %next_check5, label %exit8 -next_check5: ; preds = %next_check3 - %28 = getelementptr inbounds [2 x i32], ptr %22, i64 0, i64 1 - %29 = getelementptr inbounds [2 x i32], ptr %23, i64 0, i64 1 - %30 = load i32, ptr %28, align 4 - %31 = load i32, ptr %29, align 4 - %eq6 = icmp eq i32 %30, %31 - br i1 %eq6, label %match7, label %exit8 -match7: ; preds = %next_check5 - br label %exit8 -exit8: ; preds = %match7, %next_check5, %next_check3 - %array_cmp_phi9 = phi i1 [ false, %next_check3 ], [ false, %next_check5 ], [ true, %match7 ] - br i1 %array_cmp_phi9, label %match10, label %exit11 -match10: ; preds = %exit8 - br label %exit11 -exit11: ; preds = %match10, %exit8, %exit - %array_cmp_phi12 = phi i1 [ false, %exit ], [ false, %exit8 ], [ true, %match10 ] - %32 = zext i1 %array_cmp_phi12 to i8 - store i8 %32, ptr %match, align 1 + +exit: ; preds = %match9, %next_check, %entry + %array_cmp_phi = phi i1 [ false, %entry ], [ false, %next_check ], [ true, %match9 ] + br i1 %array_cmp_phi, label %next_check10, label %exit22 + +next_check10: ; preds = %exit + %ptradd11 = getelementptr inbounds i8, ptr %x, i64 8 + %ptradd12 = getelementptr inbounds i8, ptr %y, i64 8 + %4 = load i32, ptr %ptradd11, align 4 + %5 = load i32, ptr %ptradd12, align 4 + %eq13 = icmp eq i32 %4, %5 + br i1 %eq13, label %next_check14, label %exit19 + +next_check14: ; preds = %next_check10 + %ptradd15 = getelementptr inbounds i8, ptr %ptradd11, i64 4 + %ptradd16 = getelementptr inbounds i8, ptr %ptradd12, i64 4 + %6 = load i32, ptr %ptradd15, align 4 + %7 = load i32, ptr %ptradd16, align 4 + %eq17 = icmp eq i32 %6, %7 + br i1 %eq17, label %match18, label %exit19 + +match18: ; preds = %next_check14 + br label %exit19 + +exit19: ; preds = %match18, %next_check14, %next_check10 + %array_cmp_phi20 = phi i1 [ false, %next_check10 ], [ false, %next_check14 ], [ true, %match18 ] + br i1 %array_cmp_phi20, label %match21, label %exit22 + +match21: ; preds = %exit19 + br label %exit22 + +exit22: ; preds = %match21, %exit19, %exit + %array_cmp_phi23 = phi i1 [ false, %exit ], [ false, %exit19 ], [ true, %match21 ] + %8 = zext i1 %array_cmp_phi23 to i8 + store i8 %8, ptr %match, align 1 call void @llvm.memset.p0.i64(ptr align 16 %z, i8 0, i64 128, i1 false) call void @llvm.memset.p0.i64(ptr align 16 %w, i8 0, i64 128, i1 false) store i64 0, ptr %cmp.idx, align 8 br label %array_loop_start -array_loop_start: ; preds = %array_loop_comparison, %exit11 - %33 = load i64, ptr %cmp.idx, align 8 - %34 = getelementptr inbounds [8 x [2 x [2 x i32]]], ptr %z, i64 0, i64 %33 - %35 = getelementptr inbounds [8 x [2 x [2 x i32]]], ptr %w, i64 0, i64 %33 - %36 = getelementptr inbounds [2 x [2 x i32]], ptr %34, i64 0, i64 0 - %37 = getelementptr inbounds [2 x [2 x i32]], ptr %35, i64 0, i64 0 - %38 = getelementptr inbounds [2 x i32], ptr %36, i64 0, i64 0 - %39 = getelementptr inbounds [2 x i32], ptr %37, i64 0, i64 0 - %40 = load i32, ptr %38, align 4 - %41 = load i32, ptr %39, align 4 - %eq13 = icmp eq i32 %40, %41 - br i1 %eq13, label %next_check14, label %exit17 -next_check14: ; preds = %array_loop_start - %42 = getelementptr inbounds [2 x i32], ptr %36, i64 0, i64 1 - %43 = getelementptr inbounds [2 x i32], ptr %37, i64 0, i64 1 - %44 = load i32, ptr %42, align 4 - %45 = load i32, ptr %43, align 4 - %eq15 = icmp eq i32 %44, %45 - br i1 %eq15, label %match16, label %exit17 -match16: ; preds = %next_check14 - br label %exit17 -exit17: ; preds = %match16, %next_check14, %array_loop_start - %array_cmp_phi18 = phi i1 [ false, %array_loop_start ], [ false, %next_check14 ], [ true, %match16 ] - br i1 %array_cmp_phi18, label %next_check19, label %exit27 -next_check19: ; preds = %exit17 - %46 = getelementptr inbounds [2 x [2 x i32]], ptr %34, i64 0, i64 1 - %47 = getelementptr inbounds [2 x [2 x i32]], ptr %35, i64 0, i64 1 - %48 = getelementptr inbounds [2 x i32], ptr %46, i64 0, i64 0 - %49 = getelementptr inbounds [2 x i32], ptr %47, i64 0, i64 0 - %50 = load i32, ptr %48, align 4 - %51 = load i32, ptr %49, align 4 - %eq20 = icmp eq i32 %50, %51 - br i1 %eq20, label %next_check21, label %exit24 -next_check21: ; preds = %next_check19 - %52 = getelementptr inbounds [2 x i32], ptr %46, i64 0, i64 1 - %53 = getelementptr inbounds [2 x i32], ptr %47, i64 0, i64 1 - %54 = load i32, ptr %52, align 4 - %55 = load i32, ptr %53, align 4 - %eq22 = icmp eq i32 %54, %55 - br i1 %eq22, label %match23, label %exit24 -match23: ; preds = %next_check21 - br label %exit24 -exit24: ; preds = %match23, %next_check21, %next_check19 - %array_cmp_phi25 = phi i1 [ false, %next_check19 ], [ false, %next_check21 ], [ true, %match23 ] - br i1 %array_cmp_phi25, label %match26, label %exit27 -match26: ; preds = %exit24 - br label %exit27 -exit27: ; preds = %match26, %exit24, %exit17 - %array_cmp_phi28 = phi i1 [ false, %exit17 ], [ false, %exit24 ], [ true, %match26 ] - br i1 %array_cmp_phi28, label %array_loop_comparison, label %array_cmp_exit -array_loop_comparison: ; preds = %exit27 - %inc = add i64 %33, 1 + +array_loop_start: ; preds = %array_loop_comparison, %exit22 + %9 = load i64, ptr %cmp.idx, align 8 + %ptroffset = getelementptr inbounds [16 x i8], ptr %z, i64 %9 + %ptroffset24 = getelementptr inbounds [16 x i8], ptr %w, i64 %9 + %10 = load i32, ptr %ptroffset, align 4 + %11 = load i32, ptr %ptroffset24, align 4 + %eq25 = icmp eq i32 %10, %11 + br i1 %eq25, label %next_check26, label %exit31 + +next_check26: ; preds = %array_loop_start + %ptradd27 = getelementptr inbounds i8, ptr %ptroffset, i64 4 + %ptradd28 = getelementptr inbounds i8, ptr %ptroffset24, i64 4 + %12 = load i32, ptr %ptradd27, align 4 + %13 = load i32, ptr %ptradd28, align 4 + %eq29 = icmp eq i32 %12, %13 + br i1 %eq29, label %match30, label %exit31 + +match30: ; preds = %next_check26 + br label %exit31 + +exit31: ; preds = %match30, %next_check26, %array_loop_start + %array_cmp_phi32 = phi i1 [ false, %array_loop_start ], [ false, %next_check26 ], [ true, %match30 ] + br i1 %array_cmp_phi32, label %next_check33, label %exit45 + +next_check33: ; preds = %exit31 + %ptradd34 = getelementptr inbounds i8, ptr %ptroffset, i64 8 + %ptradd35 = getelementptr inbounds i8, ptr %ptroffset24, i64 8 + %14 = load i32, ptr %ptradd34, align 4 + %15 = load i32, ptr %ptradd35, align 4 + %eq36 = icmp eq i32 %14, %15 + br i1 %eq36, label %next_check37, label %exit42 + +next_check37: ; preds = %next_check33 + %ptradd38 = getelementptr inbounds i8, ptr %ptradd34, i64 4 + %ptradd39 = getelementptr inbounds i8, ptr %ptradd35, i64 4 + %16 = load i32, ptr %ptradd38, align 4 + %17 = load i32, ptr %ptradd39, align 4 + %eq40 = icmp eq i32 %16, %17 + br i1 %eq40, label %match41, label %exit42 + +match41: ; preds = %next_check37 + br label %exit42 + +exit42: ; preds = %match41, %next_check37, %next_check33 + %array_cmp_phi43 = phi i1 [ false, %next_check33 ], [ false, %next_check37 ], [ true, %match41 ] + br i1 %array_cmp_phi43, label %match44, label %exit45 + +match44: ; preds = %exit42 + br label %exit45 + +exit45: ; preds = %match44, %exit42, %exit31 + %array_cmp_phi46 = phi i1 [ false, %exit31 ], [ false, %exit42 ], [ true, %match44 ] + br i1 %array_cmp_phi46, label %array_loop_comparison, label %array_cmp_exit + +array_loop_comparison: ; preds = %exit45 + %inc = add i64 %9, 1 store i64 %inc, ptr %cmp.idx, align 8 %lt = icmp ult i64 %inc, 8 br i1 %lt, label %array_loop_start, label %array_cmp_exit -array_cmp_exit: ; preds = %array_loop_comparison, %exit27 - %array_cmp_phi29 = phi i1 [ true, %array_loop_comparison ], [ false, %exit27 ] - %56 = zext i1 %array_cmp_phi29 to i8 - store i8 %56, ptr %match, align 1 + +array_cmp_exit: ; preds = %array_loop_comparison, %exit45 + %array_cmp_phi47 = phi i1 [ true, %array_loop_comparison ], [ false, %exit45 ] + %18 = zext i1 %array_cmp_phi47 to i8 + store i8 %18, ptr %match, align 1 ret void } diff --git a/test/test_suite/arrays/array_literal.c3t b/test/test_suite/arrays/array_literal.c3t index 615efc65b..9e2bad3db 100644 --- a/test/test_suite/arrays/array_literal.c3t +++ b/test/test_suite/arrays/array_literal.c3t @@ -16,12 +16,13 @@ fn double test(uint x) @.__const = private unnamed_addr constant [30 x double] [double 0.000000e+00, double 1.270600e+01, double 4.303000e+00, double 3.182000e+00, double 2.776000e+00, double 2.571000e+00, double 2.447000e+00, double 2.365000e+00, double 2.306000e+00, double 2.262000e+00, double 2.228000e+00, double 2.201000e+00, double 2.179000e+00, double 2.160000e+00, double 2.145000e+00, double 2.131000e+00, double 2.120000e+00, double 2.110000e+00, double 2.101000e+00, double 2.093000e+00, double 2.086000e+00, double 2.080000e+00, double 2.074000e+00, double 2.069000e+00, double 2.064000e+00, double 2.060000e+00, double 2.056000e+00, double 2.052000e+00, double 2.048000e+00, double 2.045000e+00], align 16 +; Function Attrs: define double @array_literal.test(i32 %0) #0 { entry: %student_t = alloca [30 x double], align 16 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %student_t, ptr align 16 @.__const, i32 240, i1 false) %zext = zext i32 %0 to i64 - %1 = getelementptr inbounds [30 x double], ptr %student_t, i64 0, i64 %zext - %2 = load double, ptr %1, align 8 - ret double %2 + %ptroffset = getelementptr inbounds [8 x i8], ptr %student_t, i64 %zext + %1 = load double, ptr %ptroffset, align 8 + ret double %1 } diff --git a/test/test_suite/arrays/global_init.c3t b/test/test_suite/arrays/global_init.c3t index 3917ec880..b44e4ba15 100644 --- a/test/test_suite/arrays/global_init.c3t +++ b/test/test_suite/arrays/global_init.c3t @@ -26,37 +26,37 @@ fn void main() { @test.c = local_unnamed_addr global i32 0, align 4 @test.d = local_unnamed_addr global i32 0, align 4 @test.abc = local_unnamed_addr global [3 x i32] zeroinitializer, align 4 -@test.b = local_unnamed_addr global ptr getelementptr (i32, ptr @test.a, i64 7), align 8 -@test.bf = local_unnamed_addr global ptr getelementptr ([3 x i32], ptr @test.abc, i64 1, i64 1), align 8 -@test.bf2 = local_unnamed_addr global ptr getelementptr inbounds ([3 x i32], ptr @test.abc, i64 0, i64 2), align 8 -@test.bf3 = local_unnamed_addr global ptr getelementptr ([3 x i32], ptr @test.abc, i64 1, i64 1), align 8 +@test.b = local_unnamed_addr global ptr getelementptr (i8, ptr @test.a, i64 28), align 8 +@test.bf = local_unnamed_addr global ptr getelementptr (i8, ptr @test.abc, i64 16), align 8 +@test.bf2 = local_unnamed_addr global ptr getelementptr inbounds (i8, ptr @test.abc, i64 8), align 8 +@test.bf3 = local_unnamed_addr global ptr getelementptr (i8, ptr @test.abc, i64 16), align 8 @.taddr.9 = private global i32 42, align 4 @.taddr.10 = private global i8 99, align 1 @.taddr.11 = private global %"char[]" { ptr @.str, i64 3 }, align 8 @main.x = internal unnamed_addr global [3 x %"any*"] [%"any*" { ptr @.taddr.9, i64 ptrtoint (ptr @"$ct.int" to i64) }, %"any*" { ptr @.taddr.10, i64 ptrtoint (ptr @"$ct.char" to i64) }, %"any*" { ptr @.taddr.11, i64 ptrtoint (ptr @"$ct.String" to i64) }], align 16 +; Function Attrs: define void @test.main() #0 { entry: %bf34 = alloca ptr, align 8 %y = alloca [3 x %"any*"], align 16 %taddr = alloca i32, align 4 %taddr1 = alloca i8, align 1 - %taddr2 = alloca %"char[]", align 8 - store ptr getelementptr ([3 x i32], ptr @test.abc, i64 2, i64 1), ptr %bf34, align 8 - %0 = getelementptr inbounds [3 x %"any*"], ptr %y, i64 0, i64 0 + %taddr3 = alloca %"char[]", align 8 + store ptr getelementptr (i8, ptr @test.abc, i64 28), ptr %bf34, align 8 store i32 42, ptr %taddr, align 4 - %1 = insertvalue %"any*" undef, ptr %taddr, 0 - %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %2, ptr %0, align 16 - %3 = getelementptr inbounds [3 x %"any*"], ptr %y, i64 0, i64 1 + %0 = insertvalue %"any*" undef, ptr %taddr, 0 + %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %1, ptr %y, align 16 + %ptradd = getelementptr inbounds i8, ptr %y, i64 16 store i8 99, ptr %taddr1, align 1 - %4 = insertvalue %"any*" undef, ptr %taddr1, 0 - %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - store %"any*" %5, ptr %3, align 16 - %6 = getelementptr inbounds [3 x %"any*"], ptr %y, i64 0, i64 2 - store %"char[]" { ptr @.str.12, i64 3 }, ptr %taddr2, align 8 - %7 = insertvalue %"any*" undef, ptr %taddr2, 0 - %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - store %"any*" %8, ptr %6, align 16 + %2 = insertvalue %"any*" undef, ptr %taddr1, 0 + %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.char" to i64), 1 + store %"any*" %3, ptr %ptradd, align 16 + %ptradd2 = getelementptr inbounds i8, ptr %y, i64 32 + store %"char[]" { ptr @.str.12, i64 3 }, ptr %taddr3, align 8 + %4 = insertvalue %"any*" undef, ptr %taddr3, 0 + %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %5, ptr %ptradd2, align 16 ret void } diff --git a/test/test_suite/arrays/index_from_back.c3t b/test/test_suite/arrays/index_from_back.c3t index f8880220e..8b83536e4 100644 --- a/test/test_suite/arrays/index_from_back.c3t +++ b/test/test_suite/arrays/index_from_back.c3t @@ -15,6 +15,7 @@ fn void test(int[10] x, int[<10>] y) /* #expect: test.ll +; Function Attrs: define void @test.test(ptr byval([10 x i32]) align 8 %0, ptr byval(<10 x i32>) align 64 %1) #0 { entry: %a = alloca i32, align 4 @@ -24,30 +25,30 @@ entry: %j = alloca i32, align 4 %e = alloca i32, align 4 %f = alloca i32, align 4 - %2 = getelementptr inbounds [10 x i32], ptr %0, i64 0, i64 4 - %3 = load i32, ptr %2, align 4 - store i32 %3, ptr %a, align 4 - %4 = getelementptr inbounds [10 x i32], ptr %0, i64 0, i64 8 - %5 = load i32, ptr %4, align 4 - store i32 %5, ptr %b, align 4 + %ptradd = getelementptr inbounds i8, ptr %0, i64 16 + %2 = load i32, ptr %ptradd, align 4 + store i32 %2, ptr %a, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 32 + %3 = load i32, ptr %ptradd1, align 4 + store i32 %3, ptr %b, align 4 + %4 = load <10 x i32>, ptr %1, align 64 + %5 = extractelement <10 x i32> %4, i64 4 + store i32 %5, ptr %c, align 4 %6 = load <10 x i32>, ptr %1, align 64 - %7 = extractelement <10 x i32> %6, i64 4 - store i32 %7, ptr %c, align 4 - %8 = load <10 x i32>, ptr %1, align 64 - %9 = extractelement <10 x i32> %8, i64 8 - store i32 %9, ptr %d, align 4 + %7 = extractelement <10 x i32> %6, i64 8 + store i32 %7, ptr %d, align 4 store i32 3, ptr %j, align 4 - %10 = load <10 x i32>, ptr %1, align 64 - %11 = load i32, ptr %j, align 4 - %sext = sext i32 %11 to i64 - %12 = sub nuw i64 10, %sext - %13 = extractelement <10 x i32> %10, i64 %12 - store i32 %13, ptr %e, align 4 - %14 = load i32, ptr %j, align 4 - %sext1 = sext i32 %14 to i64 - %15 = sub nuw i64 10, %sext1 - %16 = getelementptr inbounds [10 x i32], ptr %0, i64 0, i64 %15 - %17 = load i32, ptr %16, align 4 - store i32 %17, ptr %f, align 4 + %8 = load <10 x i32>, ptr %1, align 64 + %9 = load i32, ptr %j, align 4 + %sext = sext i32 %9 to i64 + %10 = sub nuw i64 10, %sext + %11 = extractelement <10 x i32> %8, i64 %10 + store i32 %11, ptr %e, align 4 + %12 = load i32, ptr %j, align 4 + %sext2 = sext i32 %12 to i64 + %13 = sub nuw i64 10, %sext2 + %ptroffset = getelementptr inbounds [4 x i8], ptr %0, i64 %13 + %14 = load i32, ptr %ptroffset, align 4 + store i32 %14, ptr %f, align 4 ret void } \ No newline at end of file diff --git a/test/test_suite/arrays/index_into_global.c3t b/test/test_suite/arrays/index_into_global.c3t index 2e22914e9..13ef5c884 100644 --- a/test/test_suite/arrays/index_into_global.c3t +++ b/test/test_suite/arrays/index_into_global.c3t @@ -25,9 +25,8 @@ fn void test_bar(int idx) define void @foo.test_bar(i32 %0) #0 { entry: %sext = sext i32 %0 to i64 - %1 = getelementptr inbounds [6 x %Bar], ptr @foo.bar, i64 0, i64 %sext - %2 = getelementptr inbounds %Bar, ptr %1, i32 0, i32 0 - store i32 0, ptr %2, align 4 + %ptroffset = getelementptr inbounds [4 x i8], ptr @foo.bar, i64 %sext + store i32 0, ptr %ptroffset, align 4 store i32 %0, ptr @foo.bar, align 4 ret void } diff --git a/test/test_suite/arrays/inferred_array_optional.c3t b/test/test_suite/arrays/inferred_array_optional.c3t index a31777408..d02fda4dc 100644 --- a/test/test_suite/arrays/inferred_array_optional.c3t +++ b/test/test_suite/arrays/inferred_array_optional.c3t @@ -29,64 +29,63 @@ entry: %y2.f = alloca i64, align 8 %retparam5 = alloca i32, align 4 %retparam9 = alloca i32, align 4 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 8, i1 false) store i64 0, ptr %x.f, align 8 - %0 = getelementptr inbounds [2 x i32], ptr %y, i64 0, i64 0 - %1 = call i64 @test.foo(ptr %retparam) - %not_err = icmp eq i64 %1, 0 - %2 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %2, label %after_check, label %assign_optional + %0 = call i64 @test.foo(ptr %retparam) + %not_err = icmp eq i64 %0, 0 + %1 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %1, label %after_check, label %assign_optional assign_optional: ; preds = %entry - store i64 %1, ptr %y.f, align 8 + store i64 %0, ptr %y.f, align 8 br label %after_assign after_check: ; preds = %entry - %3 = load i32, ptr %retparam, align 4 - store i32 %3, ptr %0, align 4 - %4 = getelementptr inbounds [2 x i32], ptr %y, i64 0, i64 1 - %5 = call i64 @test.foo(ptr %retparam1) - %not_err2 = icmp eq i64 %5, 0 - %6 = call i1 @llvm.expect.i1(i1 %not_err2, i1 true) - br i1 %6, label %after_check4, label %assign_optional3 + %2 = load i32, ptr %retparam, align 4 + store i32 %2, ptr %y, align 4 + %ptradd = getelementptr inbounds i8, ptr %y, i64 4 + %3 = call i64 @test.foo(ptr %retparam1) + %not_err2 = icmp eq i64 %3, 0 + %4 = call i1 @llvm.expect.i1(i1 %not_err2, i1 true) + br i1 %4, label %after_check4, label %assign_optional3 assign_optional3: ; preds = %after_check - store i64 %5, ptr %y.f, align 8 + store i64 %3, ptr %y.f, align 8 br label %after_assign after_check4: ; preds = %after_check - %7 = load i32, ptr %retparam1, align 4 - store i32 %7, ptr %4, align 4 + %5 = load i32, ptr %retparam1, align 4 + store i32 %5, ptr %ptradd, align 4 store i64 0, ptr %y.f, align 8 br label %after_assign after_assign: ; preds = %after_check4, %assign_optional3, %assign_optional store <2 x i32> , ptr %x2, align 8 store i64 0, ptr %x2.f, align 8 - %8 = call i64 @test.foo(ptr %retparam5) - %not_err6 = icmp eq i64 %8, 0 - %9 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true) - br i1 %9, label %after_check8, label %assign_optional7 + %6 = call i64 @test.foo(ptr %retparam5) + %not_err6 = icmp eq i64 %6, 0 + %7 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true) + br i1 %7, label %after_check8, label %assign_optional7 assign_optional7: ; preds = %after_assign - store i64 %8, ptr %y2.f, align 8 + store i64 %6, ptr %y2.f, align 8 br label %after_assign13 after_check8: ; preds = %after_assign - %10 = load i32, ptr %retparam5, align 4 - %11 = insertelement <2 x i32> undef, i32 %10, i64 0 - %12 = call i64 @test.foo(ptr %retparam9) - %not_err10 = icmp eq i64 %12, 0 - %13 = call i1 @llvm.expect.i1(i1 %not_err10, i1 true) - br i1 %13, label %after_check12, label %assign_optional11 + %8 = load i32, ptr %retparam5, align 4 + %9 = insertelement <2 x i32> undef, i32 %8, i64 0 + %10 = call i64 @test.foo(ptr %retparam9) + %not_err10 = icmp eq i64 %10, 0 + %11 = call i1 @llvm.expect.i1(i1 %not_err10, i1 true) + br i1 %11, label %after_check12, label %assign_optional11 assign_optional11: ; preds = %after_check8 - store i64 %12, ptr %y2.f, align 8 + store i64 %10, ptr %y2.f, align 8 br label %after_assign13 after_check12: ; preds = %after_check8 - %14 = load i32, ptr %retparam9, align 4 - %15 = insertelement <2 x i32> %11, i32 %14, i64 1 - store <2 x i32> %15, ptr %y2, align 8 + %12 = load i32, ptr %retparam9, align 4 + %13 = insertelement <2 x i32> %9, i32 %12, i64 1 + store <2 x i32> %13, ptr %y2, align 8 store i64 0, ptr %y2.f, align 8 br label %after_assign13 diff --git a/test/test_suite/assert/assertf.c3t b/test/test_suite/assert/assertf.c3t index 32bf0002b..6038a2d25 100644 --- a/test/test_suite/assert/assertf.c3t +++ b/test/test_suite/assert/assertf.c3t @@ -20,14 +20,17 @@ entry: %indirectarg = alloca %"any*[]", align 8 store i64 0, ptr %i, align 8 br label %loop.cond + loop.cond: ; preds = %assert_ok, %entry %0 = load i64, ptr %i, align 8 %gt = icmp ugt i64 100000000, %0 br i1 %gt, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond %1 = load i64, ptr %i, align 8 %neq = icmp ne i64 2, %1 br i1 %neq, label %assert_ok, label %assert_fail + assert_fail: ; preds = %loop.body %2 = insertvalue %"any*" undef, ptr %i, 0 %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 @@ -36,20 +39,21 @@ assert_fail: ; preds = %loop.body store i64 %mul, ptr %taddr, align 8 %5 = insertvalue %"any*" undef, ptr %taddr, 0 %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %7 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %3, ptr %7, align 16 - %8 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %6, ptr %8, align 16 - %9 = insertvalue %"any*[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"any*[]" %9, i64 2, 1 + store %"any*" %3, ptr %varargslots, align 16 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %6, ptr %ptradd, align 16 + %7 = insertvalue %"any*[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"any*[]" %7, i64 2, 1 store %"any*[]" %"$$temp", ptr %indirectarg, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 10, ptr @.file, i64 10, ptr @.func, i64 4, i32 7, ptr byval(%"any*[]") align 8 %indirectarg) unreachable + assert_ok: ; preds = %loop.body - %10 = load i64, ptr %i, align 8 - %add = add i64 %10, 1 + %8 = load i64, ptr %i, align 8 + %add = add i64 %8, 1 store i64 %add, ptr %i, align 8 br label %loop.cond + loop.exit: ; preds = %loop.cond ret i64 0 } diff --git a/test/test_suite/bitstruct/array_with_boolean.c3t b/test/test_suite/bitstruct/array_with_boolean.c3t index 5930c0f4a..78b7ee4e4 100644 --- a/test/test_suite/bitstruct/array_with_boolean.c3t +++ b/test/test_suite/bitstruct/array_with_boolean.c3t @@ -29,43 +29,41 @@ entry: %xy = alloca [3 x i8], align 1 store [3 x i8] c"\1A\1E\08", ptr %xx, align 1 store [3 x i8] c"\1A\1E\10", ptr %xy, align 1 - %0 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %1 = load i8, ptr %0, align 1 - %zext = zext i8 %1 to i32 + %0 = load i8, ptr %xx, align 1 + %zext = zext i8 %0 to i32 %shl = shl i32 %zext, 29 %ashr = ashr i32 %shl, 29 - %2 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %3 = load i8, ptr %2, align 1 - %zext1 = zext i8 %3 to i32 + %1 = load i8, ptr %xx, align 1 + %zext1 = zext i8 %1 to i32 %lshrl = lshr i32 %zext1, 3 - %4 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %5 = load i8, ptr %4, align 1 - %zext2 = zext i8 %5 to i32 + %ptradd = getelementptr inbounds i8, ptr %xx, i64 1 + %2 = load i8, ptr %ptradd, align 1 + %zext2 = zext i8 %2 to i32 %shl3 = shl i32 %zext2, 5 - %6 = or i32 %shl3, %lshrl - %shl4 = shl i32 %6, 26 + %3 = or i32 %shl3, %lshrl + %shl4 = shl i32 %3, 26 %ashr5 = ashr i32 %shl4, 26 - %7 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %8 = load i8, ptr %7, align 1 - %zext6 = zext i8 %8 to i32 - %lshrl7 = lshr i32 %zext6, 1 - %9 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %10 = load i8, ptr %9, align 1 - %zext8 = zext i8 %10 to i32 - %shl9 = shl i32 %zext8, 7 - %11 = or i32 %shl9, %lshrl7 - %shl10 = shl i32 %11, 22 - %ashr11 = ashr i32 %shl10, 22 - %12 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %13 = load i8, ptr %12, align 1 - %lshrl12 = lshr i8 %13, 3 - %14 = trunc i8 %lshrl12 to i1 - %boolsi = zext i1 %14 to i32 - %15 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %16 = load i8, ptr %15, align 1 - %lshrl13 = lshr i8 %16, 4 - %17 = trunc i8 %lshrl13 to i1 - %boolsi14 = zext i1 %17 to i32 - call void (ptr, ...) @printf(ptr @.str, i32 %ashr, i32 %ashr5, i32 %ashr11, i32 %boolsi, i32 %boolsi14) + %ptradd6 = getelementptr inbounds i8, ptr %xx, i64 1 + %4 = load i8, ptr %ptradd6, align 1 + %zext7 = zext i8 %4 to i32 + %lshrl8 = lshr i32 %zext7, 1 + %ptradd9 = getelementptr inbounds i8, ptr %xx, i64 2 + %5 = load i8, ptr %ptradd9, align 1 + %zext10 = zext i8 %5 to i32 + %shl11 = shl i32 %zext10, 7 + %6 = or i32 %shl11, %lshrl8 + %shl12 = shl i32 %6, 22 + %ashr13 = ashr i32 %shl12, 22 + %ptradd14 = getelementptr inbounds i8, ptr %xx, i64 2 + %7 = load i8, ptr %ptradd14, align 1 + %lshrl15 = lshr i8 %7, 3 + %8 = trunc i8 %lshrl15 to i1 + %boolsi = zext i1 %8 to i32 + %ptradd16 = getelementptr inbounds i8, ptr %xx, i64 2 + %9 = load i8, ptr %ptradd16, align 1 + %lshrl17 = lshr i8 %9, 4 + %10 = trunc i8 %lshrl17 to i1 + %boolsi18 = zext i1 %10 to i32 + call void (ptr, ...) @printf(ptr @.str, i32 %ashr, i32 %ashr5, i32 %ashr13, i32 %boolsi, i32 %boolsi18) ret void } \ No newline at end of file diff --git a/test/test_suite/bitstruct/bitfield_access.c3t b/test/test_suite/bitstruct/bitfield_access.c3t index 9cf494182..22962cf06 100644 --- a/test/test_suite/bitstruct/bitfield_access.c3t +++ b/test/test_suite/bitstruct/bitfield_access.c3t @@ -123,58 +123,51 @@ entry: store [3 x i8] c"\09\06 ", ptr %e2, align 1 store [3 x i8] c"\0A\06 ", ptr %e3, align 1 store i8 0, ptr %d, align 1 - %0 = getelementptr inbounds [3 x i8], ptr %e1, i64 0, i64 0 - %1 = load i8, ptr %0, align 1 - %zext = zext i8 %1 to i32 + %0 = load i8, ptr %e1, align 1 + %zext = zext i8 %0 to i32 %shl = shl i32 %zext, 29 %ashr = ashr i32 %shl, 29 call void (ptr, ...) @printf(ptr @.str, i32 %ashr) - %2 = getelementptr inbounds [3 x i8], ptr %e2, i64 0, i64 0 - %3 = load i8, ptr %2, align 1 - %zext1 = zext i8 %3 to i32 + %1 = load i8, ptr %e2, align 1 + %zext1 = zext i8 %1 to i32 %shl2 = shl i32 %zext1, 29 %ashr3 = ashr i32 %shl2, 29 call void (ptr, ...) @printf(ptr @.str.1, i32 %ashr3) - %4 = getelementptr inbounds [3 x i8], ptr %e3, i64 0, i64 0 - %5 = load i8, ptr %4, align 1 - %zext4 = zext i8 %5 to i32 + %2 = load i8, ptr %e3, align 1 + %zext4 = zext i8 %2 to i32 %shl5 = shl i32 %zext4, 29 %ashr6 = ashr i32 %shl5, 29 call void (ptr, ...) @printf(ptr @.str.2, i32 %ashr6) store [3 x i8] c"\0B\06 ", ptr %z1, align 1 store [3 x i8] c"\0C\06 ", ptr %z2, align 1 store [3 x i8] c"\0F\06 ", ptr %z3, align 1 - %6 = getelementptr inbounds [3 x i8], ptr %z1, i64 0, i64 0 - %7 = load i8, ptr %6, align 1 - %zext7 = zext i8 %7 to i32 - %8 = and i32 7, %zext7 - call void (ptr, ...) @printf(ptr @.str.3, i32 %8) - %9 = getelementptr inbounds [3 x i8], ptr %z2, i64 0, i64 0 - %10 = load i8, ptr %9, align 1 - %zext8 = zext i8 %10 to i32 - %11 = and i32 7, %zext8 - call void (ptr, ...) @printf(ptr @.str.4, i32 %11) - %12 = getelementptr inbounds [3 x i8], ptr %z3, i64 0, i64 0 - %13 = load i8, ptr %12, align 1 - %zext9 = zext i8 %13 to i32 - %14 = and i32 7, %zext9 - call void (ptr, ...) @printf(ptr @.str.5, i32 %14) + %3 = load i8, ptr %z1, align 1 + %zext7 = zext i8 %3 to i32 + %4 = and i32 7, %zext7 + call void (ptr, ...) @printf(ptr @.str.3, i32 %4) + %5 = load i8, ptr %z2, align 1 + %zext8 = zext i8 %5 to i32 + %6 = and i32 7, %zext8 + call void (ptr, ...) @printf(ptr @.str.4, i32 %6) + %7 = load i8, ptr %z3, align 1 + %zext9 = zext i8 %7 to i32 + %8 = and i32 7, %zext9 + call void (ptr, ...) @printf(ptr @.str.5, i32 %8) store [5 x i8] c"\00G\02\00\00", ptr %xx, align 1 - %15 = getelementptr inbounds [5 x i8], ptr %xx, i64 0, i64 0 - %16 = load i8, ptr %15, align 1 - %zext10 = zext i8 %16 to i32 + %9 = load i8, ptr %xx, align 1 + %zext10 = zext i8 %9 to i32 %lshrl = lshr i32 %zext10, 5 - %17 = getelementptr inbounds [5 x i8], ptr %xx, i64 0, i64 1 - %18 = load i8, ptr %17, align 1 - %zext11 = zext i8 %18 to i32 + %ptradd = getelementptr inbounds i8, ptr %xx, i64 1 + %10 = load i8, ptr %ptradd, align 1 + %zext11 = zext i8 %10 to i32 %shl12 = shl i32 %zext11, 3 - %19 = or i32 %shl12, %lshrl - %20 = getelementptr inbounds [5 x i8], ptr %xx, i64 0, i64 2 - %21 = load i8, ptr %20, align 1 - %zext13 = zext i8 %21 to i32 - %shl14 = shl i32 %zext13, 11 - %22 = or i32 %shl14, %19 - %23 = and i32 262143, %22 - call void (ptr, ...) @printf(ptr @.str.6, i32 %23) + %11 = or i32 %shl12, %lshrl + %ptradd13 = getelementptr inbounds i8, ptr %xx, i64 2 + %12 = load i8, ptr %ptradd13, align 1 + %zext14 = zext i8 %12 to i32 + %shl15 = shl i32 %zext14, 11 + %13 = or i32 %shl15, %11 + %14 = and i32 262143, %13 + call void (ptr, ...) @printf(ptr @.str.6, i32 %14) ret void } \ No newline at end of file diff --git a/test/test_suite/bitstruct/bitstruct_access_signed.c3t b/test/test_suite/bitstruct/bitstruct_access_signed.c3t index 8141d500b..5c3423e09 100644 --- a/test/test_suite/bitstruct/bitstruct_access_signed.c3t +++ b/test/test_suite/bitstruct/bitstruct_access_signed.c3t @@ -35,57 +35,54 @@ entry: %xx = alloca [3 x i8], align 1 %xxu = alloca [3 x i8], align 1 store [3 x i8] c"\E0\FD\7F", ptr %xx, align 1 - %0 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %1 = load i8, ptr %0, align 1 - %zext = zext i8 %1 to i32 + %0 = load i8, ptr %xx, align 1 + %zext = zext i8 %0 to i32 %lshrl = lshr i32 %zext, 5 - %2 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %3 = load i8, ptr %2, align 1 - %zext1 = zext i8 %3 to i32 + %ptradd = getelementptr inbounds i8, ptr %xx, i64 1 + %1 = load i8, ptr %ptradd, align 1 + %zext1 = zext i8 %1 to i32 %shl = shl i32 %zext1, 3 - %4 = or i32 %shl, %lshrl - %5 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %6 = load i8, ptr %5, align 1 - %zext2 = zext i8 %6 to i32 - %shl3 = shl i32 %zext2, 11 - %7 = or i32 %shl3, %4 - %shl4 = shl i32 %7, 14 - %ashr = ashr i32 %shl4, 14 + %2 = or i32 %shl, %lshrl + %ptradd2 = getelementptr inbounds i8, ptr %xx, i64 2 + %3 = load i8, ptr %ptradd2, align 1 + %zext3 = zext i8 %3 to i32 + %shl4 = shl i32 %zext3, 11 + %4 = or i32 %shl4, %2 + %shl5 = shl i32 %4, 14 + %ashr = ashr i32 %shl5, 14 call void (ptr, ...) @printf(ptr @.str, i32 %ashr) store [3 x i8] c"\FF\FD\FF", ptr %xx, align 1 - %8 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %9 = load i8, ptr %8, align 1 - %zext5 = zext i8 %9 to i32 - %lshrl6 = lshr i32 %zext5, 5 - %10 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %11 = load i8, ptr %10, align 1 - %zext7 = zext i8 %11 to i32 - %shl8 = shl i32 %zext7, 3 - %12 = or i32 %shl8, %lshrl6 - %13 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %14 = load i8, ptr %13, align 1 - %zext9 = zext i8 %14 to i32 - %shl10 = shl i32 %zext9, 11 - %15 = or i32 %shl10, %12 - %shl11 = shl i32 %15, 14 - %ashr12 = ashr i32 %shl11, 14 - call void (ptr, ...) @printf(ptr @.str.1, i32 %ashr12) + %5 = load i8, ptr %xx, align 1 + %zext6 = zext i8 %5 to i32 + %lshrl7 = lshr i32 %zext6, 5 + %ptradd8 = getelementptr inbounds i8, ptr %xx, i64 1 + %6 = load i8, ptr %ptradd8, align 1 + %zext9 = zext i8 %6 to i32 + %shl10 = shl i32 %zext9, 3 + %7 = or i32 %shl10, %lshrl7 + %ptradd11 = getelementptr inbounds i8, ptr %xx, i64 2 + %8 = load i8, ptr %ptradd11, align 1 + %zext12 = zext i8 %8 to i32 + %shl13 = shl i32 %zext12, 11 + %9 = or i32 %shl13, %7 + %shl14 = shl i32 %9, 14 + %ashr15 = ashr i32 %shl14, 14 + call void (ptr, ...) @printf(ptr @.str.1, i32 %ashr15) store [3 x i8] c"\1F\CF\AA", ptr %xxu, align 1 - %16 = getelementptr inbounds [3 x i8], ptr %xxu, i64 0, i64 0 - %17 = load i8, ptr %16, align 1 - %zext13 = zext i8 %17 to i32 - %lshrl14 = lshr i32 %zext13, 5 - %18 = getelementptr inbounds [3 x i8], ptr %xxu, i64 0, i64 1 - %19 = load i8, ptr %18, align 1 - %zext15 = zext i8 %19 to i32 - %shl16 = shl i32 %zext15, 3 - %20 = or i32 %shl16, %lshrl14 - %21 = getelementptr inbounds [3 x i8], ptr %xxu, i64 0, i64 2 - %22 = load i8, ptr %21, align 1 - %zext17 = zext i8 %22 to i32 - %shl18 = shl i32 %zext17, 11 - %23 = or i32 %shl18, %20 - %24 = and i32 262143, %23 - call void (ptr, ...) @printf(ptr @.str.2, i32 %24) + %10 = load i8, ptr %xxu, align 1 + %zext16 = zext i8 %10 to i32 + %lshrl17 = lshr i32 %zext16, 5 + %ptradd18 = getelementptr inbounds i8, ptr %xxu, i64 1 + %11 = load i8, ptr %ptradd18, align 1 + %zext19 = zext i8 %11 to i32 + %shl20 = shl i32 %zext19, 3 + %12 = or i32 %shl20, %lshrl17 + %ptradd21 = getelementptr inbounds i8, ptr %xxu, i64 2 + %13 = load i8, ptr %ptradd21, align 1 + %zext22 = zext i8 %13 to i32 + %shl23 = shl i32 %zext22, 11 + %14 = or i32 %shl23, %12 + %15 = and i32 262143, %14 + call void (ptr, ...) @printf(ptr @.str.2, i32 %15) ret void } diff --git a/test/test_suite/bitstruct/bitstruct_anon_in_struct_ok.c3t b/test/test_suite/bitstruct/bitstruct_anon_in_struct_ok.c3t index a92e74cc8..5e0b6841c 100644 --- a/test/test_suite/bitstruct/bitstruct_anon_in_struct_ok.c3t +++ b/test/test_suite/bitstruct/bitstruct_anon_in_struct_ok.c3t @@ -33,90 +33,87 @@ entry: %test = alloca %Test, align 2 %varargslots = alloca [3 x %"any*"], align 16 %taddr = alloca i8, align 1 - %taddr2 = alloca i8, align 1 - %taddr3 = alloca i16, align 2 + %taddr5 = alloca i8, align 1 + %taddr8 = alloca i16, align 2 %retparam = alloca i64, align 8 - %varargslots4 = alloca [4 x %"any*"], align 16 - %taddr7 = alloca i8, align 1 - %taddr10 = alloca i8, align 1 - %taddr13 = alloca i8, align 1 - %taddr16 = alloca i8, align 1 - %retparam17 = alloca i64, align 8 - %0 = getelementptr inbounds %Test, ptr %test, i32 0, i32 0 - store i16 0, ptr %0, align 2 - %1 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - store i16 0, ptr %1, align 2 - %2 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - %3 = load i16, ptr %2, align 2 - store i16 -20550, ptr %2, align 2 - %4 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - %5 = load i16, ptr %4, align 2 - %lshrl = lshr i16 %5, 8 - %6 = and i16 255, %lshrl - %trunc = trunc i16 %6 to i8 + %varargslots10 = alloca [4 x %"any*"], align 16 + %taddr14 = alloca i8, align 1 + %taddr18 = alloca i8, align 1 + %taddr23 = alloca i8, align 1 + %taddr28 = alloca i8, align 1 + %retparam30 = alloca i64, align 8 + store i16 0, ptr %test, align 2 + %ptradd = getelementptr inbounds i8, ptr %test, i64 2 + store i16 0, ptr %ptradd, align 2 + %ptradd1 = getelementptr inbounds i8, ptr %test, i64 2 + %0 = load i16, ptr %ptradd1, align 2 + store i16 -20550, ptr %ptradd1, align 2 + %ptradd2 = getelementptr inbounds i8, ptr %test, i64 2 + %1 = load i16, ptr %ptradd2, align 2 + %lshrl = lshr i16 %1, 8 + %2 = and i16 255, %lshrl + %trunc = trunc i16 %2 to i8 store i8 %trunc, ptr %taddr, align 1 - %7 = insertvalue %"any*" undef, ptr %taddr, 0 + %3 = insertvalue %"any*" undef, ptr %taddr, 0 + %4 = insertvalue %"any*" %3, i64 ptrtoint (ptr @"$ct.char" to i64), 1 + store %"any*" %4, ptr %varargslots, align 16 + %ptradd3 = getelementptr inbounds i8, ptr %test, i64 2 + %5 = load i16, ptr %ptradd3, align 2 + %6 = and i16 255, %5 + %trunc4 = trunc i16 %6 to i8 + store i8 %trunc4, ptr %taddr5, align 1 + %7 = insertvalue %"any*" undef, ptr %taddr5, 0 %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - %9 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %8, ptr %9, align 16 - %10 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - %11 = load i16, ptr %10, align 2 - %12 = and i16 255, %11 - %trunc1 = trunc i16 %12 to i8 - store i8 %trunc1, ptr %taddr2, align 1 - %13 = insertvalue %"any*" undef, ptr %taddr2, 0 - %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - %15 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %14, ptr %15, align 16 - %16 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - %17 = load i16, ptr %16, align 2 - store i16 %17, ptr %taddr3, align 2 - %18 = insertvalue %"any*" undef, ptr %taddr3, 0 - %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.ushort" to i64), 1 - %20 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 2 - store %"any*" %19, ptr %20, align 16 - %21 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 18, ptr %varargslots, i64 3) - %22 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - %23 = load i16, ptr %22, align 2 - %lshrl5 = lshr i16 %23, 7 - %24 = and i16 1, %lshrl5 - %trunc6 = trunc i16 %24 to i8 - store i8 %trunc6, ptr %taddr7, align 1 - %25 = insertvalue %"any*" undef, ptr %taddr7, 0 - %26 = insertvalue %"any*" %25, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %27 = getelementptr inbounds [4 x %"any*"], ptr %varargslots4, i64 0, i64 0 - store %"any*" %26, ptr %27, align 16 - %28 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - %29 = load i16, ptr %28, align 2 - %lshrl8 = lshr i16 %29, 6 - %30 = and i16 1, %lshrl8 - %trunc9 = trunc i16 %30 to i8 - store i8 %trunc9, ptr %taddr10, align 1 - %31 = insertvalue %"any*" undef, ptr %taddr10, 0 - %32 = insertvalue %"any*" %31, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %33 = getelementptr inbounds [4 x %"any*"], ptr %varargslots4, i64 0, i64 1 - store %"any*" %32, ptr %33, align 16 - %34 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - %35 = load i16, ptr %34, align 2 - %lshrl11 = lshr i16 %35, 5 - %36 = and i16 1, %lshrl11 - %trunc12 = trunc i16 %36 to i8 - store i8 %trunc12, ptr %taddr13, align 1 - %37 = insertvalue %"any*" undef, ptr %taddr13, 0 - %38 = insertvalue %"any*" %37, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %39 = getelementptr inbounds [4 x %"any*"], ptr %varargslots4, i64 0, i64 2 - store %"any*" %38, ptr %39, align 16 - %40 = getelementptr inbounds %Test, ptr %test, i32 0, i32 1 - %41 = load i16, ptr %40, align 2 - %lshrl14 = lshr i16 %41, 4 - %42 = and i16 1, %lshrl14 - %trunc15 = trunc i16 %42 to i8 - store i8 %trunc15, ptr %taddr16, align 1 - %43 = insertvalue %"any*" undef, ptr %taddr16, 0 - %44 = insertvalue %"any*" %43, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %45 = getelementptr inbounds [4 x %"any*"], ptr %varargslots4, i64 0, i64 3 - store %"any*" %44, ptr %45, align 16 - %46 = call i64 @std.io.printfn(ptr %retparam17, ptr @.str.1, i64 12, ptr %varargslots4, i64 4) + %ptradd6 = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %8, ptr %ptradd6, align 16 + %ptradd7 = getelementptr inbounds i8, ptr %test, i64 2 + %9 = load i16, ptr %ptradd7, align 2 + store i16 %9, ptr %taddr8, align 2 + %10 = insertvalue %"any*" undef, ptr %taddr8, 0 + %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.ushort" to i64), 1 + %ptradd9 = getelementptr inbounds i8, ptr %varargslots, i64 32 + store %"any*" %11, ptr %ptradd9, align 16 + %12 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 18, ptr %varargslots, i64 3) + %ptradd11 = getelementptr inbounds i8, ptr %test, i64 2 + %13 = load i16, ptr %ptradd11, align 2 + %lshrl12 = lshr i16 %13, 7 + %14 = and i16 1, %lshrl12 + %trunc13 = trunc i16 %14 to i8 + store i8 %trunc13, ptr %taddr14, align 1 + %15 = insertvalue %"any*" undef, ptr %taddr14, 0 + %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %16, ptr %varargslots10, align 16 + %ptradd15 = getelementptr inbounds i8, ptr %test, i64 2 + %17 = load i16, ptr %ptradd15, align 2 + %lshrl16 = lshr i16 %17, 6 + %18 = and i16 1, %lshrl16 + %trunc17 = trunc i16 %18 to i8 + store i8 %trunc17, ptr %taddr18, align 1 + %19 = insertvalue %"any*" undef, ptr %taddr18, 0 + %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd19 = getelementptr inbounds i8, ptr %varargslots10, i64 16 + store %"any*" %20, ptr %ptradd19, align 16 + %ptradd20 = getelementptr inbounds i8, ptr %test, i64 2 + %21 = load i16, ptr %ptradd20, align 2 + %lshrl21 = lshr i16 %21, 5 + %22 = and i16 1, %lshrl21 + %trunc22 = trunc i16 %22 to i8 + store i8 %trunc22, ptr %taddr23, align 1 + %23 = insertvalue %"any*" undef, ptr %taddr23, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd24 = getelementptr inbounds i8, ptr %varargslots10, i64 32 + store %"any*" %24, ptr %ptradd24, align 16 + %ptradd25 = getelementptr inbounds i8, ptr %test, i64 2 + %25 = load i16, ptr %ptradd25, align 2 + %lshrl26 = lshr i16 %25, 4 + %26 = and i16 1, %lshrl26 + %trunc27 = trunc i16 %26 to i8 + store i8 %trunc27, ptr %taddr28, align 1 + %27 = insertvalue %"any*" undef, ptr %taddr28, 0 + %28 = insertvalue %"any*" %27, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd29 = getelementptr inbounds i8, ptr %varargslots10, i64 48 + store %"any*" %28, ptr %ptradd29, align 16 + %29 = call i64 @std.io.printfn(ptr %retparam30, ptr @.str.1, i64 12, ptr %varargslots10, i64 4) ret void } diff --git a/test/test_suite/bitstruct/bitstruct_arrays.c3t b/test/test_suite/bitstruct/bitstruct_arrays.c3t index 1b2189446..5b4820cd7 100644 --- a/test/test_suite/bitstruct/bitstruct_arrays.c3t +++ b/test/test_suite/bitstruct/bitstruct_arrays.c3t @@ -332,808 +332,738 @@ entry: ret void } - +; Function Attrs: define void @foo.test2() #0 { entry: %xx = alloca [3 x i8], align 1 store [3 x i8] c"\1A\1E\00", ptr %xx, align 1 - %0 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %1 = load i8, ptr %0, align 1 - %2 = and i8 %1, -8 - %3 = or i8 %2, 3 - store i8 %2, ptr %0, align 1 - %4 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %5 = load i8, ptr %4, align 1 - %zext = zext i8 %5 to i32 + %0 = load i8, ptr %xx, align 1 + %1 = and i8 %0, -8 + %2 = or i8 %1, 3 + store i8 %1, ptr %xx, align 1 + %3 = load i8, ptr %xx, align 1 + %zext = zext i8 %3 to i32 %shl = shl i32 %zext, 29 %ashr = ashr i32 %shl, 29 - %6 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %7 = load i8, ptr %6, align 1 - %zext1 = zext i8 %7 to i32 + %4 = load i8, ptr %xx, align 1 + %zext1 = zext i8 %4 to i32 %lshrl = lshr i32 %zext1, 3 - %8 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %9 = load i8, ptr %8, align 1 - %zext2 = zext i8 %9 to i32 + %ptradd = getelementptr inbounds i8, ptr %xx, i64 1 + %5 = load i8, ptr %ptradd, align 1 + %zext2 = zext i8 %5 to i32 %shl3 = shl i32 %zext2, 5 - %10 = or i32 %shl3, %lshrl - %shl4 = shl i32 %10, 26 + %6 = or i32 %shl3, %lshrl + %shl4 = shl i32 %6, 26 %ashr5 = ashr i32 %shl4, 26 call void (ptr, ...) @printf(ptr @.str.11, i32 %ashr, i32 %ashr5) - %11 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %12 = load i8, ptr %11, align 1 - %zext6 = zext i8 %12 to i32 + %7 = load i8, ptr %xx, align 1 + %zext6 = zext i8 %7 to i32 %shl7 = shl i32 %zext6, 29 %ashr8 = ashr i32 %shl7, 29 %sub = sub i32 %ashr8, 1 - %13 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 %trunc = trunc i32 %sub to i8 - %14 = and i8 %trunc, 7 - %15 = load i8, ptr %13, align 1 - %16 = and i8 %15, -8 - %17 = or i8 %16, %14 - store i8 %16, ptr %13, align 1 - %18 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %19 = load i8, ptr %18, align 1 - %zext9 = zext i8 %19 to i32 + %8 = and i8 %trunc, 7 + %9 = load i8, ptr %xx, align 1 + %10 = and i8 %9, -8 + %11 = or i8 %10, %8 + store i8 %10, ptr %xx, align 1 + %12 = load i8, ptr %xx, align 1 + %zext9 = zext i8 %12 to i32 %shl10 = shl i32 %zext9, 29 %ashr11 = ashr i32 %shl10, 29 - %20 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %21 = load i8, ptr %20, align 1 - %zext12 = zext i8 %21 to i32 + %13 = load i8, ptr %xx, align 1 + %zext12 = zext i8 %13 to i32 %lshrl13 = lshr i32 %zext12, 3 - %22 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %23 = load i8, ptr %22, align 1 - %zext14 = zext i8 %23 to i32 - %shl15 = shl i32 %zext14, 5 - %24 = or i32 %shl15, %lshrl13 - %shl16 = shl i32 %24, 26 - %ashr17 = ashr i32 %shl16, 26 - call void (ptr, ...) @printf(ptr @.str.12, i32 %ashr11, i32 %ashr17) - %25 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %26 = load i8, ptr %25, align 1 - %zext18 = zext i8 %26 to i32 - %lshrl19 = lshr i32 %zext18, 3 - %27 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %28 = load i8, ptr %27, align 1 - %zext20 = zext i8 %28 to i32 - %shl21 = shl i32 %zext20, 5 - %29 = or i32 %shl21, %lshrl19 - %shl22 = shl i32 %29, 26 - %ashr23 = ashr i32 %shl22, 26 - %mul = mul i32 %ashr23, 2 - %30 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl24 = shl i32 %mul, 3 - %trunc25 = trunc i32 %shl24 to i8 - %31 = load i8, ptr %30, align 1 - %32 = and i8 %31, 7 - %33 = or i8 %32, %trunc25 - store i8 %33, ptr %30, align 1 - %lshrl26 = lshr i32 %mul, 5 - %34 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc27 = trunc i32 %lshrl26 to i8 - %35 = and i8 %trunc27, 1 - %36 = load i8, ptr %34, align 1 - %37 = and i8 %36, -2 - %38 = or i8 %37, %35 - store i8 %37, ptr %34, align 1 - %39 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %40 = load i8, ptr %39, align 1 - %zext28 = zext i8 %40 to i32 - %shl29 = shl i32 %zext28, 29 - %ashr30 = ashr i32 %shl29, 29 - %41 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %42 = load i8, ptr %41, align 1 - %zext31 = zext i8 %42 to i32 - %lshrl32 = lshr i32 %zext31, 3 - %43 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %44 = load i8, ptr %43, align 1 - %zext33 = zext i8 %44 to i32 - %shl34 = shl i32 %zext33, 5 - %45 = or i32 %shl34, %lshrl32 - %shl35 = shl i32 %45, 26 - %ashr36 = ashr i32 %shl35, 26 - call void (ptr, ...) @printf(ptr @.str.13, i32 %ashr30, i32 %ashr36) - %46 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %47 = load i8, ptr %46, align 1 - %zext37 = zext i8 %47 to i32 - %lshrl38 = lshr i32 %zext37, 3 - %48 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %49 = load i8, ptr %48, align 1 - %zext39 = zext i8 %49 to i32 - %shl40 = shl i32 %zext39, 5 - %50 = or i32 %shl40, %lshrl38 - %shl41 = shl i32 %50, 26 - %ashr42 = ashr i32 %shl41, 26 - %xor = xor i32 %ashr42, 4 - %51 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl43 = shl i32 %xor, 3 - %trunc44 = trunc i32 %shl43 to i8 - %52 = load i8, ptr %51, align 1 - %53 = and i8 %52, 7 - %54 = or i8 %53, %trunc44 - store i8 %54, ptr %51, align 1 - %lshrl45 = lshr i32 %xor, 5 - %55 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc46 = trunc i32 %lshrl45 to i8 - %56 = and i8 %trunc46, 1 - %57 = load i8, ptr %55, align 1 - %58 = and i8 %57, -2 - %59 = or i8 %58, %56 - store i8 %58, ptr %55, align 1 - %60 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %61 = load i8, ptr %60, align 1 - %zext47 = zext i8 %61 to i32 - %shl48 = shl i32 %zext47, 29 - %ashr49 = ashr i32 %shl48, 29 - %62 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %63 = load i8, ptr %62, align 1 - %zext50 = zext i8 %63 to i32 - %lshrl51 = lshr i32 %zext50, 3 - %64 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %65 = load i8, ptr %64, align 1 - %zext52 = zext i8 %65 to i32 - %shl53 = shl i32 %zext52, 5 - %66 = or i32 %shl53, %lshrl51 - %shl54 = shl i32 %66, 26 - %ashr55 = ashr i32 %shl54, 26 - call void (ptr, ...) @printf(ptr @.str.14, i32 %ashr49, i32 %ashr55) - %67 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %68 = load i8, ptr %67, align 1 - %zext56 = zext i8 %68 to i32 + %ptradd14 = getelementptr inbounds i8, ptr %xx, i64 1 + %14 = load i8, ptr %ptradd14, align 1 + %zext15 = zext i8 %14 to i32 + %shl16 = shl i32 %zext15, 5 + %15 = or i32 %shl16, %lshrl13 + %shl17 = shl i32 %15, 26 + %ashr18 = ashr i32 %shl17, 26 + call void (ptr, ...) @printf(ptr @.str.12, i32 %ashr11, i32 %ashr18) + %16 = load i8, ptr %xx, align 1 + %zext19 = zext i8 %16 to i32 + %lshrl20 = lshr i32 %zext19, 3 + %ptradd21 = getelementptr inbounds i8, ptr %xx, i64 1 + %17 = load i8, ptr %ptradd21, align 1 + %zext22 = zext i8 %17 to i32 + %shl23 = shl i32 %zext22, 5 + %18 = or i32 %shl23, %lshrl20 + %shl24 = shl i32 %18, 26 + %ashr25 = ashr i32 %shl24, 26 + %mul = mul i32 %ashr25, 2 + %shl26 = shl i32 %mul, 3 + %trunc27 = trunc i32 %shl26 to i8 + %19 = load i8, ptr %xx, align 1 + %20 = and i8 %19, 7 + %21 = or i8 %20, %trunc27 + store i8 %21, ptr %xx, align 1 + %lshrl28 = lshr i32 %mul, 5 + %ptradd29 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc30 = trunc i32 %lshrl28 to i8 + %22 = and i8 %trunc30, 1 + %23 = load i8, ptr %ptradd29, align 1 + %24 = and i8 %23, -2 + %25 = or i8 %24, %22 + store i8 %24, ptr %ptradd29, align 1 + %26 = load i8, ptr %xx, align 1 + %zext31 = zext i8 %26 to i32 + %shl32 = shl i32 %zext31, 29 + %ashr33 = ashr i32 %shl32, 29 + %27 = load i8, ptr %xx, align 1 + %zext34 = zext i8 %27 to i32 + %lshrl35 = lshr i32 %zext34, 3 + %ptradd36 = getelementptr inbounds i8, ptr %xx, i64 1 + %28 = load i8, ptr %ptradd36, align 1 + %zext37 = zext i8 %28 to i32 + %shl38 = shl i32 %zext37, 5 + %29 = or i32 %shl38, %lshrl35 + %shl39 = shl i32 %29, 26 + %ashr40 = ashr i32 %shl39, 26 + call void (ptr, ...) @printf(ptr @.str.13, i32 %ashr33, i32 %ashr40) + %30 = load i8, ptr %xx, align 1 + %zext41 = zext i8 %30 to i32 + %lshrl42 = lshr i32 %zext41, 3 + %ptradd43 = getelementptr inbounds i8, ptr %xx, i64 1 + %31 = load i8, ptr %ptradd43, align 1 + %zext44 = zext i8 %31 to i32 + %shl45 = shl i32 %zext44, 5 + %32 = or i32 %shl45, %lshrl42 + %shl46 = shl i32 %32, 26 + %ashr47 = ashr i32 %shl46, 26 + %xor = xor i32 %ashr47, 4 + %shl48 = shl i32 %xor, 3 + %trunc49 = trunc i32 %shl48 to i8 + %33 = load i8, ptr %xx, align 1 + %34 = and i8 %33, 7 + %35 = or i8 %34, %trunc49 + store i8 %35, ptr %xx, align 1 + %lshrl50 = lshr i32 %xor, 5 + %ptradd51 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc52 = trunc i32 %lshrl50 to i8 + %36 = and i8 %trunc52, 1 + %37 = load i8, ptr %ptradd51, align 1 + %38 = and i8 %37, -2 + %39 = or i8 %38, %36 + store i8 %38, ptr %ptradd51, align 1 + %40 = load i8, ptr %xx, align 1 + %zext53 = zext i8 %40 to i32 + %shl54 = shl i32 %zext53, 29 + %ashr55 = ashr i32 %shl54, 29 + %41 = load i8, ptr %xx, align 1 + %zext56 = zext i8 %41 to i32 %lshrl57 = lshr i32 %zext56, 3 - %69 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %70 = load i8, ptr %69, align 1 - %zext58 = zext i8 %70 to i32 - %shl59 = shl i32 %zext58, 5 - %71 = or i32 %shl59, %lshrl57 - %shl60 = shl i32 %71, 26 - %ashr61 = ashr i32 %shl60, 26 - %or = or i32 %ashr61, 4 - %72 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl62 = shl i32 %or, 3 - %trunc63 = trunc i32 %shl62 to i8 - %73 = load i8, ptr %72, align 1 - %74 = and i8 %73, 7 - %75 = or i8 %74, %trunc63 - store i8 %75, ptr %72, align 1 - %lshrl64 = lshr i32 %or, 5 - %76 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc65 = trunc i32 %lshrl64 to i8 - %77 = and i8 %trunc65, 1 - %78 = load i8, ptr %76, align 1 - %79 = and i8 %78, -2 - %80 = or i8 %79, %77 - store i8 %79, ptr %76, align 1 - %81 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %82 = load i8, ptr %81, align 1 - %zext66 = zext i8 %82 to i32 - %shl67 = shl i32 %zext66, 29 - %ashr68 = ashr i32 %shl67, 29 - %83 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %84 = load i8, ptr %83, align 1 - %zext69 = zext i8 %84 to i32 - %lshrl70 = lshr i32 %zext69, 3 - %85 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %86 = load i8, ptr %85, align 1 - %zext71 = zext i8 %86 to i32 - %shl72 = shl i32 %zext71, 5 - %87 = or i32 %shl72, %lshrl70 - %shl73 = shl i32 %87, 26 - %ashr74 = ashr i32 %shl73, 26 - call void (ptr, ...) @printf(ptr @.str.15, i32 %ashr68, i32 %ashr74) - %88 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %89 = load i8, ptr %88, align 1 - %zext75 = zext i8 %89 to i32 - %lshrl76 = lshr i32 %zext75, 3 - %90 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %91 = load i8, ptr %90, align 1 - %zext77 = zext i8 %91 to i32 - %shl78 = shl i32 %zext77, 5 - %92 = or i32 %shl78, %lshrl76 - %shl79 = shl i32 %92, 26 - %ashr80 = ashr i32 %shl79, 26 - %shl81 = shl i32 %ashr80, 1 - %93 = freeze i32 %shl81 - %94 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl82 = shl i32 %93, 3 - %trunc83 = trunc i32 %shl82 to i8 - %95 = load i8, ptr %94, align 1 - %96 = and i8 %95, 7 - %97 = or i8 %96, %trunc83 - store i8 %97, ptr %94, align 1 - %lshrl84 = lshr i32 %93, 5 - %98 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc85 = trunc i32 %lshrl84 to i8 - %99 = and i8 %trunc85, 1 - %100 = load i8, ptr %98, align 1 - %101 = and i8 %100, -2 - %102 = or i8 %101, %99 - store i8 %101, ptr %98, align 1 - %103 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %104 = load i8, ptr %103, align 1 - %zext86 = zext i8 %104 to i32 - %shl87 = shl i32 %zext86, 29 - %ashr88 = ashr i32 %shl87, 29 - %105 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %106 = load i8, ptr %105, align 1 - %zext89 = zext i8 %106 to i32 - %lshrl90 = lshr i32 %zext89, 3 - %107 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %108 = load i8, ptr %107, align 1 - %zext91 = zext i8 %108 to i32 - %shl92 = shl i32 %zext91, 5 - %109 = or i32 %shl92, %lshrl90 - %shl93 = shl i32 %109, 26 - %ashr94 = ashr i32 %shl93, 26 - call void (ptr, ...) @printf(ptr @.str.16, i32 %ashr88, i32 %ashr94) - %110 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %111 = load i8, ptr %110, align 1 - %zext95 = zext i8 %111 to i32 - %lshrl96 = lshr i32 %zext95, 3 - %112 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %113 = load i8, ptr %112, align 1 - %zext97 = zext i8 %113 to i32 - %shl98 = shl i32 %zext97, 5 - %114 = or i32 %shl98, %lshrl96 - %shl99 = shl i32 %114, 26 - %ashr100 = ashr i32 %shl99, 26 - %ashr101 = ashr i32 %ashr100, 1 - %115 = freeze i32 %ashr101 - %116 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl102 = shl i32 %115, 3 - %trunc103 = trunc i32 %shl102 to i8 - %117 = load i8, ptr %116, align 1 - %118 = and i8 %117, 7 - %119 = or i8 %118, %trunc103 - store i8 %119, ptr %116, align 1 - %lshrl104 = lshr i32 %115, 5 - %120 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc105 = trunc i32 %lshrl104 to i8 - %121 = and i8 %trunc105, 1 - %122 = load i8, ptr %120, align 1 - %123 = and i8 %122, -2 - %124 = or i8 %123, %121 - store i8 %123, ptr %120, align 1 - %125 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %126 = load i8, ptr %125, align 1 - %zext106 = zext i8 %126 to i32 - %shl107 = shl i32 %zext106, 29 - %ashr108 = ashr i32 %shl107, 29 - %127 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %128 = load i8, ptr %127, align 1 - %zext109 = zext i8 %128 to i32 - %lshrl110 = lshr i32 %zext109, 3 - %129 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %130 = load i8, ptr %129, align 1 - %zext111 = zext i8 %130 to i32 + %ptradd58 = getelementptr inbounds i8, ptr %xx, i64 1 + %42 = load i8, ptr %ptradd58, align 1 + %zext59 = zext i8 %42 to i32 + %shl60 = shl i32 %zext59, 5 + %43 = or i32 %shl60, %lshrl57 + %shl61 = shl i32 %43, 26 + %ashr62 = ashr i32 %shl61, 26 + call void (ptr, ...) @printf(ptr @.str.14, i32 %ashr55, i32 %ashr62) + %44 = load i8, ptr %xx, align 1 + %zext63 = zext i8 %44 to i32 + %lshrl64 = lshr i32 %zext63, 3 + %ptradd65 = getelementptr inbounds i8, ptr %xx, i64 1 + %45 = load i8, ptr %ptradd65, align 1 + %zext66 = zext i8 %45 to i32 + %shl67 = shl i32 %zext66, 5 + %46 = or i32 %shl67, %lshrl64 + %shl68 = shl i32 %46, 26 + %ashr69 = ashr i32 %shl68, 26 + %or = or i32 %ashr69, 4 + %shl70 = shl i32 %or, 3 + %trunc71 = trunc i32 %shl70 to i8 + %47 = load i8, ptr %xx, align 1 + %48 = and i8 %47, 7 + %49 = or i8 %48, %trunc71 + store i8 %49, ptr %xx, align 1 + %lshrl72 = lshr i32 %or, 5 + %ptradd73 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc74 = trunc i32 %lshrl72 to i8 + %50 = and i8 %trunc74, 1 + %51 = load i8, ptr %ptradd73, align 1 + %52 = and i8 %51, -2 + %53 = or i8 %52, %50 + store i8 %52, ptr %ptradd73, align 1 + %54 = load i8, ptr %xx, align 1 + %zext75 = zext i8 %54 to i32 + %shl76 = shl i32 %zext75, 29 + %ashr77 = ashr i32 %shl76, 29 + %55 = load i8, ptr %xx, align 1 + %zext78 = zext i8 %55 to i32 + %lshrl79 = lshr i32 %zext78, 3 + %ptradd80 = getelementptr inbounds i8, ptr %xx, i64 1 + %56 = load i8, ptr %ptradd80, align 1 + %zext81 = zext i8 %56 to i32 + %shl82 = shl i32 %zext81, 5 + %57 = or i32 %shl82, %lshrl79 + %shl83 = shl i32 %57, 26 + %ashr84 = ashr i32 %shl83, 26 + call void (ptr, ...) @printf(ptr @.str.15, i32 %ashr77, i32 %ashr84) + %58 = load i8, ptr %xx, align 1 + %zext85 = zext i8 %58 to i32 + %lshrl86 = lshr i32 %zext85, 3 + %ptradd87 = getelementptr inbounds i8, ptr %xx, i64 1 + %59 = load i8, ptr %ptradd87, align 1 + %zext88 = zext i8 %59 to i32 + %shl89 = shl i32 %zext88, 5 + %60 = or i32 %shl89, %lshrl86 + %shl90 = shl i32 %60, 26 + %ashr91 = ashr i32 %shl90, 26 + %shl92 = shl i32 %ashr91, 1 + %61 = freeze i32 %shl92 + %shl93 = shl i32 %61, 3 + %trunc94 = trunc i32 %shl93 to i8 + %62 = load i8, ptr %xx, align 1 + %63 = and i8 %62, 7 + %64 = or i8 %63, %trunc94 + store i8 %64, ptr %xx, align 1 + %lshrl95 = lshr i32 %61, 5 + %ptradd96 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc97 = trunc i32 %lshrl95 to i8 + %65 = and i8 %trunc97, 1 + %66 = load i8, ptr %ptradd96, align 1 + %67 = and i8 %66, -2 + %68 = or i8 %67, %65 + store i8 %67, ptr %ptradd96, align 1 + %69 = load i8, ptr %xx, align 1 + %zext98 = zext i8 %69 to i32 + %shl99 = shl i32 %zext98, 29 + %ashr100 = ashr i32 %shl99, 29 + %70 = load i8, ptr %xx, align 1 + %zext101 = zext i8 %70 to i32 + %lshrl102 = lshr i32 %zext101, 3 + %ptradd103 = getelementptr inbounds i8, ptr %xx, i64 1 + %71 = load i8, ptr %ptradd103, align 1 + %zext104 = zext i8 %71 to i32 + %shl105 = shl i32 %zext104, 5 + %72 = or i32 %shl105, %lshrl102 + %shl106 = shl i32 %72, 26 + %ashr107 = ashr i32 %shl106, 26 + call void (ptr, ...) @printf(ptr @.str.16, i32 %ashr100, i32 %ashr107) + %73 = load i8, ptr %xx, align 1 + %zext108 = zext i8 %73 to i32 + %lshrl109 = lshr i32 %zext108, 3 + %ptradd110 = getelementptr inbounds i8, ptr %xx, i64 1 + %74 = load i8, ptr %ptradd110, align 1 + %zext111 = zext i8 %74 to i32 %shl112 = shl i32 %zext111, 5 - %131 = or i32 %shl112, %lshrl110 - %shl113 = shl i32 %131, 26 + %75 = or i32 %shl112, %lshrl109 + %shl113 = shl i32 %75, 26 %ashr114 = ashr i32 %shl113, 26 - call void (ptr, ...) @printf(ptr @.str.17, i32 %ashr108, i32 %ashr114) - %132 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %133 = load i8, ptr %132, align 1 - %zext115 = zext i8 %133 to i32 - %lshrl116 = lshr i32 %zext115, 3 - %134 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %135 = load i8, ptr %134, align 1 - %zext117 = zext i8 %135 to i32 - %shl118 = shl i32 %zext117, 5 - %136 = or i32 %shl118, %lshrl116 - %shl119 = shl i32 %136, 26 - %ashr120 = ashr i32 %shl119, 26 - %sdiv = sdiv i32 %ashr120, 2 - %137 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl121 = shl i32 %sdiv, 3 - %trunc122 = trunc i32 %shl121 to i8 - %138 = load i8, ptr %137, align 1 - %139 = and i8 %138, 7 - %140 = or i8 %139, %trunc122 - store i8 %140, ptr %137, align 1 - %lshrl123 = lshr i32 %sdiv, 5 - %141 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc124 = trunc i32 %lshrl123 to i8 - %142 = and i8 %trunc124, 1 - %143 = load i8, ptr %141, align 1 - %144 = and i8 %143, -2 - %145 = or i8 %144, %142 - store i8 %144, ptr %141, align 1 - %146 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %147 = load i8, ptr %146, align 1 - %zext125 = zext i8 %147 to i32 - %shl126 = shl i32 %zext125, 29 - %ashr127 = ashr i32 %shl126, 29 - %148 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %149 = load i8, ptr %148, align 1 - %zext128 = zext i8 %149 to i32 - %lshrl129 = lshr i32 %zext128, 3 - %150 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %151 = load i8, ptr %150, align 1 - %zext130 = zext i8 %151 to i32 - %shl131 = shl i32 %zext130, 5 - %152 = or i32 %shl131, %lshrl129 - %shl132 = shl i32 %152, 26 - %ashr133 = ashr i32 %shl132, 26 - call void (ptr, ...) @printf(ptr @.str.18, i32 %ashr127, i32 %ashr133) - %153 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %154 = load i8, ptr %153, align 1 - %zext134 = zext i8 %154 to i32 - %lshrl135 = lshr i32 %zext134, 3 - %155 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %156 = load i8, ptr %155, align 1 - %zext136 = zext i8 %156 to i32 - %shl137 = shl i32 %zext136, 5 - %157 = or i32 %shl137, %lshrl135 - %shl138 = shl i32 %157, 26 - %ashr139 = ashr i32 %shl138, 26 - %smod = srem i32 %ashr139, 2 - %158 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl140 = shl i32 %smod, 3 - %trunc141 = trunc i32 %shl140 to i8 - %159 = load i8, ptr %158, align 1 - %160 = and i8 %159, 7 - %161 = or i8 %160, %trunc141 - store i8 %161, ptr %158, align 1 - %lshrl142 = lshr i32 %smod, 5 - %162 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc143 = trunc i32 %lshrl142 to i8 - %163 = and i8 %trunc143, 1 - %164 = load i8, ptr %162, align 1 - %165 = and i8 %164, -2 - %166 = or i8 %165, %163 - store i8 %165, ptr %162, align 1 - %167 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %168 = load i8, ptr %167, align 1 - %zext144 = zext i8 %168 to i32 - %shl145 = shl i32 %zext144, 29 - %ashr146 = ashr i32 %shl145, 29 - %169 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %170 = load i8, ptr %169, align 1 - %zext147 = zext i8 %170 to i32 - %lshrl148 = lshr i32 %zext147, 3 - %171 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %172 = load i8, ptr %171, align 1 - %zext149 = zext i8 %172 to i32 + %ashr115 = ashr i32 %ashr114, 1 + %76 = freeze i32 %ashr115 + %shl116 = shl i32 %76, 3 + %trunc117 = trunc i32 %shl116 to i8 + %77 = load i8, ptr %xx, align 1 + %78 = and i8 %77, 7 + %79 = or i8 %78, %trunc117 + store i8 %79, ptr %xx, align 1 + %lshrl118 = lshr i32 %76, 5 + %ptradd119 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc120 = trunc i32 %lshrl118 to i8 + %80 = and i8 %trunc120, 1 + %81 = load i8, ptr %ptradd119, align 1 + %82 = and i8 %81, -2 + %83 = or i8 %82, %80 + store i8 %82, ptr %ptradd119, align 1 + %84 = load i8, ptr %xx, align 1 + %zext121 = zext i8 %84 to i32 + %shl122 = shl i32 %zext121, 29 + %ashr123 = ashr i32 %shl122, 29 + %85 = load i8, ptr %xx, align 1 + %zext124 = zext i8 %85 to i32 + %lshrl125 = lshr i32 %zext124, 3 + %ptradd126 = getelementptr inbounds i8, ptr %xx, i64 1 + %86 = load i8, ptr %ptradd126, align 1 + %zext127 = zext i8 %86 to i32 + %shl128 = shl i32 %zext127, 5 + %87 = or i32 %shl128, %lshrl125 + %shl129 = shl i32 %87, 26 + %ashr130 = ashr i32 %shl129, 26 + call void (ptr, ...) @printf(ptr @.str.17, i32 %ashr123, i32 %ashr130) + %88 = load i8, ptr %xx, align 1 + %zext131 = zext i8 %88 to i32 + %lshrl132 = lshr i32 %zext131, 3 + %ptradd133 = getelementptr inbounds i8, ptr %xx, i64 1 + %89 = load i8, ptr %ptradd133, align 1 + %zext134 = zext i8 %89 to i32 + %shl135 = shl i32 %zext134, 5 + %90 = or i32 %shl135, %lshrl132 + %shl136 = shl i32 %90, 26 + %ashr137 = ashr i32 %shl136, 26 + %sdiv = sdiv i32 %ashr137, 2 + %shl138 = shl i32 %sdiv, 3 + %trunc139 = trunc i32 %shl138 to i8 + %91 = load i8, ptr %xx, align 1 + %92 = and i8 %91, 7 + %93 = or i8 %92, %trunc139 + store i8 %93, ptr %xx, align 1 + %lshrl140 = lshr i32 %sdiv, 5 + %ptradd141 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc142 = trunc i32 %lshrl140 to i8 + %94 = and i8 %trunc142, 1 + %95 = load i8, ptr %ptradd141, align 1 + %96 = and i8 %95, -2 + %97 = or i8 %96, %94 + store i8 %96, ptr %ptradd141, align 1 + %98 = load i8, ptr %xx, align 1 + %zext143 = zext i8 %98 to i32 + %shl144 = shl i32 %zext143, 29 + %ashr145 = ashr i32 %shl144, 29 + %99 = load i8, ptr %xx, align 1 + %zext146 = zext i8 %99 to i32 + %lshrl147 = lshr i32 %zext146, 3 + %ptradd148 = getelementptr inbounds i8, ptr %xx, i64 1 + %100 = load i8, ptr %ptradd148, align 1 + %zext149 = zext i8 %100 to i32 %shl150 = shl i32 %zext149, 5 - %173 = or i32 %shl150, %lshrl148 - %shl151 = shl i32 %173, 26 + %101 = or i32 %shl150, %lshrl147 + %shl151 = shl i32 %101, 26 %ashr152 = ashr i32 %shl151, 26 - call void (ptr, ...) @printf(ptr @.str.19, i32 %ashr146, i32 %ashr152) - %174 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %175 = load i8, ptr %174, align 1 - %lshrl153 = lshr i8 %175, 4 - %176 = trunc i8 %lshrl153 to i1 - %boolsi = zext i1 %176 to i32 + call void (ptr, ...) @printf(ptr @.str.18, i32 %ashr145, i32 %ashr152) + %102 = load i8, ptr %xx, align 1 + %zext153 = zext i8 %102 to i32 + %lshrl154 = lshr i32 %zext153, 3 + %ptradd155 = getelementptr inbounds i8, ptr %xx, i64 1 + %103 = load i8, ptr %ptradd155, align 1 + %zext156 = zext i8 %103 to i32 + %shl157 = shl i32 %zext156, 5 + %104 = or i32 %shl157, %lshrl154 + %shl158 = shl i32 %104, 26 + %ashr159 = ashr i32 %shl158, 26 + %smod = srem i32 %ashr159, 2 + %shl160 = shl i32 %smod, 3 + %trunc161 = trunc i32 %shl160 to i8 + %105 = load i8, ptr %xx, align 1 + %106 = and i8 %105, 7 + %107 = or i8 %106, %trunc161 + store i8 %107, ptr %xx, align 1 + %lshrl162 = lshr i32 %smod, 5 + %ptradd163 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc164 = trunc i32 %lshrl162 to i8 + %108 = and i8 %trunc164, 1 + %109 = load i8, ptr %ptradd163, align 1 + %110 = and i8 %109, -2 + %111 = or i8 %110, %108 + store i8 %110, ptr %ptradd163, align 1 + %112 = load i8, ptr %xx, align 1 + %zext165 = zext i8 %112 to i32 + %shl166 = shl i32 %zext165, 29 + %ashr167 = ashr i32 %shl166, 29 + %113 = load i8, ptr %xx, align 1 + %zext168 = zext i8 %113 to i32 + %lshrl169 = lshr i32 %zext168, 3 + %ptradd170 = getelementptr inbounds i8, ptr %xx, i64 1 + %114 = load i8, ptr %ptradd170, align 1 + %zext171 = zext i8 %114 to i32 + %shl172 = shl i32 %zext171, 5 + %115 = or i32 %shl172, %lshrl169 + %shl173 = shl i32 %115, 26 + %ashr174 = ashr i32 %shl173, 26 + call void (ptr, ...) @printf(ptr @.str.19, i32 %ashr167, i32 %ashr174) + %ptradd175 = getelementptr inbounds i8, ptr %xx, i64 2 + %116 = load i8, ptr %ptradd175, align 1 + %lshrl176 = lshr i8 %116, 4 + %117 = trunc i8 %lshrl176 to i1 + %boolsi = zext i1 %117 to i32 call void (ptr, ...) @printf(ptr @.str.20, i32 %boolsi) - %177 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %178 = load i8, ptr %177, align 1 - %179 = and i8 %178, -17 - %180 = or i8 %179, 16 - store i8 %180, ptr %177, align 1 - %181 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %182 = load i8, ptr %181, align 1 - %lshrl154 = lshr i8 %182, 4 - %183 = trunc i8 %lshrl154 to i1 - %boolsi155 = zext i1 %183 to i32 - call void (ptr, ...) @printf(ptr @.str.21, i32 %boolsi155) - %184 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %185 = load i8, ptr %184, align 1 - %186 = and i8 %185, -17 - store i8 %186, ptr %184, align 1 - %187 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %188 = load i8, ptr %187, align 1 - %lshrl156 = lshr i8 %188, 4 - %189 = trunc i8 %lshrl156 to i1 - %boolsi157 = zext i1 %189 to i32 - call void (ptr, ...) @printf(ptr @.str.22, i32 %boolsi157) + %ptradd177 = getelementptr inbounds i8, ptr %xx, i64 2 + %118 = load i8, ptr %ptradd177, align 1 + %119 = and i8 %118, -17 + %120 = or i8 %119, 16 + store i8 %120, ptr %ptradd177, align 1 + %ptradd178 = getelementptr inbounds i8, ptr %xx, i64 2 + %121 = load i8, ptr %ptradd178, align 1 + %lshrl179 = lshr i8 %121, 4 + %122 = trunc i8 %lshrl179 to i1 + %boolsi180 = zext i1 %122 to i32 + call void (ptr, ...) @printf(ptr @.str.21, i32 %boolsi180) + %ptradd181 = getelementptr inbounds i8, ptr %xx, i64 2 + %123 = load i8, ptr %ptradd181, align 1 + %124 = and i8 %123, -17 + store i8 %124, ptr %ptradd181, align 1 + %ptradd182 = getelementptr inbounds i8, ptr %xx, i64 2 + %125 = load i8, ptr %ptradd182, align 1 + %lshrl183 = lshr i8 %125, 4 + %126 = trunc i8 %lshrl183 to i1 + %boolsi184 = zext i1 %126 to i32 + call void (ptr, ...) @printf(ptr @.str.22, i32 %boolsi184) ret void } - +; Function Attrs: define void @foo.test3() #0 { entry: %xx = alloca [3 x i8], align 1 store [3 x i8] c"4<\00", ptr %xx, align 1 - %0 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %1 = load i8, ptr %0, align 1 - %2 = and i8 %1, -15 - %3 = or i8 %2, 6 - store i8 %3, ptr %0, align 1 - %4 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %5 = load i8, ptr %4, align 1 - %zext = zext i8 %5 to i32 + %0 = load i8, ptr %xx, align 1 + %1 = and i8 %0, -15 + %2 = or i8 %1, 6 + store i8 %2, ptr %xx, align 1 + %3 = load i8, ptr %xx, align 1 + %zext = zext i8 %3 to i32 %lshrl = lshr i32 %zext, 1 %shl = shl i32 %lshrl, 29 %ashr = ashr i32 %shl, 29 - %6 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %7 = load i8, ptr %6, align 1 - %zext1 = zext i8 %7 to i32 + %4 = load i8, ptr %xx, align 1 + %zext1 = zext i8 %4 to i32 %lshrl2 = lshr i32 %zext1, 4 - %8 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %9 = load i8, ptr %8, align 1 - %zext3 = zext i8 %9 to i32 + %ptradd = getelementptr inbounds i8, ptr %xx, i64 1 + %5 = load i8, ptr %ptradd, align 1 + %zext3 = zext i8 %5 to i32 %shl4 = shl i32 %zext3, 4 - %10 = or i32 %shl4, %lshrl2 - %shl5 = shl i32 %10, 26 + %6 = or i32 %shl4, %lshrl2 + %shl5 = shl i32 %6, 26 %ashr6 = ashr i32 %shl5, 26 call void (ptr, ...) @printf(ptr @.str.23, i32 %ashr, i32 %ashr6) - %11 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %12 = load i8, ptr %11, align 1 - %zext7 = zext i8 %12 to i32 + %7 = load i8, ptr %xx, align 1 + %zext7 = zext i8 %7 to i32 %lshrl8 = lshr i32 %zext7, 1 %shl9 = shl i32 %lshrl8, 29 %ashr10 = ashr i32 %shl9, 29 %sub = sub i32 %ashr10, 1 - %13 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 %shl11 = shl i32 %sub, 1 %trunc = trunc i32 %shl11 to i8 - %14 = and i8 %trunc, 15 - %15 = load i8, ptr %13, align 1 - %16 = and i8 %15, -15 - %17 = or i8 %16, %14 - store i8 %17, ptr %13, align 1 + %8 = and i8 %trunc, 15 + %9 = load i8, ptr %xx, align 1 + %10 = and i8 %9, -15 + %11 = or i8 %10, %8 + store i8 %11, ptr %xx, align 1 %lshrl12 = lshr i32 %sub, 7 - %18 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %19 = load i8, ptr %18, align 1 - %zext13 = zext i8 %19 to i32 + %12 = load i8, ptr %xx, align 1 + %zext13 = zext i8 %12 to i32 %lshrl14 = lshr i32 %zext13, 1 %shl15 = shl i32 %lshrl14, 29 %ashr16 = ashr i32 %shl15, 29 - %20 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %21 = load i8, ptr %20, align 1 - %zext17 = zext i8 %21 to i32 + %13 = load i8, ptr %xx, align 1 + %zext17 = zext i8 %13 to i32 %lshrl18 = lshr i32 %zext17, 4 - %22 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %23 = load i8, ptr %22, align 1 - %zext19 = zext i8 %23 to i32 - %shl20 = shl i32 %zext19, 4 - %24 = or i32 %shl20, %lshrl18 - %shl21 = shl i32 %24, 26 - %ashr22 = ashr i32 %shl21, 26 - call void (ptr, ...) @printf(ptr @.str.24, i32 %ashr16, i32 %ashr22) - %25 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %26 = load i8, ptr %25, align 1 - %zext23 = zext i8 %26 to i32 - %lshrl24 = lshr i32 %zext23, 4 - %27 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %28 = load i8, ptr %27, align 1 - %zext25 = zext i8 %28 to i32 - %shl26 = shl i32 %zext25, 4 - %29 = or i32 %shl26, %lshrl24 - %shl27 = shl i32 %29, 26 - %ashr28 = ashr i32 %shl27, 26 - %mul = mul i32 %ashr28, 2 - %30 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl29 = shl i32 %mul, 4 - %trunc30 = trunc i32 %shl29 to i8 - %31 = load i8, ptr %30, align 1 - %32 = and i8 %31, 15 - %33 = or i8 %32, %trunc30 - store i8 %33, ptr %30, align 1 - %lshrl31 = lshr i32 %mul, 4 - %34 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc32 = trunc i32 %lshrl31 to i8 - %35 = and i8 %trunc32, 3 - %36 = load i8, ptr %34, align 1 - %37 = and i8 %36, -4 - %38 = or i8 %37, %35 - store i8 %37, ptr %34, align 1 - %39 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %40 = load i8, ptr %39, align 1 - %zext33 = zext i8 %40 to i32 - %lshrl34 = lshr i32 %zext33, 1 - %shl35 = shl i32 %lshrl34, 29 - %ashr36 = ashr i32 %shl35, 29 - %41 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %42 = load i8, ptr %41, align 1 - %zext37 = zext i8 %42 to i32 - %lshrl38 = lshr i32 %zext37, 4 - %43 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %44 = load i8, ptr %43, align 1 - %zext39 = zext i8 %44 to i32 - %shl40 = shl i32 %zext39, 4 - %45 = or i32 %shl40, %lshrl38 - %shl41 = shl i32 %45, 26 - %ashr42 = ashr i32 %shl41, 26 - call void (ptr, ...) @printf(ptr @.str.25, i32 %ashr36, i32 %ashr42) - %46 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %47 = load i8, ptr %46, align 1 - %zext43 = zext i8 %47 to i32 - %lshrl44 = lshr i32 %zext43, 4 - %48 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %49 = load i8, ptr %48, align 1 - %zext45 = zext i8 %49 to i32 - %shl46 = shl i32 %zext45, 4 - %50 = or i32 %shl46, %lshrl44 - %shl47 = shl i32 %50, 26 - %ashr48 = ashr i32 %shl47, 26 - %xor = xor i32 %ashr48, 4 - %51 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl49 = shl i32 %xor, 4 - %trunc50 = trunc i32 %shl49 to i8 - %52 = load i8, ptr %51, align 1 - %53 = and i8 %52, 15 - %54 = or i8 %53, %trunc50 - store i8 %54, ptr %51, align 1 - %lshrl51 = lshr i32 %xor, 4 - %55 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc52 = trunc i32 %lshrl51 to i8 - %56 = and i8 %trunc52, 3 - %57 = load i8, ptr %55, align 1 - %58 = and i8 %57, -4 - %59 = or i8 %58, %56 - store i8 %58, ptr %55, align 1 - %60 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %61 = load i8, ptr %60, align 1 - %zext53 = zext i8 %61 to i32 - %lshrl54 = lshr i32 %zext53, 1 - %shl55 = shl i32 %lshrl54, 29 - %ashr56 = ashr i32 %shl55, 29 - %62 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %63 = load i8, ptr %62, align 1 - %zext57 = zext i8 %63 to i32 - %lshrl58 = lshr i32 %zext57, 4 - %64 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %65 = load i8, ptr %64, align 1 - %zext59 = zext i8 %65 to i32 - %shl60 = shl i32 %zext59, 4 - %66 = or i32 %shl60, %lshrl58 - %shl61 = shl i32 %66, 26 - %ashr62 = ashr i32 %shl61, 26 - call void (ptr, ...) @printf(ptr @.str.26, i32 %ashr56, i32 %ashr62) - %67 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %68 = load i8, ptr %67, align 1 - %zext63 = zext i8 %68 to i32 + %ptradd19 = getelementptr inbounds i8, ptr %xx, i64 1 + %14 = load i8, ptr %ptradd19, align 1 + %zext20 = zext i8 %14 to i32 + %shl21 = shl i32 %zext20, 4 + %15 = or i32 %shl21, %lshrl18 + %shl22 = shl i32 %15, 26 + %ashr23 = ashr i32 %shl22, 26 + call void (ptr, ...) @printf(ptr @.str.24, i32 %ashr16, i32 %ashr23) + %16 = load i8, ptr %xx, align 1 + %zext24 = zext i8 %16 to i32 + %lshrl25 = lshr i32 %zext24, 4 + %ptradd26 = getelementptr inbounds i8, ptr %xx, i64 1 + %17 = load i8, ptr %ptradd26, align 1 + %zext27 = zext i8 %17 to i32 + %shl28 = shl i32 %zext27, 4 + %18 = or i32 %shl28, %lshrl25 + %shl29 = shl i32 %18, 26 + %ashr30 = ashr i32 %shl29, 26 + %mul = mul i32 %ashr30, 2 + %shl31 = shl i32 %mul, 4 + %trunc32 = trunc i32 %shl31 to i8 + %19 = load i8, ptr %xx, align 1 + %20 = and i8 %19, 15 + %21 = or i8 %20, %trunc32 + store i8 %21, ptr %xx, align 1 + %lshrl33 = lshr i32 %mul, 4 + %ptradd34 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc35 = trunc i32 %lshrl33 to i8 + %22 = and i8 %trunc35, 3 + %23 = load i8, ptr %ptradd34, align 1 + %24 = and i8 %23, -4 + %25 = or i8 %24, %22 + store i8 %24, ptr %ptradd34, align 1 + %26 = load i8, ptr %xx, align 1 + %zext36 = zext i8 %26 to i32 + %lshrl37 = lshr i32 %zext36, 1 + %shl38 = shl i32 %lshrl37, 29 + %ashr39 = ashr i32 %shl38, 29 + %27 = load i8, ptr %xx, align 1 + %zext40 = zext i8 %27 to i32 + %lshrl41 = lshr i32 %zext40, 4 + %ptradd42 = getelementptr inbounds i8, ptr %xx, i64 1 + %28 = load i8, ptr %ptradd42, align 1 + %zext43 = zext i8 %28 to i32 + %shl44 = shl i32 %zext43, 4 + %29 = or i32 %shl44, %lshrl41 + %shl45 = shl i32 %29, 26 + %ashr46 = ashr i32 %shl45, 26 + call void (ptr, ...) @printf(ptr @.str.25, i32 %ashr39, i32 %ashr46) + %30 = load i8, ptr %xx, align 1 + %zext47 = zext i8 %30 to i32 + %lshrl48 = lshr i32 %zext47, 4 + %ptradd49 = getelementptr inbounds i8, ptr %xx, i64 1 + %31 = load i8, ptr %ptradd49, align 1 + %zext50 = zext i8 %31 to i32 + %shl51 = shl i32 %zext50, 4 + %32 = or i32 %shl51, %lshrl48 + %shl52 = shl i32 %32, 26 + %ashr53 = ashr i32 %shl52, 26 + %xor = xor i32 %ashr53, 4 + %shl54 = shl i32 %xor, 4 + %trunc55 = trunc i32 %shl54 to i8 + %33 = load i8, ptr %xx, align 1 + %34 = and i8 %33, 15 + %35 = or i8 %34, %trunc55 + store i8 %35, ptr %xx, align 1 + %lshrl56 = lshr i32 %xor, 4 + %ptradd57 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc58 = trunc i32 %lshrl56 to i8 + %36 = and i8 %trunc58, 3 + %37 = load i8, ptr %ptradd57, align 1 + %38 = and i8 %37, -4 + %39 = or i8 %38, %36 + store i8 %38, ptr %ptradd57, align 1 + %40 = load i8, ptr %xx, align 1 + %zext59 = zext i8 %40 to i32 + %lshrl60 = lshr i32 %zext59, 1 + %shl61 = shl i32 %lshrl60, 29 + %ashr62 = ashr i32 %shl61, 29 + %41 = load i8, ptr %xx, align 1 + %zext63 = zext i8 %41 to i32 %lshrl64 = lshr i32 %zext63, 4 - %69 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %70 = load i8, ptr %69, align 1 - %zext65 = zext i8 %70 to i32 - %shl66 = shl i32 %zext65, 4 - %71 = or i32 %shl66, %lshrl64 - %shl67 = shl i32 %71, 26 - %ashr68 = ashr i32 %shl67, 26 - %or = or i32 %ashr68, 4 - %72 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl69 = shl i32 %or, 4 - %trunc70 = trunc i32 %shl69 to i8 - %73 = load i8, ptr %72, align 1 - %74 = and i8 %73, 15 - %75 = or i8 %74, %trunc70 - store i8 %75, ptr %72, align 1 - %lshrl71 = lshr i32 %or, 4 - %76 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc72 = trunc i32 %lshrl71 to i8 - %77 = and i8 %trunc72, 3 - %78 = load i8, ptr %76, align 1 - %79 = and i8 %78, -4 - %80 = or i8 %79, %77 - store i8 %79, ptr %76, align 1 - %81 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %82 = load i8, ptr %81, align 1 - %zext73 = zext i8 %82 to i32 - %lshrl74 = lshr i32 %zext73, 1 - %shl75 = shl i32 %lshrl74, 29 - %ashr76 = ashr i32 %shl75, 29 - %83 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %84 = load i8, ptr %83, align 1 - %zext77 = zext i8 %84 to i32 - %lshrl78 = lshr i32 %zext77, 4 - %85 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %86 = load i8, ptr %85, align 1 - %zext79 = zext i8 %86 to i32 - %shl80 = shl i32 %zext79, 4 - %87 = or i32 %shl80, %lshrl78 - %shl81 = shl i32 %87, 26 - %ashr82 = ashr i32 %shl81, 26 - call void (ptr, ...) @printf(ptr @.str.27, i32 %ashr76, i32 %ashr82) - %88 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %89 = load i8, ptr %88, align 1 - %zext83 = zext i8 %89 to i32 - %lshrl84 = lshr i32 %zext83, 4 - %90 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %91 = load i8, ptr %90, align 1 - %zext85 = zext i8 %91 to i32 - %shl86 = shl i32 %zext85, 4 - %92 = or i32 %shl86, %lshrl84 - %shl87 = shl i32 %92, 26 - %ashr88 = ashr i32 %shl87, 26 - %shl89 = shl i32 %ashr88, 1 - %93 = freeze i32 %shl89 - %94 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl90 = shl i32 %93, 4 - %trunc91 = trunc i32 %shl90 to i8 - %95 = load i8, ptr %94, align 1 - %96 = and i8 %95, 15 - %97 = or i8 %96, %trunc91 - store i8 %97, ptr %94, align 1 - %lshrl92 = lshr i32 %93, 4 - %98 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc93 = trunc i32 %lshrl92 to i8 - %99 = and i8 %trunc93, 3 - %100 = load i8, ptr %98, align 1 - %101 = and i8 %100, -4 - %102 = or i8 %101, %99 - store i8 %101, ptr %98, align 1 - %103 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %104 = load i8, ptr %103, align 1 - %zext94 = zext i8 %104 to i32 - %lshrl95 = lshr i32 %zext94, 1 - %shl96 = shl i32 %lshrl95, 29 - %ashr97 = ashr i32 %shl96, 29 - %105 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %106 = load i8, ptr %105, align 1 - %zext98 = zext i8 %106 to i32 - %lshrl99 = lshr i32 %zext98, 4 - %107 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %108 = load i8, ptr %107, align 1 - %zext100 = zext i8 %108 to i32 - %shl101 = shl i32 %zext100, 4 - %109 = or i32 %shl101, %lshrl99 - %shl102 = shl i32 %109, 26 - %ashr103 = ashr i32 %shl102, 26 - call void (ptr, ...) @printf(ptr @.str.28, i32 %ashr97, i32 %ashr103) - %110 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %111 = load i8, ptr %110, align 1 - %zext104 = zext i8 %111 to i32 - %lshrl105 = lshr i32 %zext104, 4 - %112 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %113 = load i8, ptr %112, align 1 - %zext106 = zext i8 %113 to i32 - %shl107 = shl i32 %zext106, 4 - %114 = or i32 %shl107, %lshrl105 - %shl108 = shl i32 %114, 26 - %ashr109 = ashr i32 %shl108, 26 - %ashr110 = ashr i32 %ashr109, 1 - %115 = freeze i32 %ashr110 - %116 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl111 = shl i32 %115, 4 - %trunc112 = trunc i32 %shl111 to i8 - %117 = load i8, ptr %116, align 1 - %118 = and i8 %117, 15 - %119 = or i8 %118, %trunc112 - store i8 %119, ptr %116, align 1 - %lshrl113 = lshr i32 %115, 4 - %120 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc114 = trunc i32 %lshrl113 to i8 - %121 = and i8 %trunc114, 3 - %122 = load i8, ptr %120, align 1 - %123 = and i8 %122, -4 - %124 = or i8 %123, %121 - store i8 %123, ptr %120, align 1 - %125 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %126 = load i8, ptr %125, align 1 - %zext115 = zext i8 %126 to i32 - %lshrl116 = lshr i32 %zext115, 1 - %shl117 = shl i32 %lshrl116, 29 - %ashr118 = ashr i32 %shl117, 29 - %127 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %128 = load i8, ptr %127, align 1 - %zext119 = zext i8 %128 to i32 - %lshrl120 = lshr i32 %zext119, 4 - %129 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %130 = load i8, ptr %129, align 1 - %zext121 = zext i8 %130 to i32 - %shl122 = shl i32 %zext121, 4 - %131 = or i32 %shl122, %lshrl120 - %shl123 = shl i32 %131, 26 - %ashr124 = ashr i32 %shl123, 26 - call void (ptr, ...) @printf(ptr @.str.29, i32 %ashr118, i32 %ashr124) - %132 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %133 = load i8, ptr %132, align 1 - %zext125 = zext i8 %133 to i32 - %lshrl126 = lshr i32 %zext125, 4 - %134 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %135 = load i8, ptr %134, align 1 - %zext127 = zext i8 %135 to i32 - %shl128 = shl i32 %zext127, 4 - %136 = or i32 %shl128, %lshrl126 - %shl129 = shl i32 %136, 26 - %ashr130 = ashr i32 %shl129, 26 - %sdiv = sdiv i32 %ashr130, 2 - %137 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl131 = shl i32 %sdiv, 4 - %trunc132 = trunc i32 %shl131 to i8 - %138 = load i8, ptr %137, align 1 - %139 = and i8 %138, 15 - %140 = or i8 %139, %trunc132 - store i8 %140, ptr %137, align 1 - %lshrl133 = lshr i32 %sdiv, 4 - %141 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc134 = trunc i32 %lshrl133 to i8 - %142 = and i8 %trunc134, 3 - %143 = load i8, ptr %141, align 1 - %144 = and i8 %143, -4 - %145 = or i8 %144, %142 - store i8 %144, ptr %141, align 1 - %146 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %147 = load i8, ptr %146, align 1 - %zext135 = zext i8 %147 to i32 - %lshrl136 = lshr i32 %zext135, 1 - %shl137 = shl i32 %lshrl136, 29 - %ashr138 = ashr i32 %shl137, 29 - %148 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %149 = load i8, ptr %148, align 1 - %zext139 = zext i8 %149 to i32 - %lshrl140 = lshr i32 %zext139, 4 - %150 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %151 = load i8, ptr %150, align 1 - %zext141 = zext i8 %151 to i32 - %shl142 = shl i32 %zext141, 4 - %152 = or i32 %shl142, %lshrl140 - %shl143 = shl i32 %152, 26 - %ashr144 = ashr i32 %shl143, 26 - call void (ptr, ...) @printf(ptr @.str.30, i32 %ashr138, i32 %ashr144) - %153 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %154 = load i8, ptr %153, align 1 - %zext145 = zext i8 %154 to i32 - %lshrl146 = lshr i32 %zext145, 4 - %155 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %156 = load i8, ptr %155, align 1 - %zext147 = zext i8 %156 to i32 - %shl148 = shl i32 %zext147, 4 - %157 = or i32 %shl148, %lshrl146 - %shl149 = shl i32 %157, 26 - %ashr150 = ashr i32 %shl149, 26 - %smod = srem i32 %ashr150, 2 - %158 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %shl151 = shl i32 %smod, 4 - %trunc152 = trunc i32 %shl151 to i8 - %159 = load i8, ptr %158, align 1 - %160 = and i8 %159, 15 - %161 = or i8 %160, %trunc152 - store i8 %161, ptr %158, align 1 - %lshrl153 = lshr i32 %smod, 4 - %162 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %trunc154 = trunc i32 %lshrl153 to i8 - %163 = and i8 %trunc154, 3 - %164 = load i8, ptr %162, align 1 - %165 = and i8 %164, -4 - %166 = or i8 %165, %163 - store i8 %165, ptr %162, align 1 - %167 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %168 = load i8, ptr %167, align 1 - %zext155 = zext i8 %168 to i32 - %lshrl156 = lshr i32 %zext155, 1 - %shl157 = shl i32 %lshrl156, 29 - %ashr158 = ashr i32 %shl157, 29 - %169 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 0 - %170 = load i8, ptr %169, align 1 - %zext159 = zext i8 %170 to i32 - %lshrl160 = lshr i32 %zext159, 4 - %171 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 1 - %172 = load i8, ptr %171, align 1 - %zext161 = zext i8 %172 to i32 - %shl162 = shl i32 %zext161, 4 - %173 = or i32 %shl162, %lshrl160 - %shl163 = shl i32 %173, 26 - %ashr164 = ashr i32 %shl163, 26 - call void (ptr, ...) @printf(ptr @.str.31, i32 %ashr158, i32 %ashr164) - %174 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %175 = load i8, ptr %174, align 1 - %lshrl165 = lshr i8 %175, 5 - %176 = trunc i8 %lshrl165 to i1 - %boolsi = zext i1 %176 to i32 + %ptradd65 = getelementptr inbounds i8, ptr %xx, i64 1 + %42 = load i8, ptr %ptradd65, align 1 + %zext66 = zext i8 %42 to i32 + %shl67 = shl i32 %zext66, 4 + %43 = or i32 %shl67, %lshrl64 + %shl68 = shl i32 %43, 26 + %ashr69 = ashr i32 %shl68, 26 + call void (ptr, ...) @printf(ptr @.str.26, i32 %ashr62, i32 %ashr69) + %44 = load i8, ptr %xx, align 1 + %zext70 = zext i8 %44 to i32 + %lshrl71 = lshr i32 %zext70, 4 + %ptradd72 = getelementptr inbounds i8, ptr %xx, i64 1 + %45 = load i8, ptr %ptradd72, align 1 + %zext73 = zext i8 %45 to i32 + %shl74 = shl i32 %zext73, 4 + %46 = or i32 %shl74, %lshrl71 + %shl75 = shl i32 %46, 26 + %ashr76 = ashr i32 %shl75, 26 + %or = or i32 %ashr76, 4 + %shl77 = shl i32 %or, 4 + %trunc78 = trunc i32 %shl77 to i8 + %47 = load i8, ptr %xx, align 1 + %48 = and i8 %47, 15 + %49 = or i8 %48, %trunc78 + store i8 %49, ptr %xx, align 1 + %lshrl79 = lshr i32 %or, 4 + %ptradd80 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc81 = trunc i32 %lshrl79 to i8 + %50 = and i8 %trunc81, 3 + %51 = load i8, ptr %ptradd80, align 1 + %52 = and i8 %51, -4 + %53 = or i8 %52, %50 + store i8 %52, ptr %ptradd80, align 1 + %54 = load i8, ptr %xx, align 1 + %zext82 = zext i8 %54 to i32 + %lshrl83 = lshr i32 %zext82, 1 + %shl84 = shl i32 %lshrl83, 29 + %ashr85 = ashr i32 %shl84, 29 + %55 = load i8, ptr %xx, align 1 + %zext86 = zext i8 %55 to i32 + %lshrl87 = lshr i32 %zext86, 4 + %ptradd88 = getelementptr inbounds i8, ptr %xx, i64 1 + %56 = load i8, ptr %ptradd88, align 1 + %zext89 = zext i8 %56 to i32 + %shl90 = shl i32 %zext89, 4 + %57 = or i32 %shl90, %lshrl87 + %shl91 = shl i32 %57, 26 + %ashr92 = ashr i32 %shl91, 26 + call void (ptr, ...) @printf(ptr @.str.27, i32 %ashr85, i32 %ashr92) + %58 = load i8, ptr %xx, align 1 + %zext93 = zext i8 %58 to i32 + %lshrl94 = lshr i32 %zext93, 4 + %ptradd95 = getelementptr inbounds i8, ptr %xx, i64 1 + %59 = load i8, ptr %ptradd95, align 1 + %zext96 = zext i8 %59 to i32 + %shl97 = shl i32 %zext96, 4 + %60 = or i32 %shl97, %lshrl94 + %shl98 = shl i32 %60, 26 + %ashr99 = ashr i32 %shl98, 26 + %shl100 = shl i32 %ashr99, 1 + %61 = freeze i32 %shl100 + %shl101 = shl i32 %61, 4 + %trunc102 = trunc i32 %shl101 to i8 + %62 = load i8, ptr %xx, align 1 + %63 = and i8 %62, 15 + %64 = or i8 %63, %trunc102 + store i8 %64, ptr %xx, align 1 + %lshrl103 = lshr i32 %61, 4 + %ptradd104 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc105 = trunc i32 %lshrl103 to i8 + %65 = and i8 %trunc105, 3 + %66 = load i8, ptr %ptradd104, align 1 + %67 = and i8 %66, -4 + %68 = or i8 %67, %65 + store i8 %67, ptr %ptradd104, align 1 + %69 = load i8, ptr %xx, align 1 + %zext106 = zext i8 %69 to i32 + %lshrl107 = lshr i32 %zext106, 1 + %shl108 = shl i32 %lshrl107, 29 + %ashr109 = ashr i32 %shl108, 29 + %70 = load i8, ptr %xx, align 1 + %zext110 = zext i8 %70 to i32 + %lshrl111 = lshr i32 %zext110, 4 + %ptradd112 = getelementptr inbounds i8, ptr %xx, i64 1 + %71 = load i8, ptr %ptradd112, align 1 + %zext113 = zext i8 %71 to i32 + %shl114 = shl i32 %zext113, 4 + %72 = or i32 %shl114, %lshrl111 + %shl115 = shl i32 %72, 26 + %ashr116 = ashr i32 %shl115, 26 + call void (ptr, ...) @printf(ptr @.str.28, i32 %ashr109, i32 %ashr116) + %73 = load i8, ptr %xx, align 1 + %zext117 = zext i8 %73 to i32 + %lshrl118 = lshr i32 %zext117, 4 + %ptradd119 = getelementptr inbounds i8, ptr %xx, i64 1 + %74 = load i8, ptr %ptradd119, align 1 + %zext120 = zext i8 %74 to i32 + %shl121 = shl i32 %zext120, 4 + %75 = or i32 %shl121, %lshrl118 + %shl122 = shl i32 %75, 26 + %ashr123 = ashr i32 %shl122, 26 + %ashr124 = ashr i32 %ashr123, 1 + %76 = freeze i32 %ashr124 + %shl125 = shl i32 %76, 4 + %trunc126 = trunc i32 %shl125 to i8 + %77 = load i8, ptr %xx, align 1 + %78 = and i8 %77, 15 + %79 = or i8 %78, %trunc126 + store i8 %79, ptr %xx, align 1 + %lshrl127 = lshr i32 %76, 4 + %ptradd128 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc129 = trunc i32 %lshrl127 to i8 + %80 = and i8 %trunc129, 3 + %81 = load i8, ptr %ptradd128, align 1 + %82 = and i8 %81, -4 + %83 = or i8 %82, %80 + store i8 %82, ptr %ptradd128, align 1 + %84 = load i8, ptr %xx, align 1 + %zext130 = zext i8 %84 to i32 + %lshrl131 = lshr i32 %zext130, 1 + %shl132 = shl i32 %lshrl131, 29 + %ashr133 = ashr i32 %shl132, 29 + %85 = load i8, ptr %xx, align 1 + %zext134 = zext i8 %85 to i32 + %lshrl135 = lshr i32 %zext134, 4 + %ptradd136 = getelementptr inbounds i8, ptr %xx, i64 1 + %86 = load i8, ptr %ptradd136, align 1 + %zext137 = zext i8 %86 to i32 + %shl138 = shl i32 %zext137, 4 + %87 = or i32 %shl138, %lshrl135 + %shl139 = shl i32 %87, 26 + %ashr140 = ashr i32 %shl139, 26 + call void (ptr, ...) @printf(ptr @.str.29, i32 %ashr133, i32 %ashr140) + %88 = load i8, ptr %xx, align 1 + %zext141 = zext i8 %88 to i32 + %lshrl142 = lshr i32 %zext141, 4 + %ptradd143 = getelementptr inbounds i8, ptr %xx, i64 1 + %89 = load i8, ptr %ptradd143, align 1 + %zext144 = zext i8 %89 to i32 + %shl145 = shl i32 %zext144, 4 + %90 = or i32 %shl145, %lshrl142 + %shl146 = shl i32 %90, 26 + %ashr147 = ashr i32 %shl146, 26 + %sdiv = sdiv i32 %ashr147, 2 + %shl148 = shl i32 %sdiv, 4 + %trunc149 = trunc i32 %shl148 to i8 + %91 = load i8, ptr %xx, align 1 + %92 = and i8 %91, 15 + %93 = or i8 %92, %trunc149 + store i8 %93, ptr %xx, align 1 + %lshrl150 = lshr i32 %sdiv, 4 + %ptradd151 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc152 = trunc i32 %lshrl150 to i8 + %94 = and i8 %trunc152, 3 + %95 = load i8, ptr %ptradd151, align 1 + %96 = and i8 %95, -4 + %97 = or i8 %96, %94 + store i8 %96, ptr %ptradd151, align 1 + %98 = load i8, ptr %xx, align 1 + %zext153 = zext i8 %98 to i32 + %lshrl154 = lshr i32 %zext153, 1 + %shl155 = shl i32 %lshrl154, 29 + %ashr156 = ashr i32 %shl155, 29 + %99 = load i8, ptr %xx, align 1 + %zext157 = zext i8 %99 to i32 + %lshrl158 = lshr i32 %zext157, 4 + %ptradd159 = getelementptr inbounds i8, ptr %xx, i64 1 + %100 = load i8, ptr %ptradd159, align 1 + %zext160 = zext i8 %100 to i32 + %shl161 = shl i32 %zext160, 4 + %101 = or i32 %shl161, %lshrl158 + %shl162 = shl i32 %101, 26 + %ashr163 = ashr i32 %shl162, 26 + call void (ptr, ...) @printf(ptr @.str.30, i32 %ashr156, i32 %ashr163) + %102 = load i8, ptr %xx, align 1 + %zext164 = zext i8 %102 to i32 + %lshrl165 = lshr i32 %zext164, 4 + %ptradd166 = getelementptr inbounds i8, ptr %xx, i64 1 + %103 = load i8, ptr %ptradd166, align 1 + %zext167 = zext i8 %103 to i32 + %shl168 = shl i32 %zext167, 4 + %104 = or i32 %shl168, %lshrl165 + %shl169 = shl i32 %104, 26 + %ashr170 = ashr i32 %shl169, 26 + %smod = srem i32 %ashr170, 2 + %shl171 = shl i32 %smod, 4 + %trunc172 = trunc i32 %shl171 to i8 + %105 = load i8, ptr %xx, align 1 + %106 = and i8 %105, 15 + %107 = or i8 %106, %trunc172 + store i8 %107, ptr %xx, align 1 + %lshrl173 = lshr i32 %smod, 4 + %ptradd174 = getelementptr inbounds i8, ptr %xx, i64 1 + %trunc175 = trunc i32 %lshrl173 to i8 + %108 = and i8 %trunc175, 3 + %109 = load i8, ptr %ptradd174, align 1 + %110 = and i8 %109, -4 + %111 = or i8 %110, %108 + store i8 %110, ptr %ptradd174, align 1 + %112 = load i8, ptr %xx, align 1 + %zext176 = zext i8 %112 to i32 + %lshrl177 = lshr i32 %zext176, 1 + %shl178 = shl i32 %lshrl177, 29 + %ashr179 = ashr i32 %shl178, 29 + %113 = load i8, ptr %xx, align 1 + %zext180 = zext i8 %113 to i32 + %lshrl181 = lshr i32 %zext180, 4 + %ptradd182 = getelementptr inbounds i8, ptr %xx, i64 1 + %114 = load i8, ptr %ptradd182, align 1 + %zext183 = zext i8 %114 to i32 + %shl184 = shl i32 %zext183, 4 + %115 = or i32 %shl184, %lshrl181 + %shl185 = shl i32 %115, 26 + %ashr186 = ashr i32 %shl185, 26 + call void (ptr, ...) @printf(ptr @.str.31, i32 %ashr179, i32 %ashr186) + %ptradd187 = getelementptr inbounds i8, ptr %xx, i64 2 + %116 = load i8, ptr %ptradd187, align 1 + %lshrl188 = lshr i8 %116, 5 + %117 = trunc i8 %lshrl188 to i1 + %boolsi = zext i1 %117 to i32 call void (ptr, ...) @printf(ptr @.str.32, i32 %boolsi) - %177 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %178 = load i8, ptr %177, align 1 - %179 = and i8 %178, -33 - %180 = or i8 %179, 32 - store i8 %180, ptr %177, align 1 - %181 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %182 = load i8, ptr %181, align 1 - %lshrl166 = lshr i8 %182, 5 - %183 = trunc i8 %lshrl166 to i1 - %boolsi167 = zext i1 %183 to i32 - call void (ptr, ...) @printf(ptr @.str.33, i32 %boolsi167) - %184 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %185 = load i8, ptr %184, align 1 - %186 = and i8 %185, -33 - store i8 %186, ptr %184, align 1 - %187 = getelementptr inbounds [3 x i8], ptr %xx, i64 0, i64 2 - %188 = load i8, ptr %187, align 1 - %lshrl168 = lshr i8 %188, 5 - %189 = trunc i8 %lshrl168 to i1 - %boolsi169 = zext i1 %189 to i32 - call void (ptr, ...) @printf(ptr @.str.34, i32 %boolsi169) + %ptradd189 = getelementptr inbounds i8, ptr %xx, i64 2 + %118 = load i8, ptr %ptradd189, align 1 + %119 = and i8 %118, -33 + %120 = or i8 %119, 32 + store i8 %120, ptr %ptradd189, align 1 + %ptradd190 = getelementptr inbounds i8, ptr %xx, i64 2 + %121 = load i8, ptr %ptradd190, align 1 + %lshrl191 = lshr i8 %121, 5 + %122 = trunc i8 %lshrl191 to i1 + %boolsi192 = zext i1 %122 to i32 + call void (ptr, ...) @printf(ptr @.str.33, i32 %boolsi192) + %ptradd193 = getelementptr inbounds i8, ptr %xx, i64 2 + %123 = load i8, ptr %ptradd193, align 1 + %124 = and i8 %123, -33 + store i8 %124, ptr %ptradd193, align 1 + %ptradd194 = getelementptr inbounds i8, ptr %xx, i64 2 + %125 = load i8, ptr %ptradd194, align 1 + %lshrl195 = lshr i8 %125, 5 + %126 = trunc i8 %lshrl195 to i1 + %boolsi196 = zext i1 %126 to i32 + call void (ptr, ...) @printf(ptr @.str.34, i32 %boolsi196) ret void } diff --git a/test/test_suite/bitstruct/bitstruct_arrays_be.c3t b/test/test_suite/bitstruct/bitstruct_arrays_be.c3t index d90c3131e..5d86abd7c 100644 --- a/test/test_suite/bitstruct/bitstruct_arrays_be.c3t +++ b/test/test_suite/bitstruct/bitstruct_arrays_be.c3t @@ -44,101 +44,95 @@ entry: %abc = alloca ptr, align 8 %z = alloca ptr, align 8 store [4 x i8] c"\E0\FB\0A\00", ptr %xx, align 1 - %0 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 0 - %1 = load i8, ptr %0, align 1 - %zext = zext i8 %1 to i32 + %0 = load i8, ptr %xx, align 1 + %zext = zext i8 %0 to i32 %lshrl = lshr i32 %zext, 4 - %2 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 1 - %3 = load i8, ptr %2, align 1 - %zext1 = zext i8 %3 to i32 + %ptradd = getelementptr inbounds i8, ptr %xx, i64 1 + %1 = load i8, ptr %ptradd, align 1 + %zext1 = zext i8 %1 to i32 %shl = shl i32 %zext1, 4 - %4 = or i32 %shl, %lshrl - %5 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 2 - %6 = load i8, ptr %5, align 1 - %zext2 = zext i8 %6 to i32 - %shl3 = shl i32 %zext2, 12 - %7 = or i32 %shl3, %4 - %shl4 = shl i32 %7, 16 - %8 = call i32 @llvm.bswap.i32(i32 %shl4) - %9 = and i32 65535, %8 - call void (ptr, ...) @printf(ptr @.str, i32 %9) + %2 = or i32 %shl, %lshrl + %ptradd2 = getelementptr inbounds i8, ptr %xx, i64 2 + %3 = load i8, ptr %ptradd2, align 1 + %zext3 = zext i8 %3 to i32 + %shl4 = shl i32 %zext3, 12 + %4 = or i32 %shl4, %2 + %shl5 = shl i32 %4, 16 + %5 = call i32 @llvm.bswap.i32(i32 %shl5) + %6 = and i32 65535, %5 + call void (ptr, ...) @printf(ptr @.str, i32 %6) store [4 x i8] c"\F0\EA\0B\00", ptr %xy, align 1 store ptr %xy, ptr %abc, align 8 - %10 = load ptr, ptr %abc, align 8 - store ptr %10, ptr %z, align 8 - %11 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 0 - %12 = load i8, ptr %11, align 1 - %zext5 = zext i8 %12 to i32 - %lshrl6 = lshr i32 %zext5, 4 - %13 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 1 - %14 = load i8, ptr %13, align 1 - %zext7 = zext i8 %14 to i32 - %shl8 = shl i32 %zext7, 4 - %15 = or i32 %shl8, %lshrl6 - %16 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 2 - %17 = load i8, ptr %16, align 1 - %zext9 = zext i8 %17 to i32 - %shl10 = shl i32 %zext9, 12 - %18 = or i32 %shl10, %15 - %19 = and i32 65535, %18 - call void (ptr, ...) @printf(ptr @.str.1, i32 %19) - %20 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 0 - %21 = load i8, ptr %20, align 1 - %22 = and i8 %21, 15 - %23 = or i8 %22, -16 - store i8 %23, ptr %20, align 1 - %24 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 1 - store i8 -18, ptr %24, align 1 - %25 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 2 - %26 = load i8, ptr %25, align 1 - %27 = and i8 %26, -16 - %28 = or i8 %27, 11 - store i8 %27, ptr %25, align 1 - %29 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 0 - %30 = load i8, ptr %29, align 1 - %zext11 = zext i8 %30 to i32 - %lshrl12 = lshr i32 %zext11, 4 - %31 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 1 - %32 = load i8, ptr %31, align 1 - %zext13 = zext i8 %32 to i32 - %shl14 = shl i32 %zext13, 4 - %33 = or i32 %shl14, %lshrl12 - %34 = getelementptr inbounds [4 x i8], ptr %xy, i64 0, i64 2 - %35 = load i8, ptr %34, align 1 - %zext15 = zext i8 %35 to i32 - %shl16 = shl i32 %zext15, 12 - %36 = or i32 %shl16, %33 - %37 = and i32 65535, %36 - call void (ptr, ...) @printf(ptr @.str.2, i32 %37) - %38 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 0 - %39 = load i8, ptr %38, align 1 - %40 = and i8 %39, 15 - %41 = or i8 %40, -32 - store i8 %41, ptr %38, align 1 - %42 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 1 - store i8 -5, ptr %42, align 1 - %43 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 2 - %44 = load i8, ptr %43, align 1 - %45 = and i8 %44, -16 - %46 = or i8 %45, 14 - store i8 %45, ptr %43, align 1 - %47 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 0 - %48 = load i8, ptr %47, align 1 - %zext17 = zext i8 %48 to i32 - %lshrl18 = lshr i32 %zext17, 4 - %49 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 1 - %50 = load i8, ptr %49, align 1 - %zext19 = zext i8 %50 to i32 + %7 = load ptr, ptr %abc, align 8 + store ptr %7, ptr %z, align 8 + %8 = load i8, ptr %xy, align 1 + %zext6 = zext i8 %8 to i32 + %lshrl7 = lshr i32 %zext6, 4 + %ptradd8 = getelementptr inbounds i8, ptr %xy, i64 1 + %9 = load i8, ptr %ptradd8, align 1 + %zext9 = zext i8 %9 to i32 + %shl10 = shl i32 %zext9, 4 + %10 = or i32 %shl10, %lshrl7 + %ptradd11 = getelementptr inbounds i8, ptr %xy, i64 2 + %11 = load i8, ptr %ptradd11, align 1 + %zext12 = zext i8 %11 to i32 + %shl13 = shl i32 %zext12, 12 + %12 = or i32 %shl13, %10 + %13 = and i32 65535, %12 + call void (ptr, ...) @printf(ptr @.str.1, i32 %13) + %14 = load i8, ptr %xy, align 1 + %15 = and i8 %14, 15 + %16 = or i8 %15, -16 + store i8 %16, ptr %xy, align 1 + %ptradd14 = getelementptr inbounds i8, ptr %xy, i64 1 + store i8 -18, ptr %ptradd14, align 1 + %ptradd15 = getelementptr inbounds i8, ptr %xy, i64 2 + %17 = load i8, ptr %ptradd15, align 1 + %18 = and i8 %17, -16 + %19 = or i8 %18, 11 + store i8 %18, ptr %ptradd15, align 1 + %20 = load i8, ptr %xy, align 1 + %zext16 = zext i8 %20 to i32 + %lshrl17 = lshr i32 %zext16, 4 + %ptradd18 = getelementptr inbounds i8, ptr %xy, i64 1 + %21 = load i8, ptr %ptradd18, align 1 + %zext19 = zext i8 %21 to i32 %shl20 = shl i32 %zext19, 4 - %51 = or i32 %shl20, %lshrl18 - %52 = getelementptr inbounds [4 x i8], ptr %xx, i64 0, i64 2 - %53 = load i8, ptr %52, align 1 - %zext21 = zext i8 %53 to i32 - %shl22 = shl i32 %zext21, 12 - %54 = or i32 %shl22, %51 - %shl23 = shl i32 %54, 16 - %55 = call i32 @llvm.bswap.i32(i32 %shl23) - %56 = and i32 65535, %55 - call void (ptr, ...) @printf(ptr @.str.3, i32 %56) + %22 = or i32 %shl20, %lshrl17 + %ptradd21 = getelementptr inbounds i8, ptr %xy, i64 2 + %23 = load i8, ptr %ptradd21, align 1 + %zext22 = zext i8 %23 to i32 + %shl23 = shl i32 %zext22, 12 + %24 = or i32 %shl23, %22 + %25 = and i32 65535, %24 + call void (ptr, ...) @printf(ptr @.str.2, i32 %25) + %26 = load i8, ptr %xx, align 1 + %27 = and i8 %26, 15 + %28 = or i8 %27, -32 + store i8 %28, ptr %xx, align 1 + %ptradd24 = getelementptr inbounds i8, ptr %xx, i64 1 + store i8 -5, ptr %ptradd24, align 1 + %ptradd25 = getelementptr inbounds i8, ptr %xx, i64 2 + %29 = load i8, ptr %ptradd25, align 1 + %30 = and i8 %29, -16 + %31 = or i8 %30, 14 + store i8 %30, ptr %ptradd25, align 1 + %32 = load i8, ptr %xx, align 1 + %zext26 = zext i8 %32 to i32 + %lshrl27 = lshr i32 %zext26, 4 + %ptradd28 = getelementptr inbounds i8, ptr %xx, i64 1 + %33 = load i8, ptr %ptradd28, align 1 + %zext29 = zext i8 %33 to i32 + %shl30 = shl i32 %zext29, 4 + %34 = or i32 %shl30, %lshrl27 + %ptradd31 = getelementptr inbounds i8, ptr %xx, i64 2 + %35 = load i8, ptr %ptradd31, align 1 + %zext32 = zext i8 %35 to i32 + %shl33 = shl i32 %zext32, 12 + %36 = or i32 %shl33, %34 + %shl34 = shl i32 %36, 16 + %37 = call i32 @llvm.bswap.i32(i32 %shl34) + %38 = and i32 65535, %37 + call void (ptr, ...) @printf(ptr @.str.3, i32 %38) ret void } \ No newline at end of file diff --git a/test/test_suite/bitstruct/bitstruct_be.c3t b/test/test_suite/bitstruct/bitstruct_be.c3t index 8ee0d4298..59239be2f 100644 --- a/test/test_suite/bitstruct/bitstruct_be.c3t +++ b/test/test_suite/bitstruct/bitstruct_be.c3t @@ -48,55 +48,53 @@ fn void main() store i32 2063597568, ptr %x, align 4 %2 = insertvalue %"any*" undef, ptr %x, 0 %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %4 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %3, ptr %4, align 16 - %5 = load i32, ptr %x, align 4 - %6 = call i32 @llvm.bswap.i32(i32 %5) - store i32 %6, ptr %taddr, align 4 - %7 = insertvalue %"any*" undef, ptr %taddr, 0 - %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %9 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %8, ptr %9, align 16 - %10 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 18, ptr %varargslots, i64 2) + store %"any*" %3, ptr %varargslots, align 16 + %4 = load i32, ptr %x, align 4 + %5 = call i32 @llvm.bswap.i32(i32 %4) + store i32 %5, ptr %taddr, align 4 + %6 = insertvalue %"any*" undef, ptr %taddr, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %7, ptr %ptradd, align 16 + %8 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 18, ptr %varargslots, i64 2) store i32 873625686, ptr %abc, align 4 store [4 x i8] c"\124Vx", ptr %abc2, align 1 store ptr %abc, ptr %z, align 8 store ptr %abc2, ptr %z2, align 8 - %11 = load ptr, ptr %z2, align 8 - store ptr %11, ptr %.anon, align 8 + %9 = load ptr, ptr %z2, align 8 + store ptr %9, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %12 = load i64, ptr %.anon1, align 8 - %gt = icmp ugt i64 4, %12 + %10 = load i64, ptr %.anon1, align 8 + %gt = icmp ugt i64 4, %10 br i1 %gt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %13 = load ptr, ptr %.anon, align 8 - %14 = load i64, ptr %.anon1, align 8 - %15 = getelementptr inbounds [4 x i8], ptr %13, i64 0, i64 %14 - %16 = load i8, ptr %15, align 1 - store i8 %16, ptr %d, align 1 - %17 = insertvalue %"any*" undef, ptr %d, 0 - %18 = insertvalue %"any*" %17, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - %19 = getelementptr inbounds [1 x %"any*"], ptr %varargslots2, i64 0, i64 0 - store %"any*" %18, ptr %19, align 16 - %20 = call i64 @std.io.printf(ptr %retparam3, ptr @.str.1, i64 3, ptr %varargslots2, i64 1) - %21 = load i64, ptr %.anon1, align 8 - %add = add i64 %21, 1 + %11 = load ptr, ptr %.anon, align 8 + %12 = load i64, ptr %.anon1, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %11, i64 %12 + %13 = load i8, ptr %ptradd2, align 1 + store i8 %13, ptr %d, align 1 + %14 = insertvalue %"any*" undef, ptr %d, 0 + %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.char" to i64), 1 + store %"any*" %15, ptr %varargslots3, align 16 + %16 = call i64 @std.io.printf(ptr %retparam4, ptr @.str.1, i64 3, ptr %varargslots3, i64 1) + %17 = load i64, ptr %.anon1, align 8 + %add = add i64 %17, 1 store i64 %add, ptr %.anon1, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond - %22 = call ptr @std.io.stdout() - %23 = call i64 @std.io.File.write(ptr %retparam5, ptr %22, ptr null, i64 0) - %not_err = icmp eq i64 %23, 0 - %24 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %24, label %after_check, label %assign_optional + %18 = call ptr @std.io.stdout() + %19 = call i64 @std.io.File.write(ptr %retparam6, ptr %18, ptr null, i64 0) + %not_err = icmp eq i64 %19, 0 + %20 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %20, label %after_check, label %assign_optional assign_optional: ; preds = %loop.exit - store i64 %23, ptr %error_var, align 8 + store i64 %19, ptr %error_var, align 8 br label %guard_block after_check: ; preds = %loop.exit @@ -106,256 +104,251 @@ guard_block: ; preds = %assign_optional br label %voiderr noerr_block: ; preds = %after_check - %25 = load i64, ptr %retparam5, align 8 - store i64 %25, ptr %len, align 8 - %26 = call i64 @std.io.File.write_byte(ptr %22, i8 zeroext 10) - %not_err7 = icmp eq i64 %26, 0 - %27 = call i1 @llvm.expect.i1(i1 %not_err7, i1 true) - br i1 %27, label %after_check9, label %assign_optional8 + %21 = load i64, ptr %retparam6, align 8 + store i64 %21, ptr %len, align 8 + %22 = call i64 @std.io.File.write_byte(ptr %18, i8 zeroext 10) + %not_err8 = icmp eq i64 %22, 0 + %23 = call i1 @llvm.expect.i1(i1 %not_err8, i1 true) + br i1 %23, label %after_check10, label %assign_optional9 -assign_optional8: ; preds = %noerr_block - store i64 %26, ptr %error_var6, align 8 - br label %guard_block10 +assign_optional9: ; preds = %noerr_block + store i64 %22, ptr %error_var7, align 8 + br label %guard_block11 -after_check9: ; preds = %noerr_block - br label %noerr_block11 +after_check10: ; preds = %noerr_block + br label %noerr_block12 -guard_block10: ; preds = %assign_optional8 +guard_block11: ; preds = %assign_optional9 br label %voiderr -noerr_block11: ; preds = %after_check9 - %28 = call i64 @std.io.File.flush(ptr %22) - %not_err13 = icmp eq i64 %28, 0 - %29 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) - br i1 %29, label %after_check15, label %assign_optional14 +noerr_block12: ; preds = %after_check10 + %24 = call i64 @std.io.File.flush(ptr %18) + %not_err14 = icmp eq i64 %24, 0 + %25 = call i1 @llvm.expect.i1(i1 %not_err14, i1 true) + br i1 %25, label %after_check16, label %assign_optional15 -assign_optional14: ; preds = %noerr_block11 - store i64 %28, ptr %error_var12, align 8 - br label %guard_block16 +assign_optional15: ; preds = %noerr_block12 + store i64 %24, ptr %error_var13, align 8 + br label %guard_block17 -after_check15: ; preds = %noerr_block11 - br label %noerr_block17 +after_check16: ; preds = %noerr_block12 + br label %noerr_block18 -guard_block16: ; preds = %assign_optional14 +guard_block17: ; preds = %assign_optional15 br label %voiderr -noerr_block17: ; preds = %after_check15 - %30 = load i64, ptr %len, align 8 - %add18 = add i64 %30, 1 +noerr_block18: ; preds = %after_check16 + %26 = load i64, ptr %len, align 8 + %add19 = add i64 %26, 1 br label %voiderr -voiderr: ; preds = %noerr_block17, %guard_block16, %guard_block10, %guard_block - %31 = load ptr, ptr %z, align 8 - store ptr %31, ptr %.anon19, align 8 - store i64 0, ptr %.anon20, align 8 - br label %loop.cond21 - -loop.cond21: ; preds = %loop.body23, %voiderr - %32 = load i64, ptr %.anon20, align 8 - %gt22 = icmp ugt i64 4, %32 - br i1 %gt22, label %loop.body23, label %loop.exit30 - -loop.body23: ; preds = %loop.cond21 - %33 = load ptr, ptr %.anon19, align 8 - %34 = load i64, ptr %.anon20, align 8 - %35 = getelementptr inbounds [4 x i8], ptr %33, i64 0, i64 %34 - %36 = load i8, ptr %35, align 1 - store i8 %36, ptr %d24, align 1 - %37 = insertvalue %"any*" undef, ptr %d24, 0 - %38 = insertvalue %"any*" %37, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - %39 = getelementptr inbounds [1 x %"any*"], ptr %varargslots25, i64 0, i64 0 - store %"any*" %38, ptr %39, align 16 - %40 = call i64 @std.io.printf(ptr %retparam26, ptr @.str.2, i64 3, ptr %varargslots25, i64 1) - %41 = load i64, ptr %.anon20, align 8 - %add29 = add i64 %41, 1 - store i64 %add29, ptr %.anon20, align 8 - br label %loop.cond21 - -loop.exit30: ; preds = %loop.cond21 - %42 = call ptr @std.io.stdout() - %43 = call i64 @std.io.File.write(ptr %retparam34, ptr %42, ptr null, i64 0) - %not_err35 = icmp eq i64 %43, 0 - %44 = call i1 @llvm.expect.i1(i1 %not_err35, i1 true) - br i1 %44, label %after_check37, label %assign_optional36 - -assign_optional36: ; preds = %loop.exit30 - store i64 %43, ptr %error_var32, align 8 - br label %guard_block38 - -after_check37: ; preds = %loop.exit30 - br label %noerr_block39 - -guard_block38: ; preds = %assign_optional36 - br label %voiderr53 - -noerr_block39: ; preds = %after_check37 - %45 = load i64, ptr %retparam34, align 8 - store i64 %45, ptr %len31, align 8 - %46 = call i64 @std.io.File.write_byte(ptr %42, i8 zeroext 10) - %not_err41 = icmp eq i64 %46, 0 - %47 = call i1 @llvm.expect.i1(i1 %not_err41, i1 true) - br i1 %47, label %after_check43, label %assign_optional42 - -assign_optional42: ; preds = %noerr_block39 - store i64 %46, ptr %error_var40, align 8 - br label %guard_block44 - -after_check43: ; preds = %noerr_block39 - br label %noerr_block45 - -guard_block44: ; preds = %assign_optional42 - br label %voiderr53 - -noerr_block45: ; preds = %after_check43 - %48 = call i64 @std.io.File.flush(ptr %42) - %not_err47 = icmp eq i64 %48, 0 - %49 = call i1 @llvm.expect.i1(i1 %not_err47, i1 true) - br i1 %49, label %after_check49, label %assign_optional48 - -assign_optional48: ; preds = %noerr_block45 - store i64 %48, ptr %error_var46, align 8 - br label %guard_block50 - -after_check49: ; preds = %noerr_block45 - br label %noerr_block51 - -guard_block50: ; preds = %assign_optional48 - br label %voiderr53 - -noerr_block51: ; preds = %after_check49 - %50 = load i64, ptr %len31, align 8 - %add52 = add i64 %50, 1 - br label %voiderr53 - -voiderr53: ; preds = %noerr_block51, %guard_block50, %guard_block44, %guard_block38 +voiderr: ; preds = %noerr_block18, %guard_block17, %guard_block11, %guard_block + %27 = load ptr, ptr %z, align 8 + store ptr %27, ptr %.anon20, align 8 + store i64 0, ptr %.anon21, align 8 + br label %loop.cond22 + +loop.cond22: ; preds = %loop.body24, %voiderr + %28 = load i64, ptr %.anon21, align 8 + %gt23 = icmp ugt i64 4, %28 + br i1 %gt23, label %loop.body24, label %loop.exit32 + +loop.body24: ; preds = %loop.cond22 + %29 = load ptr, ptr %.anon20, align 8 + %30 = load i64, ptr %.anon21, align 8 + %ptradd26 = getelementptr inbounds i8, ptr %29, i64 %30 + %31 = load i8, ptr %ptradd26, align 1 + store i8 %31, ptr %d25, align 1 + %32 = insertvalue %"any*" undef, ptr %d25, 0 + %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.char" to i64), 1 + store %"any*" %33, ptr %varargslots27, align 16 + %34 = call i64 @std.io.printf(ptr %retparam28, ptr @.str.2, i64 3, ptr %varargslots27, i64 1) + %35 = load i64, ptr %.anon21, align 8 + %add31 = add i64 %35, 1 + store i64 %add31, ptr %.anon21, align 8 + br label %loop.cond22 + +loop.exit32: ; preds = %loop.cond22 + %36 = call ptr @std.io.stdout() + %37 = call i64 @std.io.File.write(ptr %retparam36, ptr %36, ptr null, i64 0) + %not_err37 = icmp eq i64 %37, 0 + %38 = call i1 @llvm.expect.i1(i1 %not_err37, i1 true) + br i1 %38, label %after_check39, label %assign_optional38 + +assign_optional38: ; preds = %loop.exit32 + store i64 %37, ptr %error_var34, align 8 + br label %guard_block40 + +after_check39: ; preds = %loop.exit32 + br label %noerr_block41 + +guard_block40: ; preds = %assign_optional38 + br label %voiderr55 + +noerr_block41: ; preds = %after_check39 + %39 = load i64, ptr %retparam36, align 8 + store i64 %39, ptr %len33, align 8 + %40 = call i64 @std.io.File.write_byte(ptr %36, i8 zeroext 10) + %not_err43 = icmp eq i64 %40, 0 + %41 = call i1 @llvm.expect.i1(i1 %not_err43, i1 true) + br i1 %41, label %after_check45, label %assign_optional44 + +assign_optional44: ; preds = %noerr_block41 + store i64 %40, ptr %error_var42, align 8 + br label %guard_block46 + +after_check45: ; preds = %noerr_block41 + br label %noerr_block47 + +guard_block46: ; preds = %assign_optional44 + br label %voiderr55 + +noerr_block47: ; preds = %after_check45 + %42 = call i64 @std.io.File.flush(ptr %36) + %not_err49 = icmp eq i64 %42, 0 + %43 = call i1 @llvm.expect.i1(i1 %not_err49, i1 true) + br i1 %43, label %after_check51, label %assign_optional50 + +assign_optional50: ; preds = %noerr_block47 + store i64 %42, ptr %error_var48, align 8 + br label %guard_block52 + +after_check51: ; preds = %noerr_block47 + br label %noerr_block53 + +guard_block52: ; preds = %assign_optional50 + br label %voiderr55 + +noerr_block53: ; preds = %after_check51 + %44 = load i64, ptr %len33, align 8 + %add54 = add i64 %44, 1 + br label %voiderr55 + +voiderr55: ; preds = %noerr_block53, %guard_block52, %guard_block46, %guard_block40 + %45 = load i32, ptr %abc, align 4 + %46 = call i32 @llvm.bswap.i32(i32 %45) + %47 = and i32 65535, %46 + %trunc = trunc i32 %47 to i16 + store i16 %trunc, ptr %taddr57, align 2 + %48 = insertvalue %"any*" undef, ptr %taddr57, 0 + %49 = insertvalue %"any*" %48, i64 ptrtoint (ptr @"$ct.ushort" to i64), 1 + store %"any*" %49, ptr %varargslots56, align 16 + %50 = call i64 @std.io.printfn(ptr %retparam58, ptr @.str.3, i64 10, ptr %varargslots56, i64 1) %51 = load i32, ptr %abc, align 4 %52 = call i32 @llvm.bswap.i32(i32 %51) - %53 = and i32 65535, %52 - %trunc = trunc i32 %53 to i16 - store i16 %trunc, ptr %taddr55, align 2 - %54 = insertvalue %"any*" undef, ptr %taddr55, 0 - %55 = insertvalue %"any*" %54, i64 ptrtoint (ptr @"$ct.ushort" to i64), 1 - %56 = getelementptr inbounds [1 x %"any*"], ptr %varargslots54, i64 0, i64 0 - store %"any*" %55, ptr %56, align 16 - %57 = call i64 @std.io.printfn(ptr %retparam56, ptr @.str.3, i64 10, ptr %varargslots54, i64 1) - %58 = load i32, ptr %abc, align 4 - %59 = call i32 @llvm.bswap.i32(i32 %58) - %60 = and i32 %59, -65536 - %61 = or i32 %60, 4660 + %53 = and i32 %52, -65536 + %54 = or i32 %53, 4660 + %55 = call i32 @llvm.bswap.i32(i32 %54) + store i32 %55, ptr %abc, align 4 + %56 = load i32, ptr %abc, align 4 + %57 = call i32 @llvm.bswap.i32(i32 %56) + %58 = and i32 %57, 65535 + %59 = or i32 %58, 1450704896 + %60 = call i32 @llvm.bswap.i32(i32 %59) + store i32 %60, ptr %abc, align 4 + %61 = load i32, ptr %abc, align 4 %62 = call i32 @llvm.bswap.i32(i32 %61) - store i32 %62, ptr %abc, align 4 - %63 = load i32, ptr %abc, align 4 - %64 = call i32 @llvm.bswap.i32(i32 %63) - %65 = and i32 %64, 65535 - %66 = or i32 %65, 1450704896 - %67 = call i32 @llvm.bswap.i32(i32 %66) - store i32 %67, ptr %abc, align 4 - %68 = load i32, ptr %abc, align 4 - %69 = call i32 @llvm.bswap.i32(i32 %68) - %70 = and i32 65535, %69 - %trunc60 = trunc i32 %70 to i16 - store i16 %trunc60, ptr %taddr61, align 2 - %71 = insertvalue %"any*" undef, ptr %taddr61, 0 - %72 = insertvalue %"any*" %71, i64 ptrtoint (ptr @"$ct.ushort" to i64), 1 - %73 = getelementptr inbounds [1 x %"any*"], ptr %varargslots59, i64 0, i64 0 - store %"any*" %72, ptr %73, align 16 - %74 = call i64 @std.io.printfn(ptr %retparam62, ptr @.str.4, i64 12, ptr %varargslots59, i64 1) - %75 = load ptr, ptr %z, align 8 - store ptr %75, ptr %.anon65, align 8 - store i64 0, ptr %.anon66, align 8 - br label %loop.cond67 - -loop.cond67: ; preds = %loop.body69, %voiderr53 - %76 = load i64, ptr %.anon66, align 8 - %gt68 = icmp ugt i64 4, %76 - br i1 %gt68, label %loop.body69, label %loop.exit76 - -loop.body69: ; preds = %loop.cond67 - %77 = load ptr, ptr %.anon65, align 8 - %78 = load i64, ptr %.anon66, align 8 - %79 = getelementptr inbounds [4 x i8], ptr %77, i64 0, i64 %78 - %80 = load i8, ptr %79, align 1 - store i8 %80, ptr %d70, align 1 - %81 = insertvalue %"any*" undef, ptr %d70, 0 - %82 = insertvalue %"any*" %81, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - %83 = getelementptr inbounds [1 x %"any*"], ptr %varargslots71, i64 0, i64 0 - store %"any*" %82, ptr %83, align 16 - %84 = call i64 @std.io.printf(ptr %retparam72, ptr @.str.5, i64 3, ptr %varargslots71, i64 1) - %85 = load i64, ptr %.anon66, align 8 - %add75 = add i64 %85, 1 - store i64 %add75, ptr %.anon66, align 8 - br label %loop.cond67 - -loop.exit76: ; preds = %loop.cond67 - %86 = call ptr @std.io.stdout() - %87 = call i64 @std.io.File.write(ptr %retparam80, ptr %86, ptr null, i64 0) - %not_err81 = icmp eq i64 %87, 0 - %88 = call i1 @llvm.expect.i1(i1 %not_err81, i1 true) - br i1 %88, label %after_check83, label %assign_optional82 - -assign_optional82: ; preds = %loop.exit76 - store i64 %87, ptr %error_var78, align 8 - br label %guard_block84 - -after_check83: ; preds = %loop.exit76 - br label %noerr_block85 - -guard_block84: ; preds = %assign_optional82 - br label %voiderr99 - -noerr_block85: ; preds = %after_check83 - %89 = load i64, ptr %retparam80, align 8 - store i64 %89, ptr %len77, align 8 - %90 = call i64 @std.io.File.write_byte(ptr %86, i8 zeroext 10) - %not_err87 = icmp eq i64 %90, 0 - %91 = call i1 @llvm.expect.i1(i1 %not_err87, i1 true) - br i1 %91, label %after_check89, label %assign_optional88 - -assign_optional88: ; preds = %noerr_block85 - store i64 %90, ptr %error_var86, align 8 - br label %guard_block90 - -after_check89: ; preds = %noerr_block85 - br label %noerr_block91 - -guard_block90: ; preds = %assign_optional88 - br label %voiderr99 - -noerr_block91: ; preds = %after_check89 - %92 = call i64 @std.io.File.flush(ptr %86) - %not_err93 = icmp eq i64 %92, 0 - %93 = call i1 @llvm.expect.i1(i1 %not_err93, i1 true) - br i1 %93, label %after_check95, label %assign_optional94 - -assign_optional94: ; preds = %noerr_block91 - store i64 %92, ptr %error_var92, align 8 - br label %guard_block96 - -after_check95: ; preds = %noerr_block91 - br label %noerr_block97 - -guard_block96: ; preds = %assign_optional94 - br label %voiderr99 - -noerr_block97: ; preds = %after_check95 - %94 = load i64, ptr %len77, align 8 - %add98 = add i64 %94, 1 - br label %voiderr99 - -voiderr99: ; preds = %noerr_block97, %guard_block96, %guard_block90, %guard_block84 + %63 = and i32 65535, %62 + %trunc62 = trunc i32 %63 to i16 + store i16 %trunc62, ptr %taddr63, align 2 + %64 = insertvalue %"any*" undef, ptr %taddr63, 0 + %65 = insertvalue %"any*" %64, i64 ptrtoint (ptr @"$ct.ushort" to i64), 1 + store %"any*" %65, ptr %varargslots61, align 16 + %66 = call i64 @std.io.printfn(ptr %retparam64, ptr @.str.4, i64 12, ptr %varargslots61, i64 1) + %67 = load ptr, ptr %z, align 8 + store ptr %67, ptr %.anon67, align 8 + store i64 0, ptr %.anon68, align 8 + br label %loop.cond69 + +loop.cond69: ; preds = %loop.body71, %voiderr55 + %68 = load i64, ptr %.anon68, align 8 + %gt70 = icmp ugt i64 4, %68 + br i1 %gt70, label %loop.body71, label %loop.exit79 + +loop.body71: ; preds = %loop.cond69 + %69 = load ptr, ptr %.anon67, align 8 + %70 = load i64, ptr %.anon68, align 8 + %ptradd73 = getelementptr inbounds i8, ptr %69, i64 %70 + %71 = load i8, ptr %ptradd73, align 1 + store i8 %71, ptr %d72, align 1 + %72 = insertvalue %"any*" undef, ptr %d72, 0 + %73 = insertvalue %"any*" %72, i64 ptrtoint (ptr @"$ct.char" to i64), 1 + store %"any*" %73, ptr %varargslots74, align 16 + %74 = call i64 @std.io.printf(ptr %retparam75, ptr @.str.5, i64 3, ptr %varargslots74, i64 1) + %75 = load i64, ptr %.anon68, align 8 + %add78 = add i64 %75, 1 + store i64 %add78, ptr %.anon68, align 8 + br label %loop.cond69 + +loop.exit79: ; preds = %loop.cond69 + %76 = call ptr @std.io.stdout() + %77 = call i64 @std.io.File.write(ptr %retparam83, ptr %76, ptr null, i64 0) + %not_err84 = icmp eq i64 %77, 0 + %78 = call i1 @llvm.expect.i1(i1 %not_err84, i1 true) + br i1 %78, label %after_check86, label %assign_optional85 + +assign_optional85: ; preds = %loop.exit79 + store i64 %77, ptr %error_var81, align 8 + br label %guard_block87 + +after_check86: ; preds = %loop.exit79 + br label %noerr_block88 + +guard_block87: ; preds = %assign_optional85 + br label %voiderr102 + +noerr_block88: ; preds = %after_check86 + %79 = load i64, ptr %retparam83, align 8 + store i64 %79, ptr %len80, align 8 + %80 = call i64 @std.io.File.write_byte(ptr %76, i8 zeroext 10) + %not_err90 = icmp eq i64 %80, 0 + %81 = call i1 @llvm.expect.i1(i1 %not_err90, i1 true) + br i1 %81, label %after_check92, label %assign_optional91 + +assign_optional91: ; preds = %noerr_block88 + store i64 %80, ptr %error_var89, align 8 + br label %guard_block93 + +after_check92: ; preds = %noerr_block88 + br label %noerr_block94 + +guard_block93: ; preds = %assign_optional91 + br label %voiderr102 + +noerr_block94: ; preds = %after_check92 + %82 = call i64 @std.io.File.flush(ptr %76) + %not_err96 = icmp eq i64 %82, 0 + %83 = call i1 @llvm.expect.i1(i1 %not_err96, i1 true) + br i1 %83, label %after_check98, label %assign_optional97 + +assign_optional97: ; preds = %noerr_block94 + store i64 %82, ptr %error_var95, align 8 + br label %guard_block99 + +after_check98: ; preds = %noerr_block94 + br label %noerr_block100 + +guard_block99: ; preds = %assign_optional97 + br label %voiderr102 + +noerr_block100: ; preds = %after_check98 + %84 = load i64, ptr %len80, align 8 + %add101 = add i64 %84, 1 + br label %voiderr102 + +voiderr102: ; preds = %noerr_block100, %guard_block99, %guard_block93, %guard_block87 store i32 0, ptr %y, align 4 - %95 = load i32, ptr %y, align 4 + %85 = load i32, ptr %y, align 4 store i32 123, ptr %y, align 4 - %96 = insertvalue %"any*" undef, ptr %y, 0 - %97 = insertvalue %"any*" %96, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %98 = getelementptr inbounds [2 x %"any*"], ptr %varargslots100, i64 0, i64 0 - store %"any*" %97, ptr %98, align 16 - %99 = load i32, ptr %y, align 4 - store i32 %99, ptr %taddr101, align 4 - %100 = insertvalue %"any*" undef, ptr %taddr101, 0 - %101 = insertvalue %"any*" %100, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %102 = getelementptr inbounds [2 x %"any*"], ptr %varargslots100, i64 0, i64 1 - store %"any*" %101, ptr %102, align 16 - %103 = call i64 @std.io.printf(ptr %retparam102, ptr @.str.6, i64 18, ptr %varargslots100, i64 2) + %86 = insertvalue %"any*" undef, ptr %y, 0 + %87 = insertvalue %"any*" %86, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %87, ptr %varargslots103, align 16 + %88 = load i32, ptr %y, align 4 + store i32 %88, ptr %taddr104, align 4 + %89 = insertvalue %"any*" undef, ptr %taddr104, 0 + %90 = insertvalue %"any*" %89, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd105 = getelementptr inbounds i8, ptr %varargslots103, i64 16 + store %"any*" %90, ptr %ptradd105, align 16 + %91 = call i64 @std.io.printf(ptr %retparam106, ptr @.str.6, i64 18, ptr %varargslots103, i64 2) ret void } \ No newline at end of file diff --git a/test/test_suite/bitstruct/bitstruct_initializer.c3t b/test/test_suite/bitstruct/bitstruct_initializer.c3t index 6fba6ed6a..21b1d6b35 100644 --- a/test/test_suite/bitstruct/bitstruct_initializer.c3t +++ b/test/test_suite/bitstruct/bitstruct_initializer.c3t @@ -56,34 +56,34 @@ entry: %b = alloca [8 x i8], align 1 %varargslots = alloca [3 x %"any*"], align 16 %taddr = alloca i32, align 4 - %taddr13 = alloca i32, align 4 - %taddr16 = alloca i8, align 1 + %taddr30 = alloca i32, align 4 + %taddr34 = alloca i8, align 1 %retparam = alloca i64, align 8 - %varargslots17 = alloca [3 x %"any*"], align 16 - %taddr19 = alloca i32, align 4 - %taddr22 = alloca i32, align 4 - %taddr25 = alloca i8, align 1 - %retparam26 = alloca i64, align 8 - %varargslots27 = alloca [3 x %"any*"], align 16 - %taddr35 = alloca i32, align 4 + %varargslots36 = alloca [3 x %"any*"], align 16 + %taddr39 = alloca i32, align 4 %taddr43 = alloca i32, align 4 - %taddr45 = alloca i8, align 1 - %retparam46 = alloca i64, align 8 - %varargslots61 = alloca [3 x %"any*"], align 16 - %taddr63 = alloca i32, align 4 - %taddr66 = alloca i32, align 4 - %taddr69 = alloca i8, align 1 - %retparam70 = alloca i64, align 8 - %varargslots71 = alloca [3 x %"any*"], align 16 - %taddr73 = alloca i32, align 4 - %taddr76 = alloca i32, align 4 - %taddr79 = alloca i8, align 1 + %taddr48 = alloca i8, align 1 + %retparam50 = alloca i64, align 8 + %varargslots51 = alloca [3 x %"any*"], align 16 + %taddr62 = alloca i32, align 4 + %taddr74 = alloca i32, align 4 + %taddr78 = alloca i8, align 1 %retparam80 = alloca i64, align 8 - %varargslots81 = alloca [3 x %"any*"], align 16 - %taddr89 = alloca i32, align 4 - %taddr97 = alloca i32, align 4 - %taddr99 = alloca i8, align 1 - %retparam100 = alloca i64, align 8 + %varargslots111 = alloca [3 x %"any*"], align 16 + %taddr113 = alloca i32, align 4 + %taddr116 = alloca i32, align 4 + %taddr120 = alloca i8, align 1 + %retparam122 = alloca i64, align 8 + %varargslots123 = alloca [3 x %"any*"], align 16 + %taddr126 = alloca i32, align 4 + %taddr130 = alloca i32, align 4 + %taddr135 = alloca i8, align 1 + %retparam137 = alloca i64, align 8 + %varargslots138 = alloca [3 x %"any*"], align 16 + %taddr149 = alloca i32, align 4 + %taddr161 = alloca i32, align 4 + %taddr165 = alloca i8, align 1 + %retparam167 = alloca i64, align 8 store i64 0, ptr %x, align 8 %zext = zext i32 %0 to i64 %1 = and i64 %zext, 4294967295 @@ -97,362 +97,349 @@ entry: store i64 %5, ptr %x, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %y, ptr align 8 @.__const, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %d, ptr align 8 @.__const.1, i32 16, i1 false) - %6 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 0 - store i8 0, ptr %6, align 1 - %7 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 1 - store i8 0, ptr %7, align 1 - %8 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 2 - store i8 0, ptr %8, align 1 - %9 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 3 - store i8 0, ptr %9, align 1 - %10 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 4 - store i8 0, ptr %10, align 1 - %11 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 5 - store i8 0, ptr %11, align 1 - %12 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 6 - store i8 0, ptr %12, align 1 - %13 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - store i8 0, ptr %13, align 1 - %14 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 0 - store i8 0, ptr %14, align 1 - %15 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 1 - store i8 0, ptr %15, align 1 - %16 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 2 - store i8 0, ptr %16, align 1 - %17 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 3 - store i8 0, ptr %17, align 1 - %18 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 4 - store i8 0, ptr %18, align 1 - %19 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 5 - store i8 0, ptr %19, align 1 - %20 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 6 - store i8 0, ptr %20, align 1 - %21 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - store i8 0, ptr %21, align 1 - %22 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 0 + store i8 0, ptr %b, align 1 + %ptradd = getelementptr inbounds i8, ptr %b, i64 1 + store i8 0, ptr %ptradd, align 1 + %ptradd2 = getelementptr inbounds i8, ptr %b, i64 2 + store i8 0, ptr %ptradd2, align 1 + %ptradd3 = getelementptr inbounds i8, ptr %b, i64 3 + store i8 0, ptr %ptradd3, align 1 + %ptradd4 = getelementptr inbounds i8, ptr %b, i64 4 + store i8 0, ptr %ptradd4, align 1 + %ptradd5 = getelementptr inbounds i8, ptr %b, i64 5 + store i8 0, ptr %ptradd5, align 1 + %ptradd6 = getelementptr inbounds i8, ptr %b, i64 6 + store i8 0, ptr %ptradd6, align 1 + %ptradd7 = getelementptr inbounds i8, ptr %b, i64 7 + store i8 0, ptr %ptradd7, align 1 + store i8 0, ptr %b, align 1 + %ptradd8 = getelementptr inbounds i8, ptr %b, i64 1 + store i8 0, ptr %ptradd8, align 1 + %ptradd9 = getelementptr inbounds i8, ptr %b, i64 2 + store i8 0, ptr %ptradd9, align 1 + %ptradd10 = getelementptr inbounds i8, ptr %b, i64 3 + store i8 0, ptr %ptradd10, align 1 + %ptradd11 = getelementptr inbounds i8, ptr %b, i64 4 + store i8 0, ptr %ptradd11, align 1 + %ptradd12 = getelementptr inbounds i8, ptr %b, i64 5 + store i8 0, ptr %ptradd12, align 1 + %ptradd13 = getelementptr inbounds i8, ptr %b, i64 6 + store i8 0, ptr %ptradd13, align 1 + %ptradd14 = getelementptr inbounds i8, ptr %b, i64 7 + store i8 0, ptr %ptradd14, align 1 %trunc = trunc i32 %0 to i8 - store i8 %trunc, ptr %22, align 1 + store i8 %trunc, ptr %b, align 1 %lshrl = lshr i32 %0, 8 - %23 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 1 - %trunc2 = trunc i32 %lshrl to i8 - store i8 %trunc2, ptr %23, align 1 - %lshrl3 = lshr i32 %lshrl, 8 - %24 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 2 - %trunc4 = trunc i32 %lshrl3 to i8 - store i8 %trunc4, ptr %24, align 1 - %lshrl5 = lshr i32 %lshrl3, 8 - %25 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 3 - %trunc6 = trunc i32 %lshrl5 to i8 - store i8 %trunc6, ptr %25, align 1 - %lshrl7 = lshr i32 %lshrl5, 8 - %lt8 = icmp slt i32 %0, 100 - %26 = zext i1 %lt8 to i8 - %shl9 = shl i8 %26, 7 - %27 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - %28 = load i8, ptr %27, align 1 - %29 = and i8 %28, 127 - %30 = or i8 %29, %shl9 - store i8 %30, ptr %27, align 1 - %31 = load i64, ptr %x, align 8 - %32 = and i64 4294967295, %31 - %trunc10 = trunc i64 %32 to i32 - store i32 %trunc10, ptr %taddr, align 4 - %33 = insertvalue %"any*" undef, ptr %taddr, 0 - %34 = insertvalue %"any*" %33, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %35 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %34, ptr %35, align 16 - %36 = load i64, ptr %x, align 8 - %lshrl11 = lshr i64 %36, 32 - %37 = and i64 2147483647, %lshrl11 - %trunc12 = trunc i64 %37 to i32 - store i32 %trunc12, ptr %taddr13, align 4 - %38 = insertvalue %"any*" undef, ptr %taddr13, 0 - %39 = insertvalue %"any*" %38, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %40 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %39, ptr %40, align 16 - %41 = load i64, ptr %x, align 8 - %lshrl14 = lshr i64 %41, 63 - %42 = and i64 1, %lshrl14 - %trunc15 = trunc i64 %42 to i8 - store i8 %trunc15, ptr %taddr16, align 1 - %43 = insertvalue %"any*" undef, ptr %taddr16, 0 - %44 = insertvalue %"any*" %43, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %45 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 2 - store %"any*" %44, ptr %45, align 16 - %46 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 8, ptr %varargslots, i64 3) - %47 = getelementptr inbounds %Abc, ptr %y, i32 0, i32 1 - %48 = load i64, ptr %47, align 8 - %49 = and i64 4294967295, %48 - %trunc18 = trunc i64 %49 to i32 - store i32 %trunc18, ptr %taddr19, align 4 - %50 = insertvalue %"any*" undef, ptr %taddr19, 0 - %51 = insertvalue %"any*" %50, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %52 = getelementptr inbounds [3 x %"any*"], ptr %varargslots17, i64 0, i64 0 - store %"any*" %51, ptr %52, align 16 - %53 = getelementptr inbounds %Abc, ptr %y, i32 0, i32 1 - %54 = load i64, ptr %53, align 8 - %lshrl20 = lshr i64 %54, 32 - %55 = and i64 2147483647, %lshrl20 - %trunc21 = trunc i64 %55 to i32 - store i32 %trunc21, ptr %taddr22, align 4 - %56 = insertvalue %"any*" undef, ptr %taddr22, 0 - %57 = insertvalue %"any*" %56, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %58 = getelementptr inbounds [3 x %"any*"], ptr %varargslots17, i64 0, i64 1 - store %"any*" %57, ptr %58, align 16 - %59 = getelementptr inbounds %Abc, ptr %y, i32 0, i32 1 - %60 = load i64, ptr %59, align 8 - %lshrl23 = lshr i64 %60, 63 - %61 = and i64 1, %lshrl23 - %trunc24 = trunc i64 %61 to i8 - store i8 %trunc24, ptr %taddr25, align 1 - %62 = insertvalue %"any*" undef, ptr %taddr25, 0 - %63 = insertvalue %"any*" %62, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %64 = getelementptr inbounds [3 x %"any*"], ptr %varargslots17, i64 0, i64 2 - store %"any*" %63, ptr %64, align 16 - %65 = call i64 @std.io.printfn(ptr %retparam26, ptr @.str.2, i64 8, ptr %varargslots17, i64 3) - %66 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 0 - %67 = load i8, ptr %66, align 1 - %zext28 = zext i8 %67 to i32 - %68 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 1 - %69 = load i8, ptr %68, align 1 - %zext29 = zext i8 %69 to i32 - %shl30 = shl i32 %zext29, 8 - %70 = or i32 %shl30, %zext28 - %71 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 2 - %72 = load i8, ptr %71, align 1 - %zext31 = zext i8 %72 to i32 - %shl32 = shl i32 %zext31, 16 - %73 = or i32 %shl32, %70 - %74 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 3 - %75 = load i8, ptr %74, align 1 - %zext33 = zext i8 %75 to i32 - %shl34 = shl i32 %zext33, 24 - %76 = or i32 %shl34, %73 - store i32 %76, ptr %taddr35, align 4 - %77 = insertvalue %"any*" undef, ptr %taddr35, 0 - %78 = insertvalue %"any*" %77, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %79 = getelementptr inbounds [3 x %"any*"], ptr %varargslots27, i64 0, i64 0 - store %"any*" %78, ptr %79, align 16 - %80 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 4 - %81 = load i8, ptr %80, align 1 - %zext36 = zext i8 %81 to i32 - %82 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 5 - %83 = load i8, ptr %82, align 1 - %zext37 = zext i8 %83 to i32 - %shl38 = shl i32 %zext37, 8 - %84 = or i32 %shl38, %zext36 - %85 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 6 - %86 = load i8, ptr %85, align 1 - %zext39 = zext i8 %86 to i32 - %shl40 = shl i32 %zext39, 16 - %87 = or i32 %shl40, %84 - %88 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - %89 = load i8, ptr %88, align 1 - %zext41 = zext i8 %89 to i32 - %shl42 = shl i32 %zext41, 24 - %90 = or i32 %shl42, %87 - %91 = and i32 2147483647, %90 - store i32 %91, ptr %taddr43, align 4 - %92 = insertvalue %"any*" undef, ptr %taddr43, 0 - %93 = insertvalue %"any*" %92, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %94 = getelementptr inbounds [3 x %"any*"], ptr %varargslots27, i64 0, i64 1 - store %"any*" %93, ptr %94, align 16 - %95 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - %96 = load i8, ptr %95, align 1 - %lshrl44 = lshr i8 %96, 7 - %97 = trunc i8 %lshrl44 to i1 - %98 = zext i1 %97 to i8 - store i8 %98, ptr %taddr45, align 1 - %99 = insertvalue %"any*" undef, ptr %taddr45, 0 - %100 = insertvalue %"any*" %99, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %101 = getelementptr inbounds [3 x %"any*"], ptr %varargslots27, i64 0, i64 2 - store %"any*" %100, ptr %101, align 16 - %102 = call i64 @std.io.printfn(ptr %retparam46, ptr @.str.3, i64 8, ptr %varargslots27, i64 3) + %ptradd15 = getelementptr inbounds i8, ptr %b, i64 1 + %trunc16 = trunc i32 %lshrl to i8 + store i8 %trunc16, ptr %ptradd15, align 1 + %lshrl17 = lshr i32 %lshrl, 8 + %ptradd18 = getelementptr inbounds i8, ptr %b, i64 2 + %trunc19 = trunc i32 %lshrl17 to i8 + store i8 %trunc19, ptr %ptradd18, align 1 + %lshrl20 = lshr i32 %lshrl17, 8 + %ptradd21 = getelementptr inbounds i8, ptr %b, i64 3 + %trunc22 = trunc i32 %lshrl20 to i8 + store i8 %trunc22, ptr %ptradd21, align 1 + %lshrl23 = lshr i32 %lshrl20, 8 + %lt24 = icmp slt i32 %0, 100 + %6 = zext i1 %lt24 to i8 + %shl25 = shl i8 %6, 7 + %ptradd26 = getelementptr inbounds i8, ptr %b, i64 7 + %7 = load i8, ptr %ptradd26, align 1 + %8 = and i8 %7, 127 + %9 = or i8 %8, %shl25 + store i8 %9, ptr %ptradd26, align 1 + %10 = load i64, ptr %x, align 8 + %11 = and i64 4294967295, %10 + %trunc27 = trunc i64 %11 to i32 + store i32 %trunc27, ptr %taddr, align 4 + %12 = insertvalue %"any*" undef, ptr %taddr, 0 + %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %13, ptr %varargslots, align 16 + %14 = load i64, ptr %x, align 8 + %lshrl28 = lshr i64 %14, 32 + %15 = and i64 2147483647, %lshrl28 + %trunc29 = trunc i64 %15 to i32 + store i32 %trunc29, ptr %taddr30, align 4 + %16 = insertvalue %"any*" undef, ptr %taddr30, 0 + %17 = insertvalue %"any*" %16, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + %ptradd31 = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %17, ptr %ptradd31, align 16 + %18 = load i64, ptr %x, align 8 + %lshrl32 = lshr i64 %18, 63 + %19 = and i64 1, %lshrl32 + %trunc33 = trunc i64 %19 to i8 + store i8 %trunc33, ptr %taddr34, align 1 + %20 = insertvalue %"any*" undef, ptr %taddr34, 0 + %21 = insertvalue %"any*" %20, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd35 = getelementptr inbounds i8, ptr %varargslots, i64 32 + store %"any*" %21, ptr %ptradd35, align 16 + %22 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 8, ptr %varargslots, i64 3) + %ptradd37 = getelementptr inbounds i8, ptr %y, i64 8 + %23 = load i64, ptr %ptradd37, align 8 + %24 = and i64 4294967295, %23 + %trunc38 = trunc i64 %24 to i32 + store i32 %trunc38, ptr %taddr39, align 4 + %25 = insertvalue %"any*" undef, ptr %taddr39, 0 + %26 = insertvalue %"any*" %25, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %26, ptr %varargslots36, align 16 + %ptradd40 = getelementptr inbounds i8, ptr %y, i64 8 + %27 = load i64, ptr %ptradd40, align 8 + %lshrl41 = lshr i64 %27, 32 + %28 = and i64 2147483647, %lshrl41 + %trunc42 = trunc i64 %28 to i32 + store i32 %trunc42, ptr %taddr43, align 4 + %29 = insertvalue %"any*" undef, ptr %taddr43, 0 + %30 = insertvalue %"any*" %29, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + %ptradd44 = getelementptr inbounds i8, ptr %varargslots36, i64 16 + store %"any*" %30, ptr %ptradd44, align 16 + %ptradd45 = getelementptr inbounds i8, ptr %y, i64 8 + %31 = load i64, ptr %ptradd45, align 8 + %lshrl46 = lshr i64 %31, 63 + %32 = and i64 1, %lshrl46 + %trunc47 = trunc i64 %32 to i8 + store i8 %trunc47, ptr %taddr48, align 1 + %33 = insertvalue %"any*" undef, ptr %taddr48, 0 + %34 = insertvalue %"any*" %33, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd49 = getelementptr inbounds i8, ptr %varargslots36, i64 32 + store %"any*" %34, ptr %ptradd49, align 16 + %35 = call i64 @std.io.printfn(ptr %retparam50, ptr @.str.2, i64 8, ptr %varargslots36, i64 3) + %36 = load i8, ptr %b, align 1 + %zext52 = zext i8 %36 to i32 + %ptradd53 = getelementptr inbounds i8, ptr %b, i64 1 + %37 = load i8, ptr %ptradd53, align 1 + %zext54 = zext i8 %37 to i32 + %shl55 = shl i32 %zext54, 8 + %38 = or i32 %shl55, %zext52 + %ptradd56 = getelementptr inbounds i8, ptr %b, i64 2 + %39 = load i8, ptr %ptradd56, align 1 + %zext57 = zext i8 %39 to i32 + %shl58 = shl i32 %zext57, 16 + %40 = or i32 %shl58, %38 + %ptradd59 = getelementptr inbounds i8, ptr %b, i64 3 + %41 = load i8, ptr %ptradd59, align 1 + %zext60 = zext i8 %41 to i32 + %shl61 = shl i32 %zext60, 24 + %42 = or i32 %shl61, %40 + store i32 %42, ptr %taddr62, align 4 + %43 = insertvalue %"any*" undef, ptr %taddr62, 0 + %44 = insertvalue %"any*" %43, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %44, ptr %varargslots51, align 16 + %ptradd63 = getelementptr inbounds i8, ptr %b, i64 4 + %45 = load i8, ptr %ptradd63, align 1 + %zext64 = zext i8 %45 to i32 + %ptradd65 = getelementptr inbounds i8, ptr %b, i64 5 + %46 = load i8, ptr %ptradd65, align 1 + %zext66 = zext i8 %46 to i32 + %shl67 = shl i32 %zext66, 8 + %47 = or i32 %shl67, %zext64 + %ptradd68 = getelementptr inbounds i8, ptr %b, i64 6 + %48 = load i8, ptr %ptradd68, align 1 + %zext69 = zext i8 %48 to i32 + %shl70 = shl i32 %zext69, 16 + %49 = or i32 %shl70, %47 + %ptradd71 = getelementptr inbounds i8, ptr %b, i64 7 + %50 = load i8, ptr %ptradd71, align 1 + %zext72 = zext i8 %50 to i32 + %shl73 = shl i32 %zext72, 24 + %51 = or i32 %shl73, %49 + %52 = and i32 2147483647, %51 + store i32 %52, ptr %taddr74, align 4 + %53 = insertvalue %"any*" undef, ptr %taddr74, 0 + %54 = insertvalue %"any*" %53, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + %ptradd75 = getelementptr inbounds i8, ptr %varargslots51, i64 16 + store %"any*" %54, ptr %ptradd75, align 16 + %ptradd76 = getelementptr inbounds i8, ptr %b, i64 7 + %55 = load i8, ptr %ptradd76, align 1 + %lshrl77 = lshr i8 %55, 7 + %56 = trunc i8 %lshrl77 to i1 + %57 = zext i1 %56 to i8 + store i8 %57, ptr %taddr78, align 1 + %58 = insertvalue %"any*" undef, ptr %taddr78, 0 + %59 = insertvalue %"any*" %58, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd79 = getelementptr inbounds i8, ptr %varargslots51, i64 32 + store %"any*" %59, ptr %ptradd79, align 16 + %60 = call i64 @std.io.printfn(ptr %retparam80, ptr @.str.3, i64 8, ptr %varargslots51, i64 3) %add = add i32 %0, 1 - %zext47 = zext i32 %add to i64 - %103 = and i64 %zext47, 4294967295 - %104 = and i64 %103, -9223372032559808513 - %105 = or i64 %104, 4294967296 + %zext81 = zext i32 %add to i64 + %61 = and i64 %zext81, 4294967295 + %62 = and i64 %61, -9223372032559808513 + %63 = or i64 %62, 4294967296 %gt = icmp sgt i32 %0, 100 - %106 = zext i1 %gt to i8 - %zext48 = zext i8 %106 to i64 - %shl49 = shl i64 %zext48, 63 - %107 = and i64 %shl49, -9223372036854775808 - %108 = and i64 %105, 9223372036854775807 - %109 = or i64 %108, %107 - store i64 %109, ptr %x, align 8 - %110 = getelementptr inbounds %Abc, ptr %y, i32 0, i32 1 - store i64 -9223371989610135519, ptr %110, align 8 - %111 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 0 - store i8 0, ptr %111, align 1 - %112 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 1 - store i8 0, ptr %112, align 1 - %113 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 2 - store i8 0, ptr %113, align 1 - %114 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 3 - store i8 0, ptr %114, align 1 - %115 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 4 - store i8 0, ptr %115, align 1 - %116 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 5 - store i8 0, ptr %116, align 1 - %117 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 6 - store i8 0, ptr %117, align 1 - %118 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - store i8 0, ptr %118, align 1 - %add50 = add i32 %0, 1 - %119 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 0 - %trunc51 = trunc i32 %add50 to i8 - store i8 %trunc51, ptr %119, align 1 - %lshrl52 = lshr i32 %add50, 8 - %120 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 1 - %trunc53 = trunc i32 %lshrl52 to i8 - store i8 %trunc53, ptr %120, align 1 - %lshrl54 = lshr i32 %lshrl52, 8 - %121 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 2 - %trunc55 = trunc i32 %lshrl54 to i8 - store i8 %trunc55, ptr %121, align 1 - %lshrl56 = lshr i32 %lshrl54, 8 - %122 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 3 - %trunc57 = trunc i32 %lshrl56 to i8 - store i8 %trunc57, ptr %122, align 1 - %lshrl58 = lshr i32 %lshrl56, 8 - %123 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 4 - store i8 1, ptr %123, align 1 - %124 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 5 - store i8 0, ptr %124, align 1 - %125 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 6 - store i8 0, ptr %125, align 1 - %126 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - %127 = load i8, ptr %126, align 1 - %128 = and i8 %127, -128 - store i8 %128, ptr %126, align 1 - %gt59 = icmp sgt i32 %0, 100 - %129 = zext i1 %gt59 to i8 - %shl60 = shl i8 %129, 7 - %130 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - %131 = load i8, ptr %130, align 1 - %132 = and i8 %131, 127 - %133 = or i8 %132, %shl60 - store i8 %133, ptr %130, align 1 - %134 = load i64, ptr %x, align 8 - %135 = and i64 4294967295, %134 - %trunc62 = trunc i64 %135 to i32 - store i32 %trunc62, ptr %taddr63, align 4 - %136 = insertvalue %"any*" undef, ptr %taddr63, 0 - %137 = insertvalue %"any*" %136, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %138 = getelementptr inbounds [3 x %"any*"], ptr %varargslots61, i64 0, i64 0 - store %"any*" %137, ptr %138, align 16 - %139 = load i64, ptr %x, align 8 - %lshrl64 = lshr i64 %139, 32 - %140 = and i64 2147483647, %lshrl64 - %trunc65 = trunc i64 %140 to i32 - store i32 %trunc65, ptr %taddr66, align 4 - %141 = insertvalue %"any*" undef, ptr %taddr66, 0 - %142 = insertvalue %"any*" %141, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %143 = getelementptr inbounds [3 x %"any*"], ptr %varargslots61, i64 0, i64 1 - store %"any*" %142, ptr %143, align 16 - %144 = load i64, ptr %x, align 8 - %lshrl67 = lshr i64 %144, 63 - %145 = and i64 1, %lshrl67 - %trunc68 = trunc i64 %145 to i8 - store i8 %trunc68, ptr %taddr69, align 1 - %146 = insertvalue %"any*" undef, ptr %taddr69, 0 - %147 = insertvalue %"any*" %146, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %148 = getelementptr inbounds [3 x %"any*"], ptr %varargslots61, i64 0, i64 2 - store %"any*" %147, ptr %148, align 16 - %149 = call i64 @std.io.printfn(ptr %retparam70, ptr @.str.4, i64 8, ptr %varargslots61, i64 3) - %150 = getelementptr inbounds %Abc, ptr %y, i32 0, i32 1 - %151 = load i64, ptr %150, align 8 - %152 = and i64 4294967295, %151 - %trunc72 = trunc i64 %152 to i32 - store i32 %trunc72, ptr %taddr73, align 4 - %153 = insertvalue %"any*" undef, ptr %taddr73, 0 - %154 = insertvalue %"any*" %153, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %155 = getelementptr inbounds [3 x %"any*"], ptr %varargslots71, i64 0, i64 0 - store %"any*" %154, ptr %155, align 16 - %156 = getelementptr inbounds %Abc, ptr %y, i32 0, i32 1 - %157 = load i64, ptr %156, align 8 - %lshrl74 = lshr i64 %157, 32 - %158 = and i64 2147483647, %lshrl74 - %trunc75 = trunc i64 %158 to i32 - store i32 %trunc75, ptr %taddr76, align 4 - %159 = insertvalue %"any*" undef, ptr %taddr76, 0 - %160 = insertvalue %"any*" %159, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %161 = getelementptr inbounds [3 x %"any*"], ptr %varargslots71, i64 0, i64 1 - store %"any*" %160, ptr %161, align 16 - %162 = getelementptr inbounds %Abc, ptr %y, i32 0, i32 1 - %163 = load i64, ptr %162, align 8 - %lshrl77 = lshr i64 %163, 63 - %164 = and i64 1, %lshrl77 - %trunc78 = trunc i64 %164 to i8 - store i8 %trunc78, ptr %taddr79, align 1 - %165 = insertvalue %"any*" undef, ptr %taddr79, 0 - %166 = insertvalue %"any*" %165, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %167 = getelementptr inbounds [3 x %"any*"], ptr %varargslots71, i64 0, i64 2 - store %"any*" %166, ptr %167, align 16 - %168 = call i64 @std.io.printfn(ptr %retparam80, ptr @.str.5, i64 8, ptr %varargslots71, i64 3) - %169 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 0 - %170 = load i8, ptr %169, align 1 - %zext82 = zext i8 %170 to i32 - %171 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 1 - %172 = load i8, ptr %171, align 1 - %zext83 = zext i8 %172 to i32 - %shl84 = shl i32 %zext83, 8 - %173 = or i32 %shl84, %zext82 - %174 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 2 - %175 = load i8, ptr %174, align 1 - %zext85 = zext i8 %175 to i32 - %shl86 = shl i32 %zext85, 16 - %176 = or i32 %shl86, %173 - %177 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 3 - %178 = load i8, ptr %177, align 1 - %zext87 = zext i8 %178 to i32 - %shl88 = shl i32 %zext87, 24 - %179 = or i32 %shl88, %176 - store i32 %179, ptr %taddr89, align 4 - %180 = insertvalue %"any*" undef, ptr %taddr89, 0 - %181 = insertvalue %"any*" %180, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %182 = getelementptr inbounds [3 x %"any*"], ptr %varargslots81, i64 0, i64 0 - store %"any*" %181, ptr %182, align 16 - %183 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 4 - %184 = load i8, ptr %183, align 1 - %zext90 = zext i8 %184 to i32 - %185 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 5 - %186 = load i8, ptr %185, align 1 - %zext91 = zext i8 %186 to i32 - %shl92 = shl i32 %zext91, 8 - %187 = or i32 %shl92, %zext90 - %188 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 6 - %189 = load i8, ptr %188, align 1 - %zext93 = zext i8 %189 to i32 - %shl94 = shl i32 %zext93, 16 - %190 = or i32 %shl94, %187 - %191 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - %192 = load i8, ptr %191, align 1 - %zext95 = zext i8 %192 to i32 - %shl96 = shl i32 %zext95, 24 - %193 = or i32 %shl96, %190 - %194 = and i32 2147483647, %193 - store i32 %194, ptr %taddr97, align 4 - %195 = insertvalue %"any*" undef, ptr %taddr97, 0 - %196 = insertvalue %"any*" %195, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %197 = getelementptr inbounds [3 x %"any*"], ptr %varargslots81, i64 0, i64 1 - store %"any*" %196, ptr %197, align 16 - %198 = getelementptr inbounds [8 x i8], ptr %b, i64 0, i64 7 - %199 = load i8, ptr %198, align 1 - %lshrl98 = lshr i8 %199, 7 - %200 = trunc i8 %lshrl98 to i1 - %201 = zext i1 %200 to i8 - store i8 %201, ptr %taddr99, align 1 - %202 = insertvalue %"any*" undef, ptr %taddr99, 0 - %203 = insertvalue %"any*" %202, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %204 = getelementptr inbounds [3 x %"any*"], ptr %varargslots81, i64 0, i64 2 - store %"any*" %203, ptr %204, align 16 - %205 = call i64 @std.io.printfn(ptr %retparam100, ptr @.str.6, i64 8, ptr %varargslots81, i64 3) + %64 = zext i1 %gt to i8 + %zext82 = zext i8 %64 to i64 + %shl83 = shl i64 %zext82, 63 + %65 = and i64 %shl83, -9223372036854775808 + %66 = and i64 %63, 9223372036854775807 + %67 = or i64 %66, %65 + store i64 %67, ptr %x, align 8 + %ptradd84 = getelementptr inbounds i8, ptr %y, i64 8 + store i64 -9223371989610135519, ptr %ptradd84, align 8 + store i8 0, ptr %b, align 1 + %ptradd85 = getelementptr inbounds i8, ptr %b, i64 1 + store i8 0, ptr %ptradd85, align 1 + %ptradd86 = getelementptr inbounds i8, ptr %b, i64 2 + store i8 0, ptr %ptradd86, align 1 + %ptradd87 = getelementptr inbounds i8, ptr %b, i64 3 + store i8 0, ptr %ptradd87, align 1 + %ptradd88 = getelementptr inbounds i8, ptr %b, i64 4 + store i8 0, ptr %ptradd88, align 1 + %ptradd89 = getelementptr inbounds i8, ptr %b, i64 5 + store i8 0, ptr %ptradd89, align 1 + %ptradd90 = getelementptr inbounds i8, ptr %b, i64 6 + store i8 0, ptr %ptradd90, align 1 + %ptradd91 = getelementptr inbounds i8, ptr %b, i64 7 + store i8 0, ptr %ptradd91, align 1 + %add92 = add i32 %0, 1 + %trunc93 = trunc i32 %add92 to i8 + store i8 %trunc93, ptr %b, align 1 + %lshrl94 = lshr i32 %add92, 8 + %ptradd95 = getelementptr inbounds i8, ptr %b, i64 1 + %trunc96 = trunc i32 %lshrl94 to i8 + store i8 %trunc96, ptr %ptradd95, align 1 + %lshrl97 = lshr i32 %lshrl94, 8 + %ptradd98 = getelementptr inbounds i8, ptr %b, i64 2 + %trunc99 = trunc i32 %lshrl97 to i8 + store i8 %trunc99, ptr %ptradd98, align 1 + %lshrl100 = lshr i32 %lshrl97, 8 + %ptradd101 = getelementptr inbounds i8, ptr %b, i64 3 + %trunc102 = trunc i32 %lshrl100 to i8 + store i8 %trunc102, ptr %ptradd101, align 1 + %lshrl103 = lshr i32 %lshrl100, 8 + %ptradd104 = getelementptr inbounds i8, ptr %b, i64 4 + store i8 1, ptr %ptradd104, align 1 + %ptradd105 = getelementptr inbounds i8, ptr %b, i64 5 + store i8 0, ptr %ptradd105, align 1 + %ptradd106 = getelementptr inbounds i8, ptr %b, i64 6 + store i8 0, ptr %ptradd106, align 1 + %ptradd107 = getelementptr inbounds i8, ptr %b, i64 7 + %68 = load i8, ptr %ptradd107, align 1 + %69 = and i8 %68, -128 + store i8 %69, ptr %ptradd107, align 1 + %gt108 = icmp sgt i32 %0, 100 + %70 = zext i1 %gt108 to i8 + %shl109 = shl i8 %70, 7 + %ptradd110 = getelementptr inbounds i8, ptr %b, i64 7 + %71 = load i8, ptr %ptradd110, align 1 + %72 = and i8 %71, 127 + %73 = or i8 %72, %shl109 + store i8 %73, ptr %ptradd110, align 1 + %74 = load i64, ptr %x, align 8 + %75 = and i64 4294967295, %74 + %trunc112 = trunc i64 %75 to i32 + store i32 %trunc112, ptr %taddr113, align 4 + %76 = insertvalue %"any*" undef, ptr %taddr113, 0 + %77 = insertvalue %"any*" %76, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %77, ptr %varargslots111, align 16 + %78 = load i64, ptr %x, align 8 + %lshrl114 = lshr i64 %78, 32 + %79 = and i64 2147483647, %lshrl114 + %trunc115 = trunc i64 %79 to i32 + store i32 %trunc115, ptr %taddr116, align 4 + %80 = insertvalue %"any*" undef, ptr %taddr116, 0 + %81 = insertvalue %"any*" %80, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + %ptradd117 = getelementptr inbounds i8, ptr %varargslots111, i64 16 + store %"any*" %81, ptr %ptradd117, align 16 + %82 = load i64, ptr %x, align 8 + %lshrl118 = lshr i64 %82, 63 + %83 = and i64 1, %lshrl118 + %trunc119 = trunc i64 %83 to i8 + store i8 %trunc119, ptr %taddr120, align 1 + %84 = insertvalue %"any*" undef, ptr %taddr120, 0 + %85 = insertvalue %"any*" %84, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd121 = getelementptr inbounds i8, ptr %varargslots111, i64 32 + store %"any*" %85, ptr %ptradd121, align 16 + %86 = call i64 @std.io.printfn(ptr %retparam122, ptr @.str.4, i64 8, ptr %varargslots111, i64 3) + %ptradd124 = getelementptr inbounds i8, ptr %y, i64 8 + %87 = load i64, ptr %ptradd124, align 8 + %88 = and i64 4294967295, %87 + %trunc125 = trunc i64 %88 to i32 + store i32 %trunc125, ptr %taddr126, align 4 + %89 = insertvalue %"any*" undef, ptr %taddr126, 0 + %90 = insertvalue %"any*" %89, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %90, ptr %varargslots123, align 16 + %ptradd127 = getelementptr inbounds i8, ptr %y, i64 8 + %91 = load i64, ptr %ptradd127, align 8 + %lshrl128 = lshr i64 %91, 32 + %92 = and i64 2147483647, %lshrl128 + %trunc129 = trunc i64 %92 to i32 + store i32 %trunc129, ptr %taddr130, align 4 + %93 = insertvalue %"any*" undef, ptr %taddr130, 0 + %94 = insertvalue %"any*" %93, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + %ptradd131 = getelementptr inbounds i8, ptr %varargslots123, i64 16 + store %"any*" %94, ptr %ptradd131, align 16 + %ptradd132 = getelementptr inbounds i8, ptr %y, i64 8 + %95 = load i64, ptr %ptradd132, align 8 + %lshrl133 = lshr i64 %95, 63 + %96 = and i64 1, %lshrl133 + %trunc134 = trunc i64 %96 to i8 + store i8 %trunc134, ptr %taddr135, align 1 + %97 = insertvalue %"any*" undef, ptr %taddr135, 0 + %98 = insertvalue %"any*" %97, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd136 = getelementptr inbounds i8, ptr %varargslots123, i64 32 + store %"any*" %98, ptr %ptradd136, align 16 + %99 = call i64 @std.io.printfn(ptr %retparam137, ptr @.str.5, i64 8, ptr %varargslots123, i64 3) + %100 = load i8, ptr %b, align 1 + %zext139 = zext i8 %100 to i32 + %ptradd140 = getelementptr inbounds i8, ptr %b, i64 1 + %101 = load i8, ptr %ptradd140, align 1 + %zext141 = zext i8 %101 to i32 + %shl142 = shl i32 %zext141, 8 + %102 = or i32 %shl142, %zext139 + %ptradd143 = getelementptr inbounds i8, ptr %b, i64 2 + %103 = load i8, ptr %ptradd143, align 1 + %zext144 = zext i8 %103 to i32 + %shl145 = shl i32 %zext144, 16 + %104 = or i32 %shl145, %102 + %ptradd146 = getelementptr inbounds i8, ptr %b, i64 3 + %105 = load i8, ptr %ptradd146, align 1 + %zext147 = zext i8 %105 to i32 + %shl148 = shl i32 %zext147, 24 + %106 = or i32 %shl148, %104 + store i32 %106, ptr %taddr149, align 4 + %107 = insertvalue %"any*" undef, ptr %taddr149, 0 + %108 = insertvalue %"any*" %107, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %108, ptr %varargslots138, align 16 + %ptradd150 = getelementptr inbounds i8, ptr %b, i64 4 + %109 = load i8, ptr %ptradd150, align 1 + %zext151 = zext i8 %109 to i32 + %ptradd152 = getelementptr inbounds i8, ptr %b, i64 5 + %110 = load i8, ptr %ptradd152, align 1 + %zext153 = zext i8 %110 to i32 + %shl154 = shl i32 %zext153, 8 + %111 = or i32 %shl154, %zext151 + %ptradd155 = getelementptr inbounds i8, ptr %b, i64 6 + %112 = load i8, ptr %ptradd155, align 1 + %zext156 = zext i8 %112 to i32 + %shl157 = shl i32 %zext156, 16 + %113 = or i32 %shl157, %111 + %ptradd158 = getelementptr inbounds i8, ptr %b, i64 7 + %114 = load i8, ptr %ptradd158, align 1 + %zext159 = zext i8 %114 to i32 + %shl160 = shl i32 %zext159, 24 + %115 = or i32 %shl160, %113 + %116 = and i32 2147483647, %115 + store i32 %116, ptr %taddr161, align 4 + %117 = insertvalue %"any*" undef, ptr %taddr161, 0 + %118 = insertvalue %"any*" %117, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + %ptradd162 = getelementptr inbounds i8, ptr %varargslots138, i64 16 + store %"any*" %118, ptr %ptradd162, align 16 + %ptradd163 = getelementptr inbounds i8, ptr %b, i64 7 + %119 = load i8, ptr %ptradd163, align 1 + %lshrl164 = lshr i8 %119, 7 + %120 = trunc i8 %lshrl164 to i1 + %121 = zext i1 %120 to i8 + store i8 %121, ptr %taddr165, align 1 + %122 = insertvalue %"any*" undef, ptr %taddr165, 0 + %123 = insertvalue %"any*" %122, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd166 = getelementptr inbounds i8, ptr %varargslots138, i64 32 + store %"any*" %123, ptr %ptradd166, align 16 + %124 = call i64 @std.io.printfn(ptr %retparam167, ptr @.str.6, i64 8, ptr %varargslots138, i64 3) ret void } - +; Function Attrs: define void @test.main() #0 { entry: call void @test.hello(i32 12) diff --git a/test/test_suite/bitstruct/bitstruct_ops.c3t b/test/test_suite/bitstruct/bitstruct_ops.c3t index 50e8b7dad..7e3d96d80 100644 --- a/test/test_suite/bitstruct/bitstruct_ops.c3t +++ b/test/test_suite/bitstruct/bitstruct_ops.c3t @@ -55,38 +55,38 @@ entry: %varargslots3 = alloca [2 x %"any*"], align 16 %taddr5 = alloca i8, align 1 %taddr8 = alloca i8, align 1 - %retparam9 = alloca i64, align 8 + %retparam10 = alloca i64, align 8 %f5 = alloca i32, align 4 - %varargslots10 = alloca [2 x %"any*"], align 16 - %taddr12 = alloca i8, align 1 - %taddr15 = alloca i8, align 1 - %retparam16 = alloca i64, align 8 - %varargslots18 = alloca [2 x %"any*"], align 16 - %taddr20 = alloca i8, align 1 - %taddr23 = alloca i8, align 1 - %retparam24 = alloca i64, align 8 + %varargslots11 = alloca [2 x %"any*"], align 16 + %taddr13 = alloca i8, align 1 + %taddr16 = alloca i8, align 1 + %retparam18 = alloca i64, align 8 + %varargslots20 = alloca [2 x %"any*"], align 16 + %taddr22 = alloca i8, align 1 + %taddr25 = alloca i8, align 1 + %retparam27 = alloca i64, align 8 %b1 = alloca [13 x i8], align 1 %b2 = alloca [13 x i8], align 1 %b3 = alloca [13 x i8], align 1 %0 = alloca i104, align 1 - %varargslots26 = alloca [3 x %"any*"], align 16 - %taddr27 = alloca i8, align 1 - %taddr29 = alloca i8, align 1 - %taddr31 = alloca i8, align 1 - %retparam32 = alloca i64, align 8 + %varargslots29 = alloca [3 x %"any*"], align 16 + %taddr30 = alloca i8, align 1 + %taddr32 = alloca i8, align 1 + %taddr36 = alloca i8, align 1 + %retparam38 = alloca i64, align 8 %1 = alloca i104, align 1 - %varargslots34 = alloca [3 x %"any*"], align 16 - %taddr35 = alloca i8, align 1 - %taddr37 = alloca i8, align 1 - %taddr39 = alloca i8, align 1 - %retparam40 = alloca i64, align 8 - %taddr41 = alloca [13 x i8], align 1 - %2 = alloca i104, align 1 - %varargslots43 = alloca [3 x %"any*"], align 16 - %taddr44 = alloca i8, align 1 - %taddr46 = alloca i8, align 1 - %taddr48 = alloca i8, align 1 + %varargslots40 = alloca [3 x %"any*"], align 16 + %taddr41 = alloca i8, align 1 + %taddr43 = alloca i8, align 1 + %taddr47 = alloca i8, align 1 %retparam49 = alloca i64, align 8 + %taddr50 = alloca [13 x i8], align 1 + %2 = alloca i104, align 1 + %varargslots52 = alloca [3 x %"any*"], align 16 + %taddr53 = alloca i8, align 1 + %taddr55 = alloca i8, align 1 + %taddr59 = alloca i8, align 1 + %retparam61 = alloca i64, align 8 store i32 3, ptr %f1, align 4 store i32 1, ptr %f2, align 4 %3 = load i32, ptr %f1, align 4 @@ -99,191 +99,178 @@ entry: store i8 %trunc, ptr %taddr, align 1 %7 = insertvalue %"any*" undef, ptr %taddr, 0 %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %9 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %8, ptr %9, align 16 - %10 = load i32, ptr %f3, align 4 - %lshrl = lshr i32 %10, 1 - %11 = and i32 1, %lshrl - %trunc1 = trunc i32 %11 to i8 + store %"any*" %8, ptr %varargslots, align 16 + %9 = load i32, ptr %f3, align 4 + %lshrl = lshr i32 %9, 1 + %10 = and i32 1, %lshrl + %trunc1 = trunc i32 %10 to i8 store i8 %trunc1, ptr %taddr2, align 1 - %12 = insertvalue %"any*" undef, ptr %taddr2, 0 - %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %14 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %13, ptr %14, align 16 - %15 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 5, ptr %varargslots, i64 2) - %16 = load i32, ptr %f1, align 4 - %17 = load i32, ptr %f2, align 4 - %bnot = xor i32 %17, -1 - %or = or i32 %16, %bnot - %18 = load i32, ptr %f3, align 4 - %xor = xor i32 %or, %18 + %11 = insertvalue %"any*" undef, ptr %taddr2, 0 + %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %12, ptr %ptradd, align 16 + %13 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 5, ptr %varargslots, i64 2) + %14 = load i32, ptr %f1, align 4 + %15 = load i32, ptr %f2, align 4 + %bnot = xor i32 %15, -1 + %or = or i32 %14, %bnot + %16 = load i32, ptr %f3, align 4 + %xor = xor i32 %or, %16 store i32 %xor, ptr %f4, align 4 - %19 = load i32, ptr %f4, align 4 - %20 = and i32 1, %19 - %trunc4 = trunc i32 %20 to i8 + %17 = load i32, ptr %f4, align 4 + %18 = and i32 1, %17 + %trunc4 = trunc i32 %18 to i8 store i8 %trunc4, ptr %taddr5, align 1 - %21 = insertvalue %"any*" undef, ptr %taddr5, 0 - %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %23 = getelementptr inbounds [2 x %"any*"], ptr %varargslots3, i64 0, i64 0 - store %"any*" %22, ptr %23, align 16 - %24 = load i32, ptr %f4, align 4 - %lshrl6 = lshr i32 %24, 1 - %25 = and i32 1, %lshrl6 - %trunc7 = trunc i32 %25 to i8 + %19 = insertvalue %"any*" undef, ptr %taddr5, 0 + %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %20, ptr %varargslots3, align 16 + %21 = load i32, ptr %f4, align 4 + %lshrl6 = lshr i32 %21, 1 + %22 = and i32 1, %lshrl6 + %trunc7 = trunc i32 %22 to i8 store i8 %trunc7, ptr %taddr8, align 1 - %26 = insertvalue %"any*" undef, ptr %taddr8, 0 - %27 = insertvalue %"any*" %26, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %28 = getelementptr inbounds [2 x %"any*"], ptr %varargslots3, i64 0, i64 1 - store %"any*" %27, ptr %28, align 16 - %29 = call i64 @std.io.printfn(ptr %retparam9, ptr @.str.1, i64 5, ptr %varargslots3, i64 2) + %23 = insertvalue %"any*" undef, ptr %taddr8, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd9 = getelementptr inbounds i8, ptr %varargslots3, i64 16 + store %"any*" %24, ptr %ptradd9, align 16 + %25 = call i64 @std.io.printfn(ptr %retparam10, ptr @.str.1, i64 5, ptr %varargslots3, i64 2) store i32 3, ptr %f5, align 4 + %26 = load i32, ptr %f5, align 4 + %27 = and i32 1, %26 + %trunc12 = trunc i32 %27 to i8 + store i8 %trunc12, ptr %taddr13, align 1 + %28 = insertvalue %"any*" undef, ptr %taddr13, 0 + %29 = insertvalue %"any*" %28, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %29, ptr %varargslots11, align 16 %30 = load i32, ptr %f5, align 4 - %31 = and i32 1, %30 - %trunc11 = trunc i32 %31 to i8 - store i8 %trunc11, ptr %taddr12, align 1 - %32 = insertvalue %"any*" undef, ptr %taddr12, 0 + %lshrl14 = lshr i32 %30, 1 + %31 = and i32 1, %lshrl14 + %trunc15 = trunc i32 %31 to i8 + store i8 %trunc15, ptr %taddr16, align 1 + %32 = insertvalue %"any*" undef, ptr %taddr16, 0 %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %34 = getelementptr inbounds [2 x %"any*"], ptr %varargslots10, i64 0, i64 0 - store %"any*" %33, ptr %34, align 16 + %ptradd17 = getelementptr inbounds i8, ptr %varargslots11, i64 16 + store %"any*" %33, ptr %ptradd17, align 16 + %34 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.2, i64 5, ptr %varargslots11, i64 2) %35 = load i32, ptr %f5, align 4 - %lshrl13 = lshr i32 %35, 1 - %36 = and i32 1, %lshrl13 - %trunc14 = trunc i32 %36 to i8 - store i8 %trunc14, ptr %taddr15, align 1 - %37 = insertvalue %"any*" undef, ptr %taddr15, 0 - %38 = insertvalue %"any*" %37, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %39 = getelementptr inbounds [2 x %"any*"], ptr %varargslots10, i64 0, i64 1 - store %"any*" %38, ptr %39, align 16 - %40 = call i64 @std.io.printfn(ptr %retparam16, ptr @.str.2, i64 5, ptr %varargslots10, i64 2) + %36 = load i32, ptr %f2, align 4 + %and19 = and i32 %35, %36 + store i32 %and19, ptr %f5, align 4 + %37 = load i32, ptr %f5, align 4 + %38 = and i32 1, %37 + %trunc21 = trunc i32 %38 to i8 + store i8 %trunc21, ptr %taddr22, align 1 + %39 = insertvalue %"any*" undef, ptr %taddr22, 0 + %40 = insertvalue %"any*" %39, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %40, ptr %varargslots20, align 16 %41 = load i32, ptr %f5, align 4 - %42 = load i32, ptr %f2, align 4 - %and17 = and i32 %41, %42 - store i32 %and17, ptr %f5, align 4 - %43 = load i32, ptr %f5, align 4 - %44 = and i32 1, %43 - %trunc19 = trunc i32 %44 to i8 - store i8 %trunc19, ptr %taddr20, align 1 - %45 = insertvalue %"any*" undef, ptr %taddr20, 0 - %46 = insertvalue %"any*" %45, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %47 = getelementptr inbounds [2 x %"any*"], ptr %varargslots18, i64 0, i64 0 - store %"any*" %46, ptr %47, align 16 - %48 = load i32, ptr %f5, align 4 - %lshrl21 = lshr i32 %48, 1 - %49 = and i32 1, %lshrl21 - %trunc22 = trunc i32 %49 to i8 - store i8 %trunc22, ptr %taddr23, align 1 - %50 = insertvalue %"any*" undef, ptr %taddr23, 0 - %51 = insertvalue %"any*" %50, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %52 = getelementptr inbounds [2 x %"any*"], ptr %varargslots18, i64 0, i64 1 - store %"any*" %51, ptr %52, align 16 - %53 = call i64 @std.io.printfn(ptr %retparam24, ptr @.str.3, i64 5, ptr %varargslots18, i64 2) + %lshrl23 = lshr i32 %41, 1 + %42 = and i32 1, %lshrl23 + %trunc24 = trunc i32 %42 to i8 + store i8 %trunc24, ptr %taddr25, align 1 + %43 = insertvalue %"any*" undef, ptr %taddr25, 0 + %44 = insertvalue %"any*" %43, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd26 = getelementptr inbounds i8, ptr %varargslots20, i64 16 + store %"any*" %44, ptr %ptradd26, align 16 + %45 = call i64 @std.io.printfn(ptr %retparam27, ptr @.str.3, i64 5, ptr %varargslots20, i64 2) store [13 x i8] c"\03\00\00\02\00\00\00\00\00\00\00\00\00", ptr %b1, align 1 store [13 x i8] c"\01\00\00\00\00\00\00\00\00\00\00\00\00", ptr %b2, align 1 - %54 = load i104, ptr %b1, align 1 - %55 = load i104, ptr %b2, align 1 - %and25 = and i104 %54, %55 - store i104 %and25, ptr %0, align 1 + %46 = load i104, ptr %b1, align 1 + %47 = load i104, ptr %b2, align 1 + %and28 = and i104 %46, %47 + store i104 %and28, ptr %0, align 1 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %b3, ptr align 1 %0, i32 13, i1 false) - %56 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 0 - %57 = load i8, ptr %56, align 1 - %58 = trunc i8 %57 to i1 - %59 = zext i1 %58 to i8 - store i8 %59, ptr %taddr27, align 1 - %60 = insertvalue %"any*" undef, ptr %taddr27, 0 - %61 = insertvalue %"any*" %60, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %62 = getelementptr inbounds [3 x %"any*"], ptr %varargslots26, i64 0, i64 0 - store %"any*" %61, ptr %62, align 16 - %63 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 0 - %64 = load i8, ptr %63, align 1 - %lshrl28 = lshr i8 %64, 1 - %65 = trunc i8 %lshrl28 to i1 - %66 = zext i1 %65 to i8 - store i8 %66, ptr %taddr29, align 1 - %67 = insertvalue %"any*" undef, ptr %taddr29, 0 - %68 = insertvalue %"any*" %67, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %69 = getelementptr inbounds [3 x %"any*"], ptr %varargslots26, i64 0, i64 1 - store %"any*" %68, ptr %69, align 16 - %70 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 3 - %71 = load i8, ptr %70, align 1 - %lshrl30 = lshr i8 %71, 1 - %72 = trunc i8 %lshrl30 to i1 - %73 = zext i1 %72 to i8 - store i8 %73, ptr %taddr31, align 1 - %74 = insertvalue %"any*" undef, ptr %taddr31, 0 - %75 = insertvalue %"any*" %74, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %76 = getelementptr inbounds [3 x %"any*"], ptr %varargslots26, i64 0, i64 2 - store %"any*" %75, ptr %76, align 16 - %77 = call i64 @std.io.printfn(ptr %retparam32, ptr @.str.4, i64 8, ptr %varargslots26, i64 3) - %78 = load i104, ptr %b3, align 1 - %bnot33 = xor i104 %78, -1 - store i104 %bnot33, ptr %1, align 1 + %48 = load i8, ptr %b3, align 1 + %49 = trunc i8 %48 to i1 + %50 = zext i1 %49 to i8 + store i8 %50, ptr %taddr30, align 1 + %51 = insertvalue %"any*" undef, ptr %taddr30, 0 + %52 = insertvalue %"any*" %51, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %52, ptr %varargslots29, align 16 + %53 = load i8, ptr %b3, align 1 + %lshrl31 = lshr i8 %53, 1 + %54 = trunc i8 %lshrl31 to i1 + %55 = zext i1 %54 to i8 + store i8 %55, ptr %taddr32, align 1 + %56 = insertvalue %"any*" undef, ptr %taddr32, 0 + %57 = insertvalue %"any*" %56, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd33 = getelementptr inbounds i8, ptr %varargslots29, i64 16 + store %"any*" %57, ptr %ptradd33, align 16 + %ptradd34 = getelementptr inbounds i8, ptr %b3, i64 3 + %58 = load i8, ptr %ptradd34, align 1 + %lshrl35 = lshr i8 %58, 1 + %59 = trunc i8 %lshrl35 to i1 + %60 = zext i1 %59 to i8 + store i8 %60, ptr %taddr36, align 1 + %61 = insertvalue %"any*" undef, ptr %taddr36, 0 + %62 = insertvalue %"any*" %61, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd37 = getelementptr inbounds i8, ptr %varargslots29, i64 32 + store %"any*" %62, ptr %ptradd37, align 16 + %63 = call i64 @std.io.printfn(ptr %retparam38, ptr @.str.4, i64 8, ptr %varargslots29, i64 3) + %64 = load i104, ptr %b3, align 1 + %bnot39 = xor i104 %64, -1 + store i104 %bnot39, ptr %1, align 1 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %b3, ptr align 1 %1, i32 13, i1 false) - %79 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 0 - %80 = load i8, ptr %79, align 1 - %81 = trunc i8 %80 to i1 - %82 = zext i1 %81 to i8 - store i8 %82, ptr %taddr35, align 1 - %83 = insertvalue %"any*" undef, ptr %taddr35, 0 - %84 = insertvalue %"any*" %83, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %85 = getelementptr inbounds [3 x %"any*"], ptr %varargslots34, i64 0, i64 0 - store %"any*" %84, ptr %85, align 16 - %86 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 0 - %87 = load i8, ptr %86, align 1 - %lshrl36 = lshr i8 %87, 1 - %88 = trunc i8 %lshrl36 to i1 - %89 = zext i1 %88 to i8 - store i8 %89, ptr %taddr37, align 1 - %90 = insertvalue %"any*" undef, ptr %taddr37, 0 - %91 = insertvalue %"any*" %90, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %92 = getelementptr inbounds [3 x %"any*"], ptr %varargslots34, i64 0, i64 1 - store %"any*" %91, ptr %92, align 16 - %93 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 3 - %94 = load i8, ptr %93, align 1 - %lshrl38 = lshr i8 %94, 1 - %95 = trunc i8 %lshrl38 to i1 - %96 = zext i1 %95 to i8 - store i8 %96, ptr %taddr39, align 1 - %97 = insertvalue %"any*" undef, ptr %taddr39, 0 - %98 = insertvalue %"any*" %97, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %99 = getelementptr inbounds [3 x %"any*"], ptr %varargslots34, i64 0, i64 2 - store %"any*" %98, ptr %99, align 16 - %100 = call i64 @std.io.printfn(ptr %retparam40, ptr @.str.5, i64 8, ptr %varargslots34, i64 3) - store [13 x i8] c"\03\00\00\00\00\00\00\00\00\00\00\00\00", ptr %taddr41, align 1 - %101 = load i104, ptr %b3, align 1 - %102 = load i104, ptr %taddr41, align 1 - %xor42 = xor i104 %101, %102 - store i104 %xor42, ptr %2, align 1 + %65 = load i8, ptr %b3, align 1 + %66 = trunc i8 %65 to i1 + %67 = zext i1 %66 to i8 + store i8 %67, ptr %taddr41, align 1 + %68 = insertvalue %"any*" undef, ptr %taddr41, 0 + %69 = insertvalue %"any*" %68, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %69, ptr %varargslots40, align 16 + %70 = load i8, ptr %b3, align 1 + %lshrl42 = lshr i8 %70, 1 + %71 = trunc i8 %lshrl42 to i1 + %72 = zext i1 %71 to i8 + store i8 %72, ptr %taddr43, align 1 + %73 = insertvalue %"any*" undef, ptr %taddr43, 0 + %74 = insertvalue %"any*" %73, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd44 = getelementptr inbounds i8, ptr %varargslots40, i64 16 + store %"any*" %74, ptr %ptradd44, align 16 + %ptradd45 = getelementptr inbounds i8, ptr %b3, i64 3 + %75 = load i8, ptr %ptradd45, align 1 + %lshrl46 = lshr i8 %75, 1 + %76 = trunc i8 %lshrl46 to i1 + %77 = zext i1 %76 to i8 + store i8 %77, ptr %taddr47, align 1 + %78 = insertvalue %"any*" undef, ptr %taddr47, 0 + %79 = insertvalue %"any*" %78, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd48 = getelementptr inbounds i8, ptr %varargslots40, i64 32 + store %"any*" %79, ptr %ptradd48, align 16 + %80 = call i64 @std.io.printfn(ptr %retparam49, ptr @.str.5, i64 8, ptr %varargslots40, i64 3) + store [13 x i8] c"\03\00\00\00\00\00\00\00\00\00\00\00\00", ptr %taddr50, align 1 + %81 = load i104, ptr %b3, align 1 + %82 = load i104, ptr %taddr50, align 1 + %xor51 = xor i104 %81, %82 + store i104 %xor51, ptr %2, align 1 call void @llvm.memcpy.p0.p0.i32(ptr align 1 %b3, ptr align 1 %2, i32 13, i1 false) - %103 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 0 - %104 = load i8, ptr %103, align 1 - %105 = trunc i8 %104 to i1 - %106 = zext i1 %105 to i8 - store i8 %106, ptr %taddr44, align 1 - %107 = insertvalue %"any*" undef, ptr %taddr44, 0 - %108 = insertvalue %"any*" %107, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %109 = getelementptr inbounds [3 x %"any*"], ptr %varargslots43, i64 0, i64 0 - store %"any*" %108, ptr %109, align 16 - %110 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 0 - %111 = load i8, ptr %110, align 1 - %lshrl45 = lshr i8 %111, 1 - %112 = trunc i8 %lshrl45 to i1 - %113 = zext i1 %112 to i8 - store i8 %113, ptr %taddr46, align 1 - %114 = insertvalue %"any*" undef, ptr %taddr46, 0 - %115 = insertvalue %"any*" %114, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %116 = getelementptr inbounds [3 x %"any*"], ptr %varargslots43, i64 0, i64 1 - store %"any*" %115, ptr %116, align 16 - %117 = getelementptr inbounds [13 x i8], ptr %b3, i64 0, i64 3 - %118 = load i8, ptr %117, align 1 - %lshrl47 = lshr i8 %118, 1 - %119 = trunc i8 %lshrl47 to i1 - %120 = zext i1 %119 to i8 - store i8 %120, ptr %taddr48, align 1 - %121 = insertvalue %"any*" undef, ptr %taddr48, 0 - %122 = insertvalue %"any*" %121, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %123 = getelementptr inbounds [3 x %"any*"], ptr %varargslots43, i64 0, i64 2 - store %"any*" %122, ptr %123, align 16 - %124 = call i64 @std.io.printfn(ptr %retparam49, ptr @.str.6, i64 8, ptr %varargslots43, i64 3) + %83 = load i8, ptr %b3, align 1 + %84 = trunc i8 %83 to i1 + %85 = zext i1 %84 to i8 + store i8 %85, ptr %taddr53, align 1 + %86 = insertvalue %"any*" undef, ptr %taddr53, 0 + %87 = insertvalue %"any*" %86, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %87, ptr %varargslots52, align 16 + %88 = load i8, ptr %b3, align 1 + %lshrl54 = lshr i8 %88, 1 + %89 = trunc i8 %lshrl54 to i1 + %90 = zext i1 %89 to i8 + store i8 %90, ptr %taddr55, align 1 + %91 = insertvalue %"any*" undef, ptr %taddr55, 0 + %92 = insertvalue %"any*" %91, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd56 = getelementptr inbounds i8, ptr %varargslots52, i64 16 + store %"any*" %92, ptr %ptradd56, align 16 + %ptradd57 = getelementptr inbounds i8, ptr %b3, i64 3 + %93 = load i8, ptr %ptradd57, align 1 + %lshrl58 = lshr i8 %93, 1 + %94 = trunc i8 %lshrl58 to i1 + %95 = zext i1 %94 to i8 + store i8 %95, ptr %taddr59, align 1 + %96 = insertvalue %"any*" undef, ptr %taddr59, 0 + %97 = insertvalue %"any*" %96, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + %ptradd60 = getelementptr inbounds i8, ptr %varargslots52, i64 32 + store %"any*" %97, ptr %ptradd60, align 16 + %98 = call i64 @std.io.printfn(ptr %retparam61, ptr @.str.6, i64 8, ptr %varargslots52, i64 3) ret void } diff --git a/test/test_suite/bitstruct/bitstruct_to_int.c3t b/test/test_suite/bitstruct/bitstruct_to_int.c3t index 57b201631..5cb104e55 100644 --- a/test/test_suite/bitstruct/bitstruct_to_int.c3t +++ b/test/test_suite/bitstruct/bitstruct_to_int.c3t @@ -75,7 +75,7 @@ entry: ret void } - +; Function Attrs: define void @foo.test2() #0 { entry: %b = alloca [4 x i8], align 1 @@ -94,16 +94,15 @@ entry: call void @llvm.memcpy.p0.p0.i32(ptr align 1 %y, ptr align 1 %b, i32 4, i1 false) store ptr %b, ptr %c, align 8 %1 = load ptr, ptr %c, align 8 - %2 = getelementptr inbounds [4 x i8], ptr %1, i64 0, i64 0 - %3 = load i8, ptr %2, align 1 - %zext = zext i8 %3 to i32 + %2 = load i8, ptr %1, align 1 + %zext = zext i8 %2 to i32 %lshrl = lshr i32 %zext, 1 %shl = shl i32 %lshrl, 29 %ashr = ashr i32 %shl, 29 call void (ptr, ...) @printf(ptr @.str, i32 %ashr) + %3 = load ptr, ptr %c, align 8 + store ptr %3, ptr %x2, align 8 %4 = load ptr, ptr %c, align 8 - store ptr %4, ptr %x2, align 8 - %5 = load ptr, ptr %c, align 8 - store ptr %5, ptr %y2, align 8 + store ptr %4, ptr %y2, align 8 ret void -} +} \ No newline at end of file diff --git a/test/test_suite/bitstruct/designated_initializer_with_bitstruct.c3t b/test/test_suite/bitstruct/designated_initializer_with_bitstruct.c3t index 457711632..2b18afcda 100644 --- a/test/test_suite/bitstruct/designated_initializer_with_bitstruct.c3t +++ b/test/test_suite/bitstruct/designated_initializer_with_bitstruct.c3t @@ -53,86 +53,69 @@ entry: %f = alloca ptr, align 8 %literal = alloca %Foo, align 8 %f2 = alloca ptr, align 8 - %literal1 = alloca %Foo2, align 8 + %literal2 = alloca %Foo2, align 8 %f3 = alloca ptr, align 8 - %literal2 = alloca %Foo3, align 8 + %literal6 = alloca %Foo3, align 8 %f4 = alloca ptr, align 8 - %literal3 = alloca %Foo4, align 8 + %literal11 = alloca %Foo4, align 8 store ptr null, ptr %foo, align 8 - %0 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 0 - store i16 0, ptr %0, align 8 - %1 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 1 - store ptr null, ptr %1, align 8 - %2 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 0 - %3 = load i16, ptr %2, align 8 - %4 = and i16 %3, -256 - %5 = or i16 %4, 2 - store i16 %5, ptr %2, align 8 - %6 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 1 - store ptr %f, ptr %6, align 8 + store i16 0, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 + store ptr null, ptr %ptradd, align 8 + %0 = load i16, ptr %literal, align 8 + %1 = and i16 %0, -256 + %2 = or i16 %1, 2 + store i16 %2, ptr %literal, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i64 8 + store ptr %f, ptr %ptradd1, align 8 store ptr %literal, ptr %f, align 8 - %7 = getelementptr inbounds %Foo2, ptr %literal1, i32 0, i32 0 - %8 = getelementptr inbounds [2 x i8], ptr %7, i64 0, i64 0 - store i8 0, ptr %8, align 1 - %9 = getelementptr inbounds [2 x i8], ptr %7, i64 0, i64 1 - store i8 0, ptr %9, align 1 - %10 = getelementptr inbounds %Foo2, ptr %literal1, i32 0, i32 1 - store ptr null, ptr %10, align 8 - %11 = getelementptr inbounds %Foo2, ptr %literal1, i32 0, i32 0 - %12 = getelementptr inbounds [2 x i8], ptr %11, i64 0, i64 0 - store i8 2, ptr %12, align 1 - %13 = getelementptr inbounds %Foo2, ptr %literal1, i32 0, i32 1 - store ptr %f, ptr %13, align 8 - store ptr %literal1, ptr %f2, align 8 - %14 = getelementptr inbounds %Foo3, ptr %literal2, i32 0, i32 0 - %15 = getelementptr inbounds [2 x i8], ptr %14, i64 0, i64 0 - store i8 0, ptr %15, align 1 - %16 = getelementptr inbounds [2 x i8], ptr %14, i64 0, i64 1 - store i8 0, ptr %16, align 1 - %17 = getelementptr inbounds %Foo3, ptr %literal2, i32 0, i32 1 - store ptr null, ptr %17, align 8 - %18 = getelementptr inbounds %Foo3, ptr %literal2, i32 0, i32 0 - %19 = getelementptr inbounds [2 x i8], ptr %18, i64 0, i64 0 - %20 = load i8, ptr %19, align 1 - %21 = and i8 %20, 1 - %22 = or i8 %21, 4 - store i8 %22, ptr %19, align 1 - %23 = getelementptr inbounds %Foo3, ptr %literal2, i32 0, i32 0 - %24 = getelementptr inbounds [2 x i8], ptr %23, i64 0, i64 0 - %25 = load i8, ptr %24, align 1 - %26 = and i8 %25, -2 - %27 = or i8 %26, 1 - store i8 %27, ptr %24, align 1 - %28 = getelementptr inbounds %Foo3, ptr %literal2, i32 0, i32 0 - %29 = getelementptr inbounds [2 x i8], ptr %28, i64 0, i64 1 - %30 = load i8, ptr %29, align 1 - %31 = and i8 %30, -2 - %32 = or i8 %31, 1 - store i8 %32, ptr %29, align 1 - %33 = getelementptr inbounds %Foo3, ptr %literal2, i32 0, i32 1 - store ptr %f, ptr %33, align 8 - store ptr %literal2, ptr %f3, align 8 - %34 = getelementptr inbounds %Foo4, ptr %literal3, i32 0, i32 0 - store i16 0, ptr %34, align 8 - %35 = getelementptr inbounds %Foo4, ptr %literal3, i32 0, i32 1 - store ptr null, ptr %35, align 8 - %36 = getelementptr inbounds %Foo4, ptr %literal3, i32 0, i32 0 - %37 = load i16, ptr %36, align 8 - %38 = and i16 %37, -255 - %39 = or i16 %38, 4 - store i16 %39, ptr %36, align 8 - %40 = getelementptr inbounds %Foo4, ptr %literal3, i32 0, i32 0 - %41 = load i16, ptr %40, align 8 - %42 = and i16 %41, -2 - %43 = or i16 %42, 1 - store i16 %43, ptr %40, align 8 - %44 = getelementptr inbounds %Foo4, ptr %literal3, i32 0, i32 0 - %45 = load i16, ptr %44, align 8 - %46 = and i16 %45, -257 - %47 = or i16 %46, 256 - store i16 %47, ptr %44, align 8 - %48 = getelementptr inbounds %Foo4, ptr %literal3, i32 0, i32 1 - store ptr %f, ptr %48, align 8 - store ptr %literal3, ptr %f4, align 8 + store i8 0, ptr %literal2, align 1 + %ptradd3 = getelementptr inbounds i8, ptr %literal2, i64 1 + store i8 0, ptr %ptradd3, align 1 + %ptradd4 = getelementptr inbounds i8, ptr %literal2, i64 8 + store ptr null, ptr %ptradd4, align 8 + store i8 2, ptr %literal2, align 1 + %ptradd5 = getelementptr inbounds i8, ptr %literal2, i64 8 + store ptr %f, ptr %ptradd5, align 8 + store ptr %literal2, ptr %f2, align 8 + store i8 0, ptr %literal6, align 1 + %ptradd7 = getelementptr inbounds i8, ptr %literal6, i64 1 + store i8 0, ptr %ptradd7, align 1 + %ptradd8 = getelementptr inbounds i8, ptr %literal6, i64 8 + store ptr null, ptr %ptradd8, align 8 + %3 = load i8, ptr %literal6, align 1 + %4 = and i8 %3, 1 + %5 = or i8 %4, 4 + store i8 %5, ptr %literal6, align 1 + %6 = load i8, ptr %literal6, align 1 + %7 = and i8 %6, -2 + %8 = or i8 %7, 1 + store i8 %8, ptr %literal6, align 1 + %ptradd9 = getelementptr inbounds i8, ptr %literal6, i64 1 + %9 = load i8, ptr %ptradd9, align 1 + %10 = and i8 %9, -2 + %11 = or i8 %10, 1 + store i8 %11, ptr %ptradd9, align 1 + %ptradd10 = getelementptr inbounds i8, ptr %literal6, i64 8 + store ptr %f, ptr %ptradd10, align 8 + store ptr %literal6, ptr %f3, align 8 + store i16 0, ptr %literal11, align 8 + %ptradd12 = getelementptr inbounds i8, ptr %literal11, i64 8 + store ptr null, ptr %ptradd12, align 8 + %12 = load i16, ptr %literal11, align 8 + %13 = and i16 %12, -255 + %14 = or i16 %13, 4 + store i16 %14, ptr %literal11, align 8 + %15 = load i16, ptr %literal11, align 8 + %16 = and i16 %15, -2 + %17 = or i16 %16, 1 + store i16 %17, ptr %literal11, align 8 + %18 = load i16, ptr %literal11, align 8 + %19 = and i16 %18, -257 + %20 = or i16 %19, 256 + store i16 %20, ptr %literal11, align 8 + %ptradd13 = getelementptr inbounds i8, ptr %literal11, i64 8 + store ptr %f, ptr %ptradd13, align 8 + store ptr %literal11, ptr %f4, align 8 ret void } diff --git a/test/test_suite/bitstruct/embedded_bitstruct.c3t b/test/test_suite/bitstruct/embedded_bitstruct.c3t index b68ba7a55..6ddc713f9 100644 --- a/test/test_suite/bitstruct/embedded_bitstruct.c3t +++ b/test/test_suite/bitstruct/embedded_bitstruct.c3t @@ -50,29 +50,21 @@ entry: %b = alloca %Bar, align 4 %f = alloca %Foo, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %b, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 1 - %1 = getelementptr inbounds %.anon, ptr %0, i32 0, i32 0 - %2 = getelementptr inbounds %.anon.0, ptr %1, i32 0, i32 0 - %3 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 2 - %4 = load i32, ptr %3, align 4 - %shl = shl i32 %4, 21 + %ptradd = getelementptr inbounds i8, ptr %b, i64 4 + %ptradd1 = getelementptr inbounds i8, ptr %b, i64 8 + %0 = load i32, ptr %ptradd1, align 4 + %shl = shl i32 %0, 21 %ashr = ashr i32 %shl, 23 - %5 = load i32, ptr %2, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %5, i32 %ashr) + %1 = load i32, ptr %ptradd, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %1, i32 %ashr) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %f, ptr align 4 @.__const.10, i32 16, i1 false) - %6 = getelementptr inbounds %Foo, ptr %f, i32 0, i32 0 - %7 = getelementptr inbounds %.anon.1, ptr %6, i32 0, i32 0 - %8 = getelementptr inbounds %.anon.2, ptr %7, i32 0, i32 0 - %9 = getelementptr inbounds %Foo, ptr %f, i32 0, i32 0 - %10 = getelementptr inbounds %.anon.1, ptr %9, i32 0, i32 1 - %11 = getelementptr inbounds %.anon.3, ptr %10, i32 0, i32 0 - %12 = getelementptr inbounds %Foo, ptr %f, i32 0, i32 0 - %13 = getelementptr inbounds %.anon.1, ptr %12, i32 0, i32 2 - %14 = getelementptr inbounds %Foo, ptr %f, i32 0, i32 1 - %15 = load i32, ptr %8, align 4 - %16 = load i32, ptr %11, align 4 - %17 = load i32, ptr %13, align 4 - %18 = load i32, ptr %14, align 4 - call void (ptr, ...) @printf(ptr @.str.11, i32 %15, i32 %16, i32 %17, i32 %18) + %ptradd2 = getelementptr inbounds i8, ptr %f, i64 4 + %ptradd3 = getelementptr inbounds i8, ptr %f, i64 8 + %ptradd4 = getelementptr inbounds i8, ptr %f, i64 12 + %2 = load i32, ptr %f, align 4 + %3 = load i32, ptr %ptradd2, align 4 + %4 = load i32, ptr %ptradd3, align 4 + %5 = load i32, ptr %ptradd4, align 4 + call void (ptr, ...) @printf(ptr @.str.11, i32 %2, i32 %3, i32 %4, i32 %5) ret void } diff --git a/test/test_suite/builtins/shufflevector.c3t b/test/test_suite/builtins/shufflevector.c3t index 2a9f09993..c883e7882 100644 --- a/test/test_suite/builtins/shufflevector.c3t +++ b/test/test_suite/builtins/shufflevector.c3t @@ -64,33 +64,27 @@ entry: %flip = alloca <2 x float>, align 8 %taddr = alloca <2 x float>, align 8 store double %1, ptr %vec, align 8 - %2 = getelementptr inbounds %Matrix2x2, ptr %0, i32 0, i32 0 - %3 = getelementptr inbounds %.anon.1, ptr %2, i32 0, i32 0 - %4 = load <2 x float>, ptr %3, align 16 - %5 = getelementptr inbounds %Matrix2x2, ptr %0, i32 0, i32 0 - %6 = getelementptr inbounds %.anon.1, ptr %5, i32 0, i32 1 - %7 = load <2 x float>, ptr %6, align 8 - %shuffle = shufflevector <2 x float> %4, <2 x float> %7, <2 x i32> + %2 = load <2 x float>, ptr %0, align 16 + %ptradd = getelementptr inbounds i8, ptr %0, i64 8 + %3 = load <2 x float>, ptr %ptradd, align 8 + %shuffle = shufflevector <2 x float> %2, <2 x float> %3, <2 x i32> store <2 x float> %shuffle, ptr %a, align 8 - %8 = getelementptr inbounds %Matrix2x2, ptr %0, i32 0, i32 0 - %9 = getelementptr inbounds %.anon.1, ptr %8, i32 0, i32 0 - %10 = load <2 x float>, ptr %9, align 16 - %11 = getelementptr inbounds %Matrix2x2, ptr %0, i32 0, i32 0 - %12 = getelementptr inbounds %.anon.1, ptr %11, i32 0, i32 1 - %13 = load <2 x float>, ptr %12, align 8 - %shuffle1 = shufflevector <2 x float> %10, <2 x float> %13, <2 x i32> - store <2 x float> %shuffle1, ptr %b, align 8 - %14 = load <2 x float>, ptr %vec, align 8 - %shuffle2 = shufflevector <2 x float> %14, <2 x float> poison, <2 x i32> - store <2 x float> %shuffle2, ptr %flip, align 8 - %15 = load <2 x float>, ptr %a, align 8 - %16 = load <2 x float>, ptr %vec, align 8 - %fmul = fmul <2 x float> %15, %16 - %17 = load <2 x float>, ptr %b, align 8 - %18 = load <2 x float>, ptr %flip, align 8 - %fmul3 = fmul <2 x float> %17, %18 - %fadd = fadd <2 x float> %fmul, %fmul3 + %4 = load <2 x float>, ptr %0, align 16 + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 8 + %5 = load <2 x float>, ptr %ptradd1, align 8 + %shuffle2 = shufflevector <2 x float> %4, <2 x float> %5, <2 x i32> + store <2 x float> %shuffle2, ptr %b, align 8 + %6 = load <2 x float>, ptr %vec, align 8 + %shuffle3 = shufflevector <2 x float> %6, <2 x float> poison, <2 x i32> + store <2 x float> %shuffle3, ptr %flip, align 8 + %7 = load <2 x float>, ptr %a, align 8 + %8 = load <2 x float>, ptr %vec, align 8 + %fmul = fmul <2 x float> %7, %8 + %9 = load <2 x float>, ptr %b, align 8 + %10 = load <2 x float>, ptr %flip, align 8 + %fmul4 = fmul <2 x float> %9, %10 + %fadd = fadd <2 x float> %fmul, %fmul4 store <2 x float> %fadd, ptr %taddr, align 8 - %19 = load double, ptr %taddr, align 8 - ret double %19 + %11 = load double, ptr %taddr, align 8 + ret double %11 } \ No newline at end of file diff --git a/test/test_suite/builtins/simple_builtins.c3t b/test/test_suite/builtins/simple_builtins.c3t index 3974480e4..b0e59e0f3 100644 --- a/test/test_suite/builtins/simple_builtins.c3t +++ b/test/test_suite/builtins/simple_builtins.c3t @@ -40,23 +40,22 @@ entry: %7 = call double @llvm.fmuladd.f64(double %6, double 2.000000e+00, double 3.000000e+00) store double %7, ptr %m, align 8 store i32 13, ptr %xeb, align 4 - %8 = getelementptr inbounds [3 x i32], ptr %abcd, i64 0, i64 0 - store i32 0, ptr %8, align 4 - %9 = getelementptr inbounds [3 x i32], ptr %abcd, i64 0, i64 1 - store i32 0, ptr %9, align 4 - %10 = getelementptr inbounds [3 x i32], ptr %abcd, i64 0, i64 2 - store i32 0, ptr %10, align 4 - %11 = load volatile i32, ptr %xeb, align 4 - store i32 %11, ptr %sy, align 4 - %12 = load i32, ptr %sy, align 4 - %add = add i32 %12, 1 + store i32 0, ptr %abcd, align 4 + %ptradd = getelementptr inbounds i8, ptr %abcd, i64 4 + store i32 0, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %abcd, i64 8 + store i32 0, ptr %ptradd1, align 4 + %8 = load volatile i32, ptr %xeb, align 4 + store i32 %8, ptr %sy, align 4 + %9 = load i32, ptr %sy, align 4 + %add = add i32 %9, 1 store volatile i32 %add, ptr %xeb, align 4 - %13 = getelementptr inbounds [3 x i32], ptr %abcd, i64 0, i64 2 - %14 = load i32, ptr %sy, align 4 - %add1 = add i32 %14, 2 - store volatile i32 %add1, ptr %13, align 4 - %15 = getelementptr inbounds [3 x i32], ptr %abcd, i64 0, i64 2 - %16 = load volatile i32, ptr %15, align 4 - store i32 %16, ptr %sy, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %abcd, i64 8 + %10 = load i32, ptr %sy, align 4 + %add3 = add i32 %10, 2 + store volatile i32 %add3, ptr %ptradd2, align 4 + %ptradd4 = getelementptr inbounds i8, ptr %abcd, i64 8 + %11 = load volatile i32, ptr %ptradd4, align 4 + store i32 %11, ptr %sy, align 4 ret i32 1 } diff --git a/test/test_suite/cast/implicit_infer_len_cast.c3t b/test/test_suite/cast/implicit_infer_len_cast.c3t index 1aa969b37..39eee4cc6 100644 --- a/test/test_suite/cast/implicit_infer_len_cast.c3t +++ b/test/test_suite/cast/implicit_infer_len_cast.c3t @@ -35,12 +35,11 @@ fn void main() %0 = insertvalue %"int[<2>][]" undef, ptr %literal, 0 %1 = insertvalue %"int[<2>][]" %0, i64 1, 1 store %"int[<2>][]" %1, ptr %aa, align 8 - %2 = getelementptr inbounds [1 x %"int[]"], ptr %bb, i64 0, i64 0 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.3, i32 8, i1 false) - %3 = insertvalue %"int[]" undef, ptr %literal1, 0 - %4 = insertvalue %"int[]" %3, i64 2, 1 - store %"int[]" %4, ptr %2, align 16 + %2 = insertvalue %"int[]" undef, ptr %literal1, 0 + %3 = insertvalue %"int[]" %2, i64 2, 1 + store %"int[]" %3, ptr %bb, align 16 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %z2, ptr align 4 %x, i32 16, i1 false) - %5 = getelementptr inbounds [2 x [2 x i32]], ptr %z2, i64 0, i64 1 - %6 = getelementptr inbounds [2 x i32], ptr %5, i64 0, i64 1 + %ptradd = getelementptr inbounds i8, ptr %z2, i64 8 + %ptradd3 = getelementptr inbounds i8, ptr %ptradd, i64 4 ret void diff --git a/test/test_suite/clang/2002-01_02.c3t b/test/test_suite/clang/2002-01_02.c3t index 3e9f42934..754ce90f8 100644 --- a/test/test_suite/clang/2002-01_02.c3t +++ b/test/test_suite/clang/2002-01_02.c3t @@ -135,7 +135,6 @@ void *[*] data = { &afoo, &abar, &axx }; %Foo = type { i32, i32 } %Foostruct = type { i16 } -%Edge_rec = type { ptr, ptr, i32, i32 } %Test = type { i16, i16, i32, i32 } %STest2 = type { i32, [4 x i16], double } @@ -148,21 +147,26 @@ void *[*] data = { &afoo, &abar, &axx }; @test.data = local_unnamed_addr global [3 x ptr] [ptr @test.afoo, ptr @test.abar, ptr @test.axx], align 16 @.str.6 = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1 +; Function Attrs: define void @test.foo() #0 { entry: ret void } +; Function Attrs: declare ptr @dlclose(ptr) #0 +; Function Attrs: define void @test.ap_os_dso_unload(ptr %0) #0 { entry: %1 = call ptr @dlclose(ptr %0) ret void } +; Function Attrs: declare void @foo2(i32, double, float) #0 +; Function Attrs: define void @test.bar(i32 %0) #0 { entry: %intbool = icmp ne i32 %0, 0 @@ -171,8 +175,10 @@ entry: ret void } +; Function Attrs: declare i32 @tolower(i32) #0 +; Function Attrs: define ptr @test.rangematch(ptr %0, i32 %1, i32 %2) #0 { entry: %le = icmp sle i32 %2, %1 @@ -183,14 +189,18 @@ entry: %le1 = icmp sle i32 %3, %4 %or = or i1 %le, %le1 br i1 %or, label %if.then, label %if.exit + if.then: ; preds = %entry ret ptr null + if.exit: ; preds = %entry ret ptr %0 } +; Function Attrs: declare i32 @foo3(i16) #0 +; Function Attrs: define void @test.teste2() #0 { entry: %xqic = alloca %Foostruct, align 2 @@ -200,7 +210,7 @@ entry: ret void } - +; Function Attrs: define i32 @test.do_merge(ptr %0, ptr %1) #0 { entry: %lvalid = alloca i32, align 4 @@ -210,27 +220,33 @@ entry: store ptr null, ptr %basel, align 8 store ptr null, ptr %rcand, align 8 br label %loop.body + loop.body: ; preds = %if.exit, %entry %2 = load i32, ptr %lvalid, align 4 %not = icmp eq i32 %2, 0 br i1 %not, label %if.then, label %if.exit + if.then: ; preds = %loop.body %3 = load ptr, ptr %basel, align 8 - %4 = getelementptr inbounds %Edge_rec, ptr %3, i32 0, i32 1 - %5 = load ptr, ptr %4, align 8 - %ptrxi = ptrtoint ptr %5 to i32 + %ptradd = getelementptr inbounds i8, ptr %3, i64 8 + %4 = load ptr, ptr %ptradd, align 8 + %ptrxi = ptrtoint ptr %4 to i32 ret i32 %ptrxi + if.exit: ; preds = %loop.body br label %loop.body } +; Function Attrs: define i32 @test.test(i32 %0) #0 { entry: ret i32 %0 } +; Function Attrs: declare void @abc(ptr) #0 +; Function Attrs: define i32 @test.deff(i32 %0, i32 %1) #0 { entry: %z = alloca i32, align 4 @@ -239,88 +255,96 @@ entry: ret i32 %0 } +; Function Attrs: define i32 @test.testing(ptr %0) #0 { entry: - %1 = getelementptr inbounds %Test, ptr %0, i32 0, i32 1 - %2 = load i16, ptr %1, align 2 - %sext = sext i16 %2 to i32 - %3 = getelementptr inbounds %Test, ptr %0, i32 0, i32 2 - %4 = load i32, ptr %3, align 4 - %add = add i32 %sext, %4 + %ptradd = getelementptr inbounds i8, ptr %0, i64 2 + %1 = load i16, ptr %ptradd, align 2 + %sext = sext i16 %1 to i32 + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 4 + %2 = load i32, ptr %ptradd1, align 4 + %add = add i32 %sext, %2 ret i32 %add } +; Function Attrs: define i32 @test.test2(i32 %0, i64 %1, i32 %2, i32 %3) #0 { entry: %a = alloca %Test, align 8 store i64 %1, ptr %a, align 8 - %ptroffset = getelementptr inbounds i32, ptr %a, i64 2 - store i32 %2, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 + store i32 %2, ptr %ptradd, align 8 %add = add i32 %0, %3 - %4 = getelementptr inbounds %Test, ptr %a, i32 0, i32 1 - %5 = load i16, ptr %4, align 2 - %sext = sext i16 %5 to i32 - %add1 = add i32 %add, %sext - %6 = getelementptr inbounds %Test, ptr %a, i32 0, i32 2 - %7 = load i32, ptr %6, align 4 - %add2 = add i32 %add1, %7 - ret i32 %add2 + %ptradd1 = getelementptr inbounds i8, ptr %a, i64 2 + %4 = load i16, ptr %ptradd1, align 2 + %sext = sext i16 %4 to i32 + %add2 = add i32 %add, %sext + %ptradd3 = getelementptr inbounds i8, ptr %a, i64 4 + %5 = load i32, ptr %ptradd3, align 4 + %add4 = add i32 %add2, %5 + ret i32 %add4 } +; Function Attrs: define i32 @test.test3(i64 %0, i32 %1, i64 %2, i32 %3) #0 { entry: %a = alloca %Test, align 8 %b = alloca %Test, align 8 store i64 %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i32, ptr %a, i64 2 - store i32 %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 + store i32 %1, ptr %ptradd, align 8 store i64 %2, ptr %b, align 8 - %ptroffset1 = getelementptr inbounds i32, ptr %b, i64 2 - store i32 %3, ptr %ptroffset1, align 8 - %4 = getelementptr inbounds %Test, ptr %a, i32 0, i32 1 - %5 = load i16, ptr %4, align 2 - %sext = sext i16 %5 to i32 - %6 = getelementptr inbounds %Test, ptr %a, i32 0, i32 2 - %7 = load i32, ptr %6, align 4 - %add = add i32 %sext, %7 - %8 = getelementptr inbounds %Test, ptr %b, i32 0, i32 2 - %9 = load i32, ptr %8, align 4 - %add2 = add i32 %add, %9 - %10 = getelementptr inbounds %Test, ptr %b, i32 0, i32 3 - %11 = load i32, ptr %10, align 8 - %add3 = add i32 %add2, %11 - ret i32 %add3 -} - + %ptradd1 = getelementptr inbounds i8, ptr %b, i64 8 + store i32 %3, ptr %ptradd1, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %a, i64 2 + %4 = load i16, ptr %ptradd2, align 2 + %sext = sext i16 %4 to i32 + %ptradd3 = getelementptr inbounds i8, ptr %a, i64 4 + %5 = load i32, ptr %ptradd3, align 4 + %add = add i32 %sext, %5 + %ptradd4 = getelementptr inbounds i8, ptr %b, i64 4 + %6 = load i32, ptr %ptradd4, align 4 + %add5 = add i32 %add, %6 + %ptradd6 = getelementptr inbounds i8, ptr %b, i64 8 + %7 = load i32, ptr %ptradd6, align 8 + %add7 = add i32 %add5, %7 + ret i32 %add7 +} + +; Function Attrs: define { i64, i32 } @test.test4(i64 %0, i32 %1) #0 { entry: %a = alloca %Test, align 8 %tempcoerce = alloca { i64, i32 }, align 8 store i64 %0, ptr %a, align 8 - %ptroffset = getelementptr inbounds i32, ptr %a, i64 2 - store i32 %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %a, i64 8 + store i32 %1, ptr %ptradd, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tempcoerce, ptr align 8 %a, i32 12, i1 false) %2 = load { i64, i32 }, ptr %tempcoerce, align 8 ret { i64, i32 } %2 } +; Function Attrs: define i32 @test.test6() #0 { entry: %b = alloca [200 x i32], align 16 call void @llvm.memset.p0.i64(ptr align 16 %b, i8 0, i64 800, i1 false) - %0 = getelementptr inbounds [200 x i32], ptr %b, i64 0, i64 4 - %1 = load i32, ptr %0, align 4 - ret i32 %1 + %ptradd = getelementptr inbounds i8, ptr %b, i64 16 + %0 = load i32, ptr %ptradd, align 4 + ret i32 %0 } +; Function Attrs: define void @test.test7(ptr noalias sret(%STest2) align 8 %0, ptr byval(%STest2) align 8 %1) #0 { entry: call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %1, i32 24, i1 false) ret void } +; Function Attrs: declare i32 @printf(ptr, ...) #0 +; Function Attrs: define i32 @test.main2() #0 { entry: %v = alloca i64, align 8 diff --git a/test/test_suite/clang/2002-04.c3t b/test/test_suite/clang/2002-04.c3t index 261ab71a4..c66fdb82d 100644 --- a/test/test_suite/clang/2002-04.c3t +++ b/test/test_suite/clang/2002-04.c3t @@ -110,14 +110,15 @@ loop.exit: ; preds = %loop.cond ret i32 0 } +; Function Attrs: define double @test.test(i32 %0) #0 { entry: %student_t = alloca [30 x double], align 16 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %student_t, ptr align 16 @.__const, i32 240, i1 false) %zext = zext i32 %0 to i64 - %1 = getelementptr inbounds [30 x double], ptr %student_t, i64 0, i64 %zext - %2 = load double, ptr %1, align 8 - ret double %2 + %ptroffset = getelementptr inbounds [8 x i8], ptr %student_t, i64 %zext + %1 = load double, ptr %ptroffset, align 8 + ret double %1 } define void @test.loop() #0 { @@ -128,37 +129,40 @@ entry: ret void } +; Function Attrs: declare i32 @testF(ptr byval(%FooSt) align 8, float) #0 +; Function Attrs: declare i32 @testE(i8 zeroext, i16 signext, i8 zeroext, i32, i32, float) #0 +; Function Attrs: define void @test.test3(ptr %0) #0 { entry: - %1 = getelementptr inbounds %FooSt, ptr %0, i32 0, i32 1 - store i16 1, ptr %1, align 2 + %ptradd = getelementptr inbounds i8, ptr %0, i64 2 + store i16 1, ptr %ptradd, align 2 ret void } +; Function Attrs: define void @test.test2(ptr byval(%FooSt) align 8 %0) #0 { entry: %indirectarg = alloca %FooSt, align 8 - %indirectarg1 = alloca %FooSt, align 8 - %1 = getelementptr inbounds %FooSt, ptr %0, i32 0, i32 0 - %2 = getelementptr inbounds %FooSt, ptr %0, i32 0, i32 1 - %3 = getelementptr inbounds %FooSt, ptr %0, i32 0, i32 2 - %4 = getelementptr inbounds %FooSt, ptr %0, i32 0, i32 3 - %5 = getelementptr inbounds %FooSt, ptr %0, i32 0, i32 4 - %6 = load i16, ptr %5, align 4 - %sext = sext i16 %6 to i32 - %7 = load i8, ptr %1, align 4 - %8 = load i16, ptr %2, align 2 - %9 = load i8, ptr %3, align 4 - %10 = load i32, ptr %4, align 4 - %11 = call i32 @testE(i8 zeroext %7, i16 signext %8, i8 zeroext %9, i32 %10, i32 %sext, float 0x3FB99999A0000000) + %indirectarg4 = alloca %FooSt, align 8 + %ptradd = getelementptr inbounds i8, ptr %0, i64 2 + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 4 + %ptradd2 = getelementptr inbounds i8, ptr %0, i64 8 + %ptradd3 = getelementptr inbounds i8, ptr %0, i64 12 + %1 = load i16, ptr %ptradd3, align 4 + %sext = sext i16 %1 to i32 + %2 = load i8, ptr %0, align 4 + %3 = load i16, ptr %ptradd, align 2 + %4 = load i8, ptr %ptradd1, align 4 + %5 = load i32, ptr %ptradd2, align 4 + %6 = call i32 @testE(i8 zeroext %2, i16 signext %3, i8 zeroext %4, i32 %5, i32 %sext, float 0x3FB99999A0000000) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg, ptr align 4 %0, i32 20, i1 false) - %12 = call i32 @testF(ptr byval(%FooSt) align 8 %indirectarg, float 0x3FB99999A0000000) - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg1, ptr align 4 %0, i32 20, i1 false) - call void @test.test2(ptr byval(%FooSt) align 8 %indirectarg1) + %7 = call i32 @testF(ptr byval(%FooSt) align 8 %indirectarg, float 0x3FB99999A0000000) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg4, ptr align 4 %0, i32 20, i1 false) + call void @test.test2(ptr byval(%FooSt) align 8 %indirectarg4) call void @test.test3(ptr %0) ret void } diff --git a/test/test_suite/clang/2002-07.c3t b/test/test_suite/clang/2002-07.c3t index cd1e20a66..86a4cb1c4 100644 --- a/test/test_suite/clang/2002-07.c3t +++ b/test/test_suite/clang/2002-07.c3t @@ -295,7 +295,17 @@ fn int strcmp(char *s1, char *s2) { /* #expect: foo.ll - +%.introspect = type { i8, i64, ptr, i64, i64, i64, [0 x i64] } +%List = type { i32, ptr } +%Quad = type { i32, %SubStruct, ptr, i8, i32 } +%SubStruct = type { i16, i16 } +%PBVTest = type { double, double, i32 } + +@"$ct.foo.List" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 16, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 +@"$ct.foo.PBVTest" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 24, i64 0, i64 3, [0 x i64] zeroinitializer }, align 8 +@"$ct.foo.FunStructTest" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 64, i64 0, i64 3, [0 x i64] zeroinitializer }, align 8 +@"$ct.foo.SubStruct" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 4, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 +@"$ct.foo.Quad" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 24, i64 0, i64 5, [0 x i64] zeroinitializer }, align 8 @foo.data = local_unnamed_addr global ptr null, align 8 @foo.listNode3 = global %List { i32 4, ptr null }, align 8 @foo.listNode2 = global %List { i32 3, ptr @foo.listNode3 }, align 8 @@ -307,12 +317,19 @@ fn int strcmp(char *s1, char *s2) { @foo.ext = local_unnamed_addr global ptr null, align 8 @foo.globalQuad = local_unnamed_addr global %Quad { i32 4, %SubStruct { i16 1, i16 2 }, ptr null, i8 3, i32 156 }, align 8 @foo.foo.10 = internal unnamed_addr global i32 0, align 4 +@.str = private unnamed_addr constant [7 x i8] c"\00", align 1 +@.str.11 = private unnamed_addr constant [14 x i8] c"Hello world!\0A\00", align 1 + +; Function Attrs: +declare ptr @malloc(i32) #0 +; Function Attrs: define ptr @foo.passThroughList(ptr %0) #0 { entry: ret ptr %0 } +; Function Attrs: define void @foo.foo() #0 { entry: %0 = load i32, ptr @foo.foo.10, align 4 @@ -323,6 +340,7 @@ entry: ret void } +; Function Attrs: define void @foo.insertIntoListTail(ptr %0, i32 %1) #0 { entry: %l = alloca ptr, align 8 @@ -338,25 +356,25 @@ loop.cond: ; preds = %loop.body, %entry loop.body: ; preds = %loop.cond %4 = load ptr, ptr %l, align 8 %5 = load ptr, ptr %4, align 8 - %6 = getelementptr inbounds %List, ptr %5, i32 0, i32 1 - store ptr %6, ptr %l, align 8 + %ptradd = getelementptr inbounds i8, ptr %5, i64 8 + store ptr %ptradd, ptr %l, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond - %7 = load ptr, ptr %l, align 8 - %8 = call ptr @malloc(i32 16) - store ptr %8, ptr %7, align 8 - %9 = load ptr, ptr %l, align 8 - %10 = load ptr, ptr %9, align 8 - %11 = getelementptr inbounds %List, ptr %10, i32 0, i32 0 - store i32 %1, ptr %11, align 8 - %12 = load ptr, ptr %l, align 8 - %13 = load ptr, ptr %12, align 8 - %14 = getelementptr inbounds %List, ptr %13, i32 0, i32 1 - store ptr null, ptr %14, align 8 + %6 = load ptr, ptr %l, align 8 + %7 = call ptr @malloc(i32 16) + store ptr %7, ptr %6, align 8 + %8 = load ptr, ptr %l, align 8 + %9 = load ptr, ptr %8, align 8 + store i32 %1, ptr %9, align 8 + %10 = load ptr, ptr %l, align 8 + %11 = load ptr, ptr %10, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %11, i64 8 + store ptr null, ptr %ptradd1, align 8 ret void } +; Function Attrs: define ptr @foo.findData(ptr %0, i32 %1) #0 { entry: %not = icmp eq ptr %0, null @@ -366,21 +384,24 @@ if.then: ; preds = %entry ret ptr null if.exit: ; preds = %entry - %2 = getelementptr inbounds %List, ptr %0, i32 0, i32 0 - %3 = load i32, ptr %2, align 8 - %eq = icmp eq i32 %3, %1 + %2 = load i32, ptr %0, align 8 + %eq = icmp eq i32 %2, %1 br i1 %eq, label %if.then1, label %if.exit2 if.then1: ; preds = %if.exit ret ptr %0 if.exit2: ; preds = %if.exit - %4 = getelementptr inbounds %List, ptr %0, i32 0, i32 1 - %5 = load ptr, ptr %4, align 8 - %6 = call ptr @foo.findData(ptr %5, i32 %1) - ret ptr %6 + %ptradd = getelementptr inbounds i8, ptr %0, i64 8 + %3 = load ptr, ptr %ptradd, align 8 + %4 = call ptr @foo.findData(ptr %3, i32 %1) + ret ptr %4 } +; Function Attrs: +declare void @foundIt() #0 + +; Function Attrs: define void @foo.doListStuff() #0 { entry: %myList = alloca ptr, align 8 @@ -423,6 +444,7 @@ if.exit6: ; preds = %if.then5, %if.exit3 ret void } +; Function Attrs: define i32 @foo.floatcomptest(ptr %0, ptr %1, ptr %2, ptr %3) #0 { entry: %4 = load double, ptr %0, align 8 @@ -442,6 +464,7 @@ or.phi: ; preds = %or.rhs, %entry ret i32 %boolsi } +; Function Attrs: define ptr @foo.memset_impl(ptr %0, i32 %1, i32 %2) #0 { entry: %len = alloca i32, align 4 @@ -460,9 +483,8 @@ loop.cond: ; preds = %loop.body, %entry loop.body: ; preds = %loop.cond %4 = load i64, ptr %dstp, align 8 %intptr = inttoptr i64 %4 to ptr - %ptroffset = getelementptr inbounds i8, ptr %intptr, i64 0 %trunc = trunc i32 %1 to i8 - store i8 %trunc, ptr %ptroffset, align 1 + store i8 %trunc, ptr %intptr, align 1 %5 = load i64, ptr %dstp, align 8 %add = add i64 %5, 1 store i64 %add, ptr %dstp, align 8 @@ -475,6 +497,7 @@ loop.exit: ; preds = %loop.cond ret ptr %0 } +; Function Attrs: define internal ptr @foo.localmalloc(i32 %0) #0 { entry: %blah = alloca ptr, align 8 @@ -494,34 +517,41 @@ if.exit: ; preds = %entry ret ptr null } +; Function Attrs: define void @foo.testRetStruct(ptr noalias sret(%PBVTest) align 8 %0, float %1, double %2, i32 %3) #0 { entry: %t = alloca %PBVTest, align 8 - %4 = getelementptr inbounds %PBVTest, ptr %t, i32 0, i32 0 %fpfpext = fpext float %1 to double - store double %fpfpext, ptr %4, align 8 - %5 = getelementptr inbounds %PBVTest, ptr %t, i32 0, i32 1 - store double %2, ptr %5, align 8 - %6 = getelementptr inbounds %PBVTest, ptr %t, i32 0, i32 2 - store i32 %3, ptr %6, align 8 + store double %fpfpext, ptr %t, align 8 + %ptradd = getelementptr inbounds i8, ptr %t, i64 8 + store double %2, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %t, i64 16 + store i32 %3, ptr %ptradd1, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %t, i32 24, i1 false) ret void } +; Function Attrs: +declare void @testRetStruct2(ptr noalias sret(%PBVTest) align 8) #0 + +; Function Attrs: define double @foo.callRetStruct(float %0, double %1, i32 %2) #0 { entry: %t = alloca %PBVTest, align 8 call void @testRetStruct2(ptr sret(%PBVTest) align 8 %t) - %3 = getelementptr inbounds %PBVTest, ptr %t, i32 0, i32 0 - %4 = load double, ptr %3, align 8 + %3 = load double, ptr %t, align 8 %fpfpext = fpext float %0 to double - %fadd = fadd double %4, %fpfpext + %fadd = fadd double %3, %fpfpext %fadd1 = fadd double %fadd, %1 %sifp = sitofp i32 %2 to double %fadd2 = fadd double %fadd1, %sifp ret double %fadd2 } +; Function Attrs: +declare i32 @fp(i32, ptr) #0 + +; Function Attrs: define void @foo.__bb_exit_func() #0 { entry: %0 = load ptr, ptr @foo.ext, align 8 @@ -541,22 +571,34 @@ cond.phi: ; preds = %cond.rhs, %cond.lhs ret void } +; Function Attrs: +declare i32 @puts(ptr) #0 + +; Function Attrs: define i32 @foo.ptrFunc(ptr %0, i32 %1) #0 { entry: %2 = call i32 %0(i32 %1) ret i32 %2 } +; Function Attrs: define zeroext i8 @foo.ptrFunc2(ptr byval([30 x ptr]) align 8 %0, i32 %1) #0 { entry: %sext = sext i32 %1 to i64 - %2 = getelementptr inbounds [30 x ptr], ptr %0, i64 0, i64 %sext - %3 = load ptr, ptr %2, align 8 - %4 = call i32 %3(i32 98) - %trunc = trunc i32 %4 to i8 + %ptroffset = getelementptr inbounds [8 x i8], ptr %0, i64 %sext + %2 = load ptr, ptr %ptroffset, align 8 + %3 = call i32 %2(i32 98) + %trunc = trunc i32 %3 to i8 ret i8 %trunc } +; Function Attrs: +declare zeroext i8 @smallArgs2(i8 zeroext, i8 zeroext, i64, i8 zeroext, i8 zeroext) #0 + +; Function Attrs: +declare i32 @someFuncA() #0 + +; Function Attrs: define zeroext i8 @foo.smallArgs(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8 zeroext %3) #0 { entry: %4 = call i32 @someFuncA() @@ -571,6 +613,7 @@ entry: ret i8 %5 } +; Function Attrs: define internal i32 @foo.f0(ptr byval(%Quad) align 8 %0, i32 %1) #0 { entry: %r = alloca %Quad, align 8 @@ -578,80 +621,88 @@ entry: br i1 %intbool, label %if.then, label %if.exit if.then: ; preds = %entry - %2 = getelementptr inbounds %Quad, ptr %r, i32 0, i32 1 - %3 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 1 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %2, ptr align 4 %3, i32 4, i1 false) + %ptradd = getelementptr inbounds i8, ptr %r, i64 4 + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd, ptr align 4 %ptradd1, i32 4, i1 false) br label %if.exit if.exit: ; preds = %if.then, %entry - %4 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 2 - %5 = getelementptr inbounds %Quad, ptr %r, i32 0, i32 1 - store ptr %5, ptr %4, align 8 - %6 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 0 - %7 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 4 - %8 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 3 - store i8 1, ptr %8, align 8 - store i32 1, ptr %7, align 4 - store i32 1, ptr %6, align 8 - %9 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 1 - %10 = getelementptr inbounds %SubStruct, ptr %9, i32 0, i32 1 - %11 = load i16, ptr %10, align 2 - %sext = sext i16 %11 to i32 + %ptradd2 = getelementptr inbounds i8, ptr %0, i64 8 + %ptradd3 = getelementptr inbounds i8, ptr %r, i64 4 + store ptr %ptradd3, ptr %ptradd2, align 8 + %ptradd4 = getelementptr inbounds i8, ptr %0, i64 20 + %ptradd5 = getelementptr inbounds i8, ptr %0, i64 16 + store i8 1, ptr %ptradd5, align 8 + store i32 1, ptr %ptradd4, align 4 + store i32 1, ptr %0, align 8 + %ptradd6 = getelementptr inbounds i8, ptr %0, i64 4 + %ptradd7 = getelementptr inbounds i8, ptr %ptradd6, i64 2 + %2 = load i16, ptr %ptradd7, align 2 + %sext = sext i16 %2 to i32 %add = add i32 %sext, %1 - %12 = getelementptr inbounds %Quad, ptr %r, i32 0, i32 4 - %13 = load i32, ptr %12, align 4 - %add1 = add i32 %add, %13 - %14 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 3 - %15 = load i8, ptr %14, align 8 - %zext = zext i8 %15 to i32 - %sub = sub i32 %add1, %zext + %ptradd8 = getelementptr inbounds i8, ptr %r, i64 20 + %3 = load i32, ptr %ptradd8, align 4 + %add9 = add i32 %add, %3 + %ptradd10 = getelementptr inbounds i8, ptr %0, i64 16 + %4 = load i8, ptr %ptradd10, align 8 + %zext = zext i8 %4 to i32 + %sub = sub i32 %add9, %zext ret i32 %sub } +; Function Attrs: define i32 @foo.f1(ptr %0, i32 %1) #0 { entry: %r = alloca %Quad, align 8 %intbool = icmp ne i32 %1, 0 br i1 %intbool, label %if.then, label %if.exit + if.then: ; preds = %entry call void @llvm.memcpy.p0.p0.i32(ptr align 8 %r, ptr align 8 %0, i32 24, i1 false) br label %if.exit + if.exit: ; preds = %if.then, %entry - %2 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 0 - %3 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 4 - %4 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 3 - store i8 1, ptr %4, align 8 - store i32 1, ptr %3, align 4 - store i32 1, ptr %2, align 8 - %5 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 1 - %6 = getelementptr inbounds %SubStruct, ptr %5, i32 0, i32 1 - %7 = load i16, ptr %6, align 2 - %sext = sext i16 %7 to i32 + %ptradd = getelementptr inbounds i8, ptr %0, i64 20 + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 16 + store i8 1, ptr %ptradd1, align 8 + store i32 1, ptr %ptradd, align 4 + store i32 1, ptr %0, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %0, i64 4 + %ptradd3 = getelementptr inbounds i8, ptr %ptradd2, i64 2 + %2 = load i16, ptr %ptradd3, align 2 + %sext = sext i16 %2 to i32 %add = add i32 %sext, %1 - %8 = getelementptr inbounds %Quad, ptr %r, i32 0, i32 4 - %9 = load i32, ptr %8, align 4 - %add1 = add i32 %add, %9 - %10 = getelementptr inbounds %Quad, ptr %0, i32 0, i32 3 - %11 = load i8, ptr %10, align 8 - %zext = zext i8 %11 to i32 - %sub = sub i32 %add1, %zext + %ptradd4 = getelementptr inbounds i8, ptr %r, i64 20 + %3 = load i32, ptr %ptradd4, align 4 + %add5 = add i32 %add, %3 + %ptradd6 = getelementptr inbounds i8, ptr %0, i64 16 + %4 = load i8, ptr %ptradd6, align 8 + %zext = zext i8 %4 to i32 + %sub = sub i32 %add5, %zext ret i32 %sub } +; Function Attrs: define i32 @foo.badFunc(float %0) #0 { entry: %result = alloca i32, align 4 %fpfpext = fpext float %0 to double %gt = fcmp ogt double %fpfpext, 1.234500e+01 br i1 %gt, label %if.then, label %if.exit + if.then: ; preds = %entry store i32 4, ptr %result, align 4 br label %if.exit + if.exit: ; preds = %if.then, %entry %1 = load i32, ptr %result, align 4 ret i32 %1 } +; Function Attrs: +declare i32 @ef1(ptr, ptr, ptr) #0 + +; Function Attrs: define i32 @foo.func(i32 %0, i64 %1) #0 { entry: %result = alloca i32, align 4 @@ -668,6 +719,7 @@ entry: ret i32 %4 } +; Function Attrs: define signext i16 @foo.funFunc(i64 %0, i8 zeroext %1) #0 { entry: %zext = zext i8 %1 to i64 @@ -676,11 +728,13 @@ entry: ret i16 %trunc } +; Function Attrs: define i32 @foo.castTest(i32 %0) #0 { entry: ret i32 %0 } +; Function Attrs: define double @foo.testAdd(double %0, float %1) #0 { entry: %fpfpext = fpext float %1 to double @@ -689,6 +743,7 @@ entry: ret double %fadd1 } +; Function Attrs: define i32 @foo.funcZ(i32 %0, i32 %1) #0 { entry: %i = alloca i32, align 4 @@ -696,15 +751,18 @@ entry: store i32 %0, ptr %i, align 4 store i32 %1, ptr %j, align 4 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry %2 = load i32, ptr %i, align 4 %neq = icmp ne i32 %2, 20 br i1 %neq, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond %3 = load i32, ptr %i, align 4 %add = add i32 %3, 2 store i32 %add, ptr %i, align 4 br label %loop.cond + loop.exit: ; preds = %loop.cond %4 = load i32, ptr %j, align 4 %5 = load i32, ptr %i, align 4 @@ -721,6 +779,7 @@ loop.exit: ; preds = %loop.cond ret i32 %mul4 } +; Function Attrs: define i32 @foo.sumArray(ptr %0, i32 %1) #0 { entry: %i = alloca i32, align 4 @@ -728,15 +787,17 @@ entry: store i32 0, ptr %result, align 4 store i32 0, ptr %i, align 4 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry %2 = load i32, ptr %i, align 4 %lt = icmp slt i32 %2, %1 br i1 %lt, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond %3 = load i32, ptr %result, align 4 %4 = load i32, ptr %i, align 4 %sext = sext i32 %4 to i64 - %ptroffset = getelementptr inbounds i32, ptr %0, i64 %sext + %ptroffset = getelementptr inbounds [4 x i8], ptr %0, i64 %sext %5 = load i32, ptr %ptroffset, align 4 %add = add i32 %3, %5 store i32 %add, ptr %result, align 4 @@ -744,22 +805,25 @@ loop.body: ; preds = %loop.cond %add1 = add i32 %6, 1 store i32 %add1, ptr %i, align 4 br label %loop.cond + loop.exit: ; preds = %loop.cond %7 = load i32, ptr %result, align 4 ret i32 %7 } +; Function Attrs: define i32 @foo.arrayParam(ptr %0) #0 { entry: - %ptroffset = getelementptr inbounds i32, ptr %0, i64 50 - %1 = load i32, ptr %ptroffset, align 4 + %ptradd = getelementptr inbounds i8, ptr %0, i64 200 + %1 = load i32, ptr %ptradd, align 4 %sext = sext i32 %1 to i64 %intptr = inttoptr i64 %sext to ptr - %ptroffset1 = getelementptr inbounds i32, ptr %0, i64 50 - %2 = call i32 @ef1(ptr %intptr, ptr inttoptr (i64 1 to ptr), ptr %ptroffset1) + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 200 + %2 = call i32 @ef1(ptr %intptr, ptr inttoptr (i64 1 to ptr), ptr %ptradd1) ret i32 %2 } +; Function Attrs: define i32 @foo.arrayToSum() #0 { entry: %a = alloca [100 x i32], align 16 @@ -767,30 +831,36 @@ entry: store i32 0, ptr %i, align 4 store i32 0, ptr %i, align 4 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry %0 = load i32, ptr %i, align 4 %lt = icmp slt i32 %0, 100 br i1 %lt, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond %1 = load i32, ptr %i, align 4 %sext = sext i32 %1 to i64 - %2 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %sext + %ptroffset = getelementptr inbounds [4 x i8], ptr %a, i64 %sext + %2 = load i32, ptr %i, align 4 + %mul = mul i32 %2, 4 + store i32 %mul, ptr %ptroffset, align 4 %3 = load i32, ptr %i, align 4 - %mul = mul i32 %3, 4 - store i32 %mul, ptr %2, align 4 - %4 = load i32, ptr %i, align 4 - %add = add i32 %4, 1 + %add = add i32 %3, 1 store i32 %add, ptr %i, align 4 br label %loop.cond + loop.exit: ; preds = %loop.cond - %5 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 0 - %6 = load i32, ptr %5, align 4 - %sext1 = sext i32 %6 to i64 - %7 = getelementptr inbounds [100 x i32], ptr %a, i64 0, i64 %sext1 - %8 = load i32, ptr %7, align 4 - ret i32 %8 + %4 = load i32, ptr %a, align 4 + %sext1 = sext i32 %4 to i64 + %ptroffset2 = getelementptr inbounds [4 x i8], ptr %a, i64 %sext1 + %5 = load i32, ptr %ptroffset2, align 4 + ret i32 %5 } +; Function Attrs: +declare i32 @externFunc(i64, ptr, i16 signext, i8 zeroext) #0 + +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 { entry: %i = alloca i32, align 4 @@ -799,22 +869,26 @@ entry: %3 = call i32 @externFunc(i64 -1, ptr null, i16 signext %trunc, i8 zeroext 2) store i32 0, ptr %i, align 4 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry %4 = load i32, ptr %i, align 4 %gt = icmp ugt i32 10, %4 br i1 %gt, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond - %ptroffset = getelementptr inbounds ptr, ptr %1, i64 3 - %5 = load ptr, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %1, i64 24 + %5 = load ptr, ptr %ptradd, align 8 %6 = call i32 @puts(ptr %5) %7 = load i32, ptr %i, align 4 %add = add i32 %7, 1 store i32 %add, ptr %i, align 4 br label %loop.cond + loop.exit: ; preds = %loop.cond ret i32 0 } +; Function Attrs: define double @foo.mathFunc(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8, double %9, double %10, double %11, double %12, double %13, double %14, double %15, double %16) #0 { entry: %fadd = fadd double %0, %1 @@ -836,6 +910,7 @@ entry: ret double %fadd15 } +; Function Attrs: define void @foo.strcpy(ptr %0, ptr %1) #0 { entry: %s1 = alloca ptr, align 8 @@ -843,23 +918,27 @@ entry: store ptr %0, ptr %s1, align 8 store ptr %1, ptr %s2, align 8 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry %2 = load ptr, ptr %s1, align 8 - %ptroffset = getelementptr i8, ptr %2, i8 1 - store ptr %ptroffset, ptr %s1, align 8 + %ptradd_any = getelementptr i8, ptr %2, i8 1 + store ptr %ptradd_any, ptr %s1, align 8 %3 = load ptr, ptr %s2, align 8 - %ptroffset1 = getelementptr i8, ptr %3, i8 1 - store ptr %ptroffset1, ptr %s2, align 8 + %ptradd_any1 = getelementptr i8, ptr %3, i8 1 + store ptr %ptradd_any1, ptr %s2, align 8 %4 = load i8, ptr %3, align 1 store i8 %4, ptr %2, align 1 %intbool = icmp ne i8 %4, 0 br i1 %intbool, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond br label %loop.cond + loop.exit: ; preds = %loop.cond ret void } +; Function Attrs: define void @foo.strcat(ptr %0, ptr %1) #0 { entry: %s1 = alloca ptr, align 8 @@ -867,37 +946,44 @@ entry: store ptr %0, ptr %s1, align 8 store ptr %1, ptr %s2, align 8 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry %2 = load ptr, ptr %s1, align 8 - %ptroffset = getelementptr i8, ptr %2, i8 1 - store ptr %ptroffset, ptr %s1, align 8 + %ptradd_any = getelementptr i8, ptr %2, i8 1 + store ptr %ptradd_any, ptr %s1, align 8 %3 = load i8, ptr %2, align 1 %intbool = icmp ne i8 %3, 0 br i1 %intbool, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond br label %loop.cond + loop.exit: ; preds = %loop.cond %4 = load ptr, ptr %s1, align 8 - %ptroffset1 = getelementptr i8, ptr %4, i8 -1 - store ptr %ptroffset1, ptr %s1, align 8 + %ptradd_any1 = getelementptr i8, ptr %4, i8 -1 + store ptr %ptradd_any1, ptr %s1, align 8 br label %loop.cond2 + loop.cond2: ; preds = %loop.body6, %loop.exit %5 = load ptr, ptr %s1, align 8 - %ptroffset3 = getelementptr i8, ptr %5, i8 1 - store ptr %ptroffset3, ptr %s1, align 8 + %ptradd_any3 = getelementptr i8, ptr %5, i8 1 + store ptr %ptradd_any3, ptr %s1, align 8 %6 = load ptr, ptr %s2, align 8 - %ptroffset4 = getelementptr i8, ptr %6, i8 1 - store ptr %ptroffset4, ptr %s2, align 8 + %ptradd_any4 = getelementptr i8, ptr %6, i8 1 + store ptr %ptradd_any4, ptr %s2, align 8 %7 = load i8, ptr %6, align 1 store i8 %7, ptr %5, align 1 %intbool5 = icmp ne i8 %7, 0 br i1 %intbool5, label %loop.body6, label %loop.exit7 + loop.body6: ; preds = %loop.cond2 br label %loop.cond2 + loop.exit7: ; preds = %loop.cond2 ret void } +; Function Attrs: define i32 @foo.strcmp(ptr %0, ptr %1) #0 { entry: %s1 = alloca ptr, align 8 @@ -905,53 +991,62 @@ entry: store ptr %0, ptr %s1, align 8 store ptr %1, ptr %s2, align 8 br label %loop.cond + loop.cond: ; preds = %loop.body, %entry %2 = load ptr, ptr %s1, align 8 - %ptroffset = getelementptr i8, ptr %2, i8 1 - store ptr %ptroffset, ptr %s1, align 8 + %ptradd_any = getelementptr i8, ptr %2, i8 1 + store ptr %ptradd_any, ptr %s1, align 8 %3 = load i8, ptr %2, align 1 %4 = load ptr, ptr %s2, align 8 - %ptroffset1 = getelementptr i8, ptr %4, i8 1 - store ptr %ptroffset1, ptr %s2, align 8 + %ptradd_any1 = getelementptr i8, ptr %4, i8 1 + store ptr %ptradd_any1, ptr %s2, align 8 %5 = load i8, ptr %4, align 1 %eq = icmp eq i8 %3, %5 br i1 %eq, label %loop.body, label %loop.exit + loop.body: ; preds = %loop.cond br label %loop.cond + loop.exit: ; preds = %loop.cond %6 = load ptr, ptr %s1, align 8 %7 = load i8, ptr %6, align 1 %zext = zext i8 %7 to i32 %eq2 = icmp eq i32 0, %zext br i1 %eq2, label %if.then, label %if.else6 + if.then: ; preds = %loop.exit %8 = load ptr, ptr %s2, align 8 %9 = load i8, ptr %8, align 1 %zext3 = zext i8 %9 to i32 %eq4 = icmp eq i32 0, %zext3 br i1 %eq4, label %if.then5, label %if.else + if.then5: ; preds = %if.then ret i32 0 + if.else: ; preds = %if.then ret i32 -1 + if.else6: ; preds = %loop.exit %10 = load ptr, ptr %s2, align 8 %11 = load i8, ptr %10, align 1 %zext7 = zext i8 %11 to i32 %eq8 = icmp eq i32 0, %zext7 br i1 %eq8, label %if.then9, label %if.else10 + if.then9: ; preds = %if.else6 ret i32 1 + if.else10: ; preds = %if.else6 %12 = load ptr, ptr %s1, align 8 - %ptroffset11 = getelementptr i8, ptr %12, i8 -1 - store ptr %ptroffset11, ptr %s1, align 8 - %13 = load i8, ptr %ptroffset11, align 1 + %ptradd_any11 = getelementptr i8, ptr %12, i8 -1 + store ptr %ptradd_any11, ptr %s1, align 8 + %13 = load i8, ptr %ptradd_any11, align 1 %zext12 = zext i8 %13 to i32 %14 = load ptr, ptr %s2, align 8 - %ptroffset13 = getelementptr i8, ptr %14, i8 -1 - store ptr %ptroffset13, ptr %s2, align 8 - %15 = load i8, ptr %ptroffset13, align 1 + %ptradd_any13 = getelementptr i8, ptr %14, i8 -1 + store ptr %ptradd_any13, ptr %s2, align 8 + %15 = load i8, ptr %ptradd_any13, align 1 %zext14 = zext i8 %15 to i32 %sub = sub i32 %zext12, %zext14 ret i32 %sub diff --git a/test/test_suite/compile_time/compile_time_access_subscript.c3t b/test/test_suite/compile_time/compile_time_access_subscript.c3t index 31ecdc31c..992c68391 100644 --- a/test/test_suite/compile_time/compile_time_access_subscript.c3t +++ b/test/test_suite/compile_time/compile_time_access_subscript.c3t @@ -46,58 +46,53 @@ fn void main() %z = alloca i32, align 4 %z1 = alloca %Abc, align 4 - %z2 = alloca i64, align 8 - %z3 = alloca i32, align 4 - %z4 = alloca ptr, align 8 - %z5 = alloca i8, align 1 - %z6 = alloca i64, align 8 - %z7 = alloca <3 x i32>, align 16 - %z8 = alloca %Abc, align 4 - %z9 = alloca [2 x i32], align 4 - %z10 = alloca %"int[]", align 8 + %z4 = alloca i64, align 8 + %z5 = alloca i32, align 4 + %z6 = alloca ptr, align 8 + %z7 = alloca i8, align 1 + %z8 = alloca i64, align 8 + %z9 = alloca <3 x i32>, align 16 + %z10 = alloca %Abc, align 4 + %z14 = alloca [2 x i32], align 4 + %z16 = alloca %"int[]", align 8 %varargslots = alloca [1 x %"any*"], align 16 %literal = alloca %Abc, align 4 %retparam = alloca i64, align 8 store i32 0, ptr %z, align 4 - %0 = getelementptr inbounds %Abc, ptr %z1, i32 0, i32 0 - store float 0.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Abc, ptr %z1, i32 0, i32 1 - store float 0.000000e+00, ptr %1, align 4 - %2 = getelementptr inbounds %Abc, ptr %z1, i32 0, i32 2 - store float 0.000000e+00, ptr %2, align 4 - %3 = getelementptr inbounds %Abc, ptr %z1, i32 0, i32 3 - store float 0.000000e+00, ptr %3, align 4 - store i64 0, ptr %z2, align 8 - store i32 0, ptr %z3, align 4 - store ptr null, ptr %z4, align 8 - store i8 0, ptr %z5, align 1 - store i64 0, ptr %z6, align 8 - store <3 x i32> zeroinitializer, ptr %z7, align 16 - %4 = getelementptr inbounds %Abc, ptr %z8, i32 0, i32 0 - store float 0.000000e+00, ptr %4, align 4 - %5 = getelementptr inbounds %Abc, ptr %z8, i32 0, i32 1 - store float 0.000000e+00, ptr %5, align 4 - %6 = getelementptr inbounds %Abc, ptr %z8, i32 0, i32 2 - store float 0.000000e+00, ptr %6, align 4 - %7 = getelementptr inbounds %Abc, ptr %z8, i32 0, i32 3 - store float 0.000000e+00, ptr %7, align 4 - %8 = getelementptr inbounds [2 x i32], ptr %z9, i64 0, i64 0 - store i32 0, ptr %8, align 4 - %9 = getelementptr inbounds [2 x i32], ptr %z9, i64 0, i64 1 - store i32 0, ptr %9, align 4 - call void @llvm.memset.p0.i64(ptr align 8 %z10, i8 0, i64 16, i1 false) - %10 = getelementptr inbounds %Abc, ptr %literal, i32 0, i32 0 - store float 0.000000e+00, ptr %10, align 4 - %11 = getelementptr inbounds %Abc, ptr %literal, i32 0, i32 1 - store float 0.000000e+00, ptr %11, align 4 - %12 = getelementptr inbounds %Abc, ptr %literal, i32 0, i32 2 - store float 0.000000e+00, ptr %12, align 4 - %13 = getelementptr inbounds %Abc, ptr %literal, i32 0, i32 3 - store float 0.000000e+00, ptr %13, align 4 - %14 = insertvalue %"any*" undef, ptr %literal, 0 - %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.test.Abc" to i64), 1 - %16 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %15, ptr %16, align 16 - %17 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) + store float 0.000000e+00, ptr %z1, align 4 + %ptradd = getelementptr inbounds i8, ptr %z1, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %z1, i64 8 + store float 0.000000e+00, ptr %ptradd2, align 4 + %ptradd3 = getelementptr inbounds i8, ptr %z1, i64 12 + store float 0.000000e+00, ptr %ptradd3, align 4 + store i64 0, ptr %z4, align 8 + store i32 0, ptr %z5, align 4 + store ptr null, ptr %z6, align 8 + store i8 0, ptr %z7, align 1 + store i64 0, ptr %z8, align 8 + store <3 x i32> zeroinitializer, ptr %z9, align 16 + store float 0.000000e+00, ptr %z10, align 4 + %ptradd11 = getelementptr inbounds i8, ptr %z10, i64 4 + store float 0.000000e+00, ptr %ptradd11, align 4 + %ptradd12 = getelementptr inbounds i8, ptr %z10, i64 8 + store float 0.000000e+00, ptr %ptradd12, align 4 + %ptradd13 = getelementptr inbounds i8, ptr %z10, i64 12 + store float 0.000000e+00, ptr %ptradd13, align 4 + store i32 0, ptr %z14, align 4 + %ptradd15 = getelementptr inbounds i8, ptr %z14, i64 4 + store i32 0, ptr %ptradd15, align 4 + call void @llvm.memset.p0.i64(ptr align 8 %z16, i8 0, i64 16, i1 false) + store float 0.000000e+00, ptr %literal, align 4 + %ptradd17 = getelementptr inbounds i8, ptr %literal, i64 4 + store float 0.000000e+00, ptr %ptradd17, align 4 + %ptradd18 = getelementptr inbounds i8, ptr %literal, i64 8 + store float 0.000000e+00, ptr %ptradd18, align 4 + %ptradd19 = getelementptr inbounds i8, ptr %literal, i64 12 + store float 0.000000e+00, ptr %ptradd19, align 4 + %0 = insertvalue %"any*" undef, ptr %literal, 0 + %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.test.Abc" to i64), 1 + store %"any*" %1, ptr %varargslots, align 16 + %2 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) ret void } diff --git a/test/test_suite/compile_time/compile_time_array_ref.c3t b/test/test_suite/compile_time/compile_time_array_ref.c3t index ad4618d9e..69638b35e 100644 --- a/test/test_suite/compile_time/compile_time_array_ref.c3t +++ b/test/test_suite/compile_time/compile_time_array_ref.c3t @@ -15,4 +15,4 @@ fn void test() @foo.stack = local_unnamed_addr global [8192 x i8] zeroinitializer, align 16 @foo.x = local_unnamed_addr global ptr getelementptr (i8, ptr @foo.stack, i64 1000), align 8 @test.y = internal unnamed_addr global [2 x i8] zeroinitializer, align 1 -@test.z = internal unnamed_addr global ptr getelementptr inbounds ([2 x i8], ptr @test.y, i64 0, i64 1), align 8 \ No newline at end of file +@test.z = internal unnamed_addr global ptr getelementptr inbounds (i8, ptr @test.y, i64 1), align 8 \ No newline at end of file diff --git a/test/test_suite/compile_time/compile_time_ptr_ref.c3t b/test/test_suite/compile_time/compile_time_ptr_ref.c3t index 730c96eb3..70dadef15 100644 --- a/test/test_suite/compile_time/compile_time_ptr_ref.c3t +++ b/test/test_suite/compile_time/compile_time_ptr_ref.c3t @@ -12,8 +12,7 @@ int ptr = 0; /* #expect: test.ll %"int*[]" = type { ptr, i64 } - -@.taddr = private global [5 x ptr] [ptr @test.ptr, ptr @test.ptr, ptr getelementptr inbounds (i32, ptr @test.ptr, i64 1), ptr getelementptr (i32, ptr @test.ptr, i64 -1), ptr getelementptr (i8, ptr @test.ptr, i64 -4)], align 8 +@.taddr = private global [5 x ptr] [ptr @test.ptr, ptr @test.ptr, ptr getelementptr (i8, ptr @test.ptr, i64 4), ptr getelementptr (i8, ptr @test.ptr, i64 -4), ptr getelementptr (i8, ptr @test.ptr, i64 -4)], align 8 @test.blurp = local_unnamed_addr global %"int*[]" { ptr @.taddr, i64 5 }, align 8 @test.c = local_unnamed_addr global ptr getelementptr (i8, ptr @test.ptr, i64 -4), align 8 @test.c2 = local_unnamed_addr global ptr getelementptr (i8, ptr @test.ptr, i64 4), align 8 diff --git a/test/test_suite/compile_time/ct_builtin_time_date.c3t b/test/test_suite/compile_time/ct_builtin_time_date.c3t index fe1c5b5df..eae523640 100644 --- a/test/test_suite/compile_time/ct_builtin_time_date.c3t +++ b/test/test_suite/compile_time/ct_builtin_time_date.c3t @@ -60,203 +60,255 @@ entry: store i32 %0, ptr %taddr, align 4 %1 = insertvalue %"any*" undef, ptr %taddr, 0 %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %3 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %2, ptr %3, align 16 - %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) + store %"any*" %2, ptr %varargslots, align 16 + %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) %gt = icmp sgt i32 %0, 0 br i1 %gt, label %if.then, label %if.exit + if.then: ; preds = %entry %sub = sub i32 %0, 1 call void @test.test(i32 %sub) br label %if.exit + if.exit: ; preds = %if.then, %entry - %5 = call ptr @std.io.stdout() - %6 = call i64 @std.io.File.write(ptr %retparam2, ptr %5, ptr @.str.1, i64 8) - %not_err = icmp eq i64 %6, 0 - %7 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %7, label %after_check, label %assign_optional + %4 = call ptr @std.io.stdout() + %5 = call i64 @std.io.File.write(ptr %retparam2, ptr %4, ptr @.str.1, i64 8) + %not_err = icmp eq i64 %5, 0 + %6 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %6, label %after_check, label %assign_optional + assign_optional: ; preds = %if.exit - store i64 %6, ptr %error_var, align 8 + store i64 %5, ptr %error_var, align 8 br label %guard_block + after_check: ; preds = %if.exit br label %noerr_block + guard_block: ; preds = %assign_optional br label %voiderr + noerr_block: ; preds = %after_check - %8 = load i64, ptr %retparam2, align 8 - store i64 %8, ptr %len, align 8 - %9 = call i64 @std.io.File.write_byte(ptr %5, i8 zeroext 10) - %not_err4 = icmp eq i64 %9, 0 - %10 = call i1 @llvm.expect.i1(i1 %not_err4, i1 true) - br i1 %10, label %after_check6, label %assign_optional5 + %7 = load i64, ptr %retparam2, align 8 + store i64 %7, ptr %len, align 8 + %8 = call i64 @std.io.File.write_byte(ptr %4, i8 zeroext 10) + %not_err4 = icmp eq i64 %8, 0 + %9 = call i1 @llvm.expect.i1(i1 %not_err4, i1 true) + br i1 %9, label %after_check6, label %assign_optional5 + assign_optional5: ; preds = %noerr_block - store i64 %9, ptr %error_var3, align 8 + store i64 %8, ptr %error_var3, align 8 br label %guard_block7 + after_check6: ; preds = %noerr_block br label %noerr_block8 + guard_block7: ; preds = %assign_optional5 br label %voiderr + noerr_block8: ; preds = %after_check6 - %11 = call i64 @std.io.File.flush(ptr %5) - %not_err10 = icmp eq i64 %11, 0 - %12 = call i1 @llvm.expect.i1(i1 %not_err10, i1 true) - br i1 %12, label %after_check12, label %assign_optional11 + %10 = call i64 @std.io.File.flush(ptr %4) + %not_err10 = icmp eq i64 %10, 0 + %11 = call i1 @llvm.expect.i1(i1 %not_err10, i1 true) + br i1 %11, label %after_check12, label %assign_optional11 + assign_optional11: ; preds = %noerr_block8 - store i64 %11, ptr %error_var9, align 8 + store i64 %10, ptr %error_var9, align 8 br label %guard_block13 + after_check12: ; preds = %noerr_block8 br label %noerr_block14 + guard_block13: ; preds = %assign_optional11 br label %voiderr + noerr_block14: ; preds = %after_check12 - %13 = load i64, ptr %len, align 8 - %add = add i64 %13, 1 + %12 = load i64, ptr %len, align 8 + %add = add i64 %12, 1 br label %voiderr + voiderr: ; preds = %noerr_block14, %guard_block13, %guard_block7, %guard_block - %14 = call ptr @std.io.stdout() - %15 = call i64 @std.io.File.write(ptr %retparam18, ptr %14, ptr @.str.2, i64 10) - %not_err19 = icmp eq i64 %15, 0 - %16 = call i1 @llvm.expect.i1(i1 %not_err19, i1 true) - br i1 %16, label %after_check21, label %assign_optional20 + %13 = call ptr @std.io.stdout() + %14 = call i64 @std.io.File.write(ptr %retparam18, ptr %13, ptr @.str.2, i64 10) + %not_err19 = icmp eq i64 %14, 0 + %15 = call i1 @llvm.expect.i1(i1 %not_err19, i1 true) + br i1 %15, label %after_check21, label %assign_optional20 + assign_optional20: ; preds = %voiderr - store i64 %15, ptr %error_var16, align 8 + store i64 %14, ptr %error_var16, align 8 br label %guard_block22 + after_check21: ; preds = %voiderr br label %noerr_block23 + guard_block22: ; preds = %assign_optional20 br label %voiderr37 + noerr_block23: ; preds = %after_check21 - %17 = load i64, ptr %retparam18, align 8 - store i64 %17, ptr %len15, align 8 - %18 = call i64 @std.io.File.write_byte(ptr %14, i8 zeroext 10) - %not_err25 = icmp eq i64 %18, 0 - %19 = call i1 @llvm.expect.i1(i1 %not_err25, i1 true) - br i1 %19, label %after_check27, label %assign_optional26 + %16 = load i64, ptr %retparam18, align 8 + store i64 %16, ptr %len15, align 8 + %17 = call i64 @std.io.File.write_byte(ptr %13, i8 zeroext 10) + %not_err25 = icmp eq i64 %17, 0 + %18 = call i1 @llvm.expect.i1(i1 %not_err25, i1 true) + br i1 %18, label %after_check27, label %assign_optional26 + assign_optional26: ; preds = %noerr_block23 - store i64 %18, ptr %error_var24, align 8 + store i64 %17, ptr %error_var24, align 8 br label %guard_block28 + after_check27: ; preds = %noerr_block23 br label %noerr_block29 + guard_block28: ; preds = %assign_optional26 br label %voiderr37 + noerr_block29: ; preds = %after_check27 - %20 = call i64 @std.io.File.flush(ptr %14) - %not_err31 = icmp eq i64 %20, 0 - %21 = call i1 @llvm.expect.i1(i1 %not_err31, i1 true) - br i1 %21, label %after_check33, label %assign_optional32 + %19 = call i64 @std.io.File.flush(ptr %13) + %not_err31 = icmp eq i64 %19, 0 + %20 = call i1 @llvm.expect.i1(i1 %not_err31, i1 true) + br i1 %20, label %after_check33, label %assign_optional32 + assign_optional32: ; preds = %noerr_block29 - store i64 %20, ptr %error_var30, align 8 + store i64 %19, ptr %error_var30, align 8 br label %guard_block34 + after_check33: ; preds = %noerr_block29 br label %noerr_block35 + guard_block34: ; preds = %assign_optional32 br label %voiderr37 + noerr_block35: ; preds = %after_check33 - %22 = load i64, ptr %len15, align 8 - %add36 = add i64 %22, 1 + %21 = load i64, ptr %len15, align 8 + %add36 = add i64 %21, 1 br label %voiderr37 + voiderr37: ; preds = %noerr_block35, %guard_block34, %guard_block28, %guard_block22 store i64 14, ptr %taddr39, align 8 - %23 = insertvalue %"any*" undef, ptr %taddr39, 0 - %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %25 = getelementptr inbounds [1 x %"any*"], ptr %varargslots38, i64 0, i64 0 - store %"any*" %24, ptr %25, align 16 - %26 = call i64 @std.io.printfn(ptr %retparam40, ptr @.str.3, i64 2, ptr %varargslots38, i64 1) + %22 = insertvalue %"any*" undef, ptr %taddr39, 0 + %23 = insertvalue %"any*" %22, i64 ptrtoint (ptr @"$ct.long" to i64), 1 + store %"any*" %23, ptr %varargslots38, align 16 + %24 = call i64 @std.io.printfn(ptr %retparam40, ptr @.str.3, i64 2, ptr %varargslots38, i64 1) store i64 6, ptr %taddr44, align 8 - %27 = insertvalue %"any*" undef, ptr %taddr44, 0 - %28 = insertvalue %"any*" %27, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %29 = getelementptr inbounds [1 x %"any*"], ptr %varargslots43, i64 0, i64 0 - store %"any*" %28, ptr %29, align 16 - %30 = call i64 @std.io.printfn(ptr %retparam45, ptr @.str.4, i64 2, ptr %varargslots43, i64 1) - %31 = call ptr @std.io.stdout() - %32 = call i64 @std.io.File.write(ptr %retparam51, ptr %31, ptr @.str.5, i64 23) - %not_err52 = icmp eq i64 %32, 0 - %33 = call i1 @llvm.expect.i1(i1 %not_err52, i1 true) - br i1 %33, label %after_check54, label %assign_optional53 + %25 = insertvalue %"any*" undef, ptr %taddr44, 0 + %26 = insertvalue %"any*" %25, i64 ptrtoint (ptr @"$ct.long" to i64), 1 + store %"any*" %26, ptr %varargslots43, align 16 + %27 = call i64 @std.io.printfn(ptr %retparam45, ptr @.str.4, i64 2, ptr %varargslots43, i64 1) + %28 = call ptr @std.io.stdout() + %29 = call i64 @std.io.File.write(ptr %retparam51, ptr %28, ptr @.str.5, i64 23) + %not_err52 = icmp eq i64 %29, 0 + %30 = call i1 @llvm.expect.i1(i1 %not_err52, i1 true) + br i1 %30, label %after_check54, label %assign_optional53 + assign_optional53: ; preds = %voiderr37 - store i64 %32, ptr %error_var49, align 8 + store i64 %29, ptr %error_var49, align 8 br label %guard_block55 + after_check54: ; preds = %voiderr37 br label %noerr_block56 + guard_block55: ; preds = %assign_optional53 br label %voiderr70 + noerr_block56: ; preds = %after_check54 - %34 = load i64, ptr %retparam51, align 8 - store i64 %34, ptr %len48, align 8 - %35 = call i64 @std.io.File.write_byte(ptr %31, i8 zeroext 10) - %not_err58 = icmp eq i64 %35, 0 - %36 = call i1 @llvm.expect.i1(i1 %not_err58, i1 true) - br i1 %36, label %after_check60, label %assign_optional59 + %31 = load i64, ptr %retparam51, align 8 + store i64 %31, ptr %len48, align 8 + %32 = call i64 @std.io.File.write_byte(ptr %28, i8 zeroext 10) + %not_err58 = icmp eq i64 %32, 0 + %33 = call i1 @llvm.expect.i1(i1 %not_err58, i1 true) + br i1 %33, label %after_check60, label %assign_optional59 + assign_optional59: ; preds = %noerr_block56 - store i64 %35, ptr %error_var57, align 8 + store i64 %32, ptr %error_var57, align 8 br label %guard_block61 + after_check60: ; preds = %noerr_block56 br label %noerr_block62 + guard_block61: ; preds = %assign_optional59 br label %voiderr70 + noerr_block62: ; preds = %after_check60 - %37 = call i64 @std.io.File.flush(ptr %31) - %not_err64 = icmp eq i64 %37, 0 - %38 = call i1 @llvm.expect.i1(i1 %not_err64, i1 true) - br i1 %38, label %after_check66, label %assign_optional65 + %34 = call i64 @std.io.File.flush(ptr %28) + %not_err64 = icmp eq i64 %34, 0 + %35 = call i1 @llvm.expect.i1(i1 %not_err64, i1 true) + br i1 %35, label %after_check66, label %assign_optional65 + assign_optional65: ; preds = %noerr_block62 - store i64 %37, ptr %error_var63, align 8 + store i64 %34, ptr %error_var63, align 8 br label %guard_block67 + after_check66: ; preds = %noerr_block62 br label %noerr_block68 + guard_block67: ; preds = %assign_optional65 br label %voiderr70 + noerr_block68: ; preds = %after_check66 - %39 = load i64, ptr %len48, align 8 - %add69 = add i64 %39, 1 + %36 = load i64, ptr %len48, align 8 + %add69 = add i64 %36, 1 br label %voiderr70 + voiderr70: ; preds = %noerr_block68, %guard_block67, %guard_block61, %guard_block55 - %40 = call ptr @std.io.stdout() - %41 = call i64 @std.io.File.write(ptr %retparam74, ptr %40, ptr @.str.6, i64 4) - %not_err75 = icmp eq i64 %41, 0 - %42 = call i1 @llvm.expect.i1(i1 %not_err75, i1 true) - br i1 %42, label %after_check77, label %assign_optional76 + %37 = call ptr @std.io.stdout() + %38 = call i64 @std.io.File.write(ptr %retparam74, ptr %37, ptr @.str.6, i64 4) + %not_err75 = icmp eq i64 %38, 0 + %39 = call i1 @llvm.expect.i1(i1 %not_err75, i1 true) + br i1 %39, label %after_check77, label %assign_optional76 + assign_optional76: ; preds = %voiderr70 - store i64 %41, ptr %error_var72, align 8 + store i64 %38, ptr %error_var72, align 8 br label %guard_block78 + after_check77: ; preds = %voiderr70 br label %noerr_block79 + guard_block78: ; preds = %assign_optional76 br label %voiderr93 + noerr_block79: ; preds = %after_check77 - %43 = load i64, ptr %retparam74, align 8 - store i64 %43, ptr %len71, align 8 - %44 = call i64 @std.io.File.write_byte(ptr %40, i8 zeroext 10) - %not_err81 = icmp eq i64 %44, 0 - %45 = call i1 @llvm.expect.i1(i1 %not_err81, i1 true) - br i1 %45, label %after_check83, label %assign_optional82 + %40 = load i64, ptr %retparam74, align 8 + store i64 %40, ptr %len71, align 8 + %41 = call i64 @std.io.File.write_byte(ptr %37, i8 zeroext 10) + %not_err81 = icmp eq i64 %41, 0 + %42 = call i1 @llvm.expect.i1(i1 %not_err81, i1 true) + br i1 %42, label %after_check83, label %assign_optional82 + assign_optional82: ; preds = %noerr_block79 - store i64 %44, ptr %error_var80, align 8 + store i64 %41, ptr %error_var80, align 8 br label %guard_block84 + after_check83: ; preds = %noerr_block79 br label %noerr_block85 + guard_block84: ; preds = %assign_optional82 br label %voiderr93 + noerr_block85: ; preds = %after_check83 - %46 = call i64 @std.io.File.flush(ptr %40) - %not_err87 = icmp eq i64 %46, 0 - %47 = call i1 @llvm.expect.i1(i1 %not_err87, i1 true) - br i1 %47, label %after_check89, label %assign_optional88 + %43 = call i64 @std.io.File.flush(ptr %37) + %not_err87 = icmp eq i64 %43, 0 + %44 = call i1 @llvm.expect.i1(i1 %not_err87, i1 true) + br i1 %44, label %after_check89, label %assign_optional88 + assign_optional88: ; preds = %noerr_block85 - store i64 %46, ptr %error_var86, align 8 + store i64 %43, ptr %error_var86, align 8 br label %guard_block90 + after_check89: ; preds = %noerr_block85 br label %noerr_block91 + guard_block90: ; preds = %assign_optional88 br label %voiderr93 + noerr_block91: ; preds = %after_check89 - %48 = load i64, ptr %len71, align 8 - %add92 = add i64 %48, 1 + %45 = load i64, ptr %len71, align 8 + %add92 = add i64 %45, 1 br label %voiderr93 + voiderr93: ; preds = %noerr_block91, %guard_block90, %guard_block84, %guard_block78 ret void } +; Function Attrs: define void @test.main() #0 { entry: %is_def2 = alloca i8, align 1 diff --git a/test/test_suite/compile_time/ct_funcptr.c3t b/test/test_suite/compile_time/ct_funcptr.c3t index 314bf6283..a3a98dc62 100644 --- a/test/test_suite/compile_time/ct_funcptr.c3t +++ b/test/test_suite/compile_time/ct_funcptr.c3t @@ -26,16 +26,15 @@ entry: store i32 %0, ptr %taddr, align 4 %1 = insertvalue %"any*" undef, ptr %taddr, 0 %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %3 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %2, ptr %3, align 16 - %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) + store %"any*" %2, ptr %varargslots, align 16 + %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) %gt = icmp sgt i32 %0, 0 br i1 %gt, label %if.then, label %if.exit if.then: ; preds = %entry - %5 = load ptr, ptr %ptr, align 8 + %4 = load ptr, ptr %ptr, align 8 %sub = sub i32 %0, 1 - call void %5(i32 %sub) + call void %4(i32 %sub) br label %if.exit if.exit: ; preds = %if.then, %entry diff --git a/test/test_suite/compile_time/ct_memberof.c3t b/test/test_suite/compile_time/ct_memberof.c3t index c591f0d18..a28797d09 100644 --- a/test/test_suite/compile_time/ct_memberof.c3t +++ b/test/test_suite/compile_time/ct_memberof.c3t @@ -106,14 +106,15 @@ entry: %d = alloca [4 x i32], align 8 %args = alloca %"any*[]", align 8 store i64 %2, ptr %d, align 8 - %ptroffset = getelementptr inbounds i64, ptr %d, i64 1 - store i64 %3, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %d, i64 8 + store i64 %3, ptr %ptradd, align 8 store ptr %4, ptr %args, align 8 - %ptroffset1 = getelementptr inbounds i64, ptr %args, i64 1 - store i64 %5, ptr %ptroffset1, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %args, i64 8 + store i64 %5, ptr %ptradd1, align 8 ret void } +; Function Attrs: define void @test.test(i32 %0) #0 { entry: %len = alloca i64, align 8 @@ -161,45 +162,45 @@ entry: %varargslots161 = alloca [2 x %"any*"], align 16 %taddr162 = alloca %"char[]", align 8 %taddr163 = alloca %"char[]", align 8 - %retparam164 = alloca i64, align 8 - %varargslots167 = alloca [2 x %"any*"], align 16 - %taddr168 = alloca %"char[]", align 8 + %retparam165 = alloca i64, align 8 + %varargslots168 = alloca [2 x %"any*"], align 16 %taddr169 = alloca %"char[]", align 8 - %retparam170 = alloca i64, align 8 - %varargslots173 = alloca [2 x %"any*"], align 16 - %taddr174 = alloca %"char[]", align 8 - %taddr175 = alloca %"char[]", align 8 - %retparam176 = alloca i64, align 8 - %varargslots179 = alloca [1 x %"any*"], align 16 - %taddr180 = alloca %"char[]", align 8 - %retparam181 = alloca i64, align 8 - %varargslots184 = alloca [2 x %"any*"], align 16 - %taddr185 = alloca %"char[]", align 8 - %taddr186 = alloca %"char[]", align 8 - %retparam187 = alloca i64, align 8 - %varargslots190 = alloca [2 x %"any*"], align 16 - %taddr191 = alloca %"char[]", align 8 - %taddr192 = alloca %"char[]", align 8 - %retparam193 = alloca i64, align 8 - %varargslots196 = alloca [2 x %"any*"], align 16 - %taddr197 = alloca %"char[]", align 8 - %taddr198 = alloca %"char[]", align 8 - %retparam199 = alloca i64, align 8 - %varargslots202 = alloca [2 x %"any*"], align 16 + %taddr170 = alloca %"char[]", align 8 + %retparam172 = alloca i64, align 8 + %varargslots175 = alloca [2 x %"any*"], align 16 + %taddr176 = alloca %"char[]", align 8 + %taddr177 = alloca %"char[]", align 8 + %retparam179 = alloca i64, align 8 + %varargslots182 = alloca [1 x %"any*"], align 16 + %taddr183 = alloca %"char[]", align 8 + %retparam184 = alloca i64, align 8 + %varargslots187 = alloca [2 x %"any*"], align 16 + %taddr188 = alloca %"char[]", align 8 + %taddr189 = alloca %"char[]", align 8 + %retparam191 = alloca i64, align 8 + %varargslots194 = alloca [2 x %"any*"], align 16 + %taddr195 = alloca %"char[]", align 8 + %taddr196 = alloca %"char[]", align 8 + %retparam198 = alloca i64, align 8 + %varargslots201 = alloca [2 x %"any*"], align 16 + %taddr202 = alloca %"char[]", align 8 %taddr203 = alloca %"char[]", align 8 - %taddr204 = alloca %"char[]", align 8 %retparam205 = alloca i64, align 8 - %varargslots208 = alloca [1 x %"any*"], align 16 + %varargslots208 = alloca [2 x %"any*"], align 16 %taddr209 = alloca %"char[]", align 8 - %retparam210 = alloca i64, align 8 - %varargslots213 = alloca [2 x %"any*"], align 16 - %taddr214 = alloca %"char[]", align 8 - %taddr215 = alloca %"char[]", align 8 - %retparam216 = alloca i64, align 8 - %varargslots219 = alloca [2 x %"any*"], align 16 - %taddr220 = alloca %"char[]", align 8 + %taddr210 = alloca %"char[]", align 8 + %retparam212 = alloca i64, align 8 + %varargslots215 = alloca [1 x %"any*"], align 16 + %taddr216 = alloca %"char[]", align 8 + %retparam217 = alloca i64, align 8 + %varargslots220 = alloca [2 x %"any*"], align 16 %taddr221 = alloca %"char[]", align 8 - %retparam222 = alloca i64, align 8 + %taddr222 = alloca %"char[]", align 8 + %retparam224 = alloca i64, align 8 + %varargslots227 = alloca [2 x %"any*"], align 16 + %taddr228 = alloca %"char[]", align 8 + %taddr229 = alloca %"char[]", align 8 + %retparam231 = alloca i64, align 8 %1 = call ptr @std.io.stdout() %2 = call i64 @std.io.File.write(ptr %retparam, ptr %1, ptr @.str, i64 3) %not_err = icmp eq i64 %2, 0 @@ -595,135 +596,122 @@ voiderr151: ; preds = %noerr_block149, %gu store %"char[]" { ptr @.str.17, i64 3 }, ptr %taddr, align 8 %64 = insertvalue %"any*" undef, ptr %taddr, 0 %65 = insertvalue %"any*" %64, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %66 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %65, ptr %66, align 16 - %67 = call i64 @std.io.printfn(ptr %retparam152, ptr @.str.16, i64 8, ptr %varargslots, i64 1) + store %"any*" %65, ptr %varargslots, align 16 + %66 = call i64 @std.io.printfn(ptr %retparam152, ptr @.str.16, i64 8, ptr %varargslots, i64 1) store %"char[]" { ptr @.str.19, i64 1 }, ptr %taddr156, align 8 - %68 = insertvalue %"any*" undef, ptr %taddr156, 0 - %69 = insertvalue %"any*" %68, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %70 = getelementptr inbounds [2 x %"any*"], ptr %varargslots155, i64 0, i64 0 - store %"any*" %69, ptr %70, align 16 + %67 = insertvalue %"any*" undef, ptr %taddr156, 0 + %68 = insertvalue %"any*" %67, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %68, ptr %varargslots155, align 16 store %"char[]" { ptr @.str.20, i64 3 }, ptr %taddr157, align 8 - %71 = insertvalue %"any*" undef, ptr %taddr157, 0 - %72 = insertvalue %"any*" %71, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %73 = getelementptr inbounds [2 x %"any*"], ptr %varargslots155, i64 0, i64 1 - store %"any*" %72, ptr %73, align 16 - %74 = call i64 @std.io.printfn(ptr %retparam158, ptr @.str.18, i64 6, ptr %varargslots155, i64 2) + %69 = insertvalue %"any*" undef, ptr %taddr157, 0 + %70 = insertvalue %"any*" %69, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots155, i64 16 + store %"any*" %70, ptr %ptradd, align 16 + %71 = call i64 @std.io.printfn(ptr %retparam158, ptr @.str.18, i64 6, ptr %varargslots155, i64 2) store %"char[]" { ptr @.str.22, i64 4 }, ptr %taddr162, align 8 - %75 = insertvalue %"any*" undef, ptr %taddr162, 0 - %76 = insertvalue %"any*" %75, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %77 = getelementptr inbounds [2 x %"any*"], ptr %varargslots161, i64 0, i64 0 - store %"any*" %76, ptr %77, align 16 + %72 = insertvalue %"any*" undef, ptr %taddr162, 0 + %73 = insertvalue %"any*" %72, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %73, ptr %varargslots161, align 16 store %"char[]" { ptr @.str.23, i64 4 }, ptr %taddr163, align 8 - %78 = insertvalue %"any*" undef, ptr %taddr163, 0 - %79 = insertvalue %"any*" %78, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %80 = getelementptr inbounds [2 x %"any*"], ptr %varargslots161, i64 0, i64 1 - store %"any*" %79, ptr %80, align 16 - %81 = call i64 @std.io.printfn(ptr %retparam164, ptr @.str.21, i64 6, ptr %varargslots161, i64 2) - store %"char[]" zeroinitializer, ptr %taddr168, align 8 - %82 = insertvalue %"any*" undef, ptr %taddr168, 0 + %74 = insertvalue %"any*" undef, ptr %taddr163, 0 + %75 = insertvalue %"any*" %74, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd164 = getelementptr inbounds i8, ptr %varargslots161, i64 16 + store %"any*" %75, ptr %ptradd164, align 16 + %76 = call i64 @std.io.printfn(ptr %retparam165, ptr @.str.21, i64 6, ptr %varargslots161, i64 2) + store %"char[]" zeroinitializer, ptr %taddr169, align 8 + %77 = insertvalue %"any*" undef, ptr %taddr169, 0 + %78 = insertvalue %"any*" %77, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %78, ptr %varargslots168, align 16 + store %"char[]" { ptr @.str.25, i64 5 }, ptr %taddr170, align 8 + %79 = insertvalue %"any*" undef, ptr %taddr170, 0 + %80 = insertvalue %"any*" %79, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd171 = getelementptr inbounds i8, ptr %varargslots168, i64 16 + store %"any*" %80, ptr %ptradd171, align 16 + %81 = call i64 @std.io.printfn(ptr %retparam172, ptr @.str.24, i64 6, ptr %varargslots168, i64 2) + store %"char[]" { ptr @.str.27, i64 1 }, ptr %taddr176, align 8 + %82 = insertvalue %"any*" undef, ptr %taddr176, 0 %83 = insertvalue %"any*" %82, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %84 = getelementptr inbounds [2 x %"any*"], ptr %varargslots167, i64 0, i64 0 - store %"any*" %83, ptr %84, align 16 - store %"char[]" { ptr @.str.25, i64 5 }, ptr %taddr169, align 8 - %85 = insertvalue %"any*" undef, ptr %taddr169, 0 - %86 = insertvalue %"any*" %85, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %87 = getelementptr inbounds [2 x %"any*"], ptr %varargslots167, i64 0, i64 1 - store %"any*" %86, ptr %87, align 16 - %88 = call i64 @std.io.printfn(ptr %retparam170, ptr @.str.24, i64 6, ptr %varargslots167, i64 2) - store %"char[]" { ptr @.str.27, i64 1 }, ptr %taddr174, align 8 - %89 = insertvalue %"any*" undef, ptr %taddr174, 0 - %90 = insertvalue %"any*" %89, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %91 = getelementptr inbounds [2 x %"any*"], ptr %varargslots173, i64 0, i64 0 - store %"any*" %90, ptr %91, align 16 - store %"char[]" { ptr @.str.28, i64 6 }, ptr %taddr175, align 8 - %92 = insertvalue %"any*" undef, ptr %taddr175, 0 + store %"any*" %83, ptr %varargslots175, align 16 + store %"char[]" { ptr @.str.28, i64 6 }, ptr %taddr177, align 8 + %84 = insertvalue %"any*" undef, ptr %taddr177, 0 + %85 = insertvalue %"any*" %84, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd178 = getelementptr inbounds i8, ptr %varargslots175, i64 16 + store %"any*" %85, ptr %ptradd178, align 16 + %86 = call i64 @std.io.printfn(ptr %retparam179, ptr @.str.26, i64 6, ptr %varargslots175, i64 2) + store %"char[]" { ptr @.str.30, i64 3 }, ptr %taddr183, align 8 + %87 = insertvalue %"any*" undef, ptr %taddr183, 0 + %88 = insertvalue %"any*" %87, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %88, ptr %varargslots182, align 16 + %89 = call i64 @std.io.printfn(ptr %retparam184, ptr @.str.29, i64 8, ptr %varargslots182, i64 1) + store %"char[]" { ptr @.str.32, i64 1 }, ptr %taddr188, align 8 + %90 = insertvalue %"any*" undef, ptr %taddr188, 0 + %91 = insertvalue %"any*" %90, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %91, ptr %varargslots187, align 16 + store %"char[]" { ptr @.str.33, i64 4 }, ptr %taddr189, align 8 + %92 = insertvalue %"any*" undef, ptr %taddr189, 0 %93 = insertvalue %"any*" %92, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %94 = getelementptr inbounds [2 x %"any*"], ptr %varargslots173, i64 0, i64 1 - store %"any*" %93, ptr %94, align 16 - %95 = call i64 @std.io.printfn(ptr %retparam176, ptr @.str.26, i64 6, ptr %varargslots173, i64 2) - store %"char[]" { ptr @.str.30, i64 3 }, ptr %taddr180, align 8 - %96 = insertvalue %"any*" undef, ptr %taddr180, 0 - %97 = insertvalue %"any*" %96, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %98 = getelementptr inbounds [1 x %"any*"], ptr %varargslots179, i64 0, i64 0 - store %"any*" %97, ptr %98, align 16 - %99 = call i64 @std.io.printfn(ptr %retparam181, ptr @.str.29, i64 8, ptr %varargslots179, i64 1) - store %"char[]" { ptr @.str.32, i64 1 }, ptr %taddr185, align 8 - %100 = insertvalue %"any*" undef, ptr %taddr185, 0 + %ptradd190 = getelementptr inbounds i8, ptr %varargslots187, i64 16 + store %"any*" %93, ptr %ptradd190, align 16 + %94 = call i64 @std.io.printfn(ptr %retparam191, ptr @.str.31, i64 6, ptr %varargslots187, i64 2) + store %"char[]" { ptr @.str.35, i64 1 }, ptr %taddr195, align 8 + %95 = insertvalue %"any*" undef, ptr %taddr195, 0 + %96 = insertvalue %"any*" %95, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %96, ptr %varargslots194, align 16 + store %"char[]" { ptr @.str.36, i64 5 }, ptr %taddr196, align 8 + %97 = insertvalue %"any*" undef, ptr %taddr196, 0 + %98 = insertvalue %"any*" %97, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd197 = getelementptr inbounds i8, ptr %varargslots194, i64 16 + store %"any*" %98, ptr %ptradd197, align 16 + %99 = call i64 @std.io.printfn(ptr %retparam198, ptr @.str.34, i64 6, ptr %varargslots194, i64 2) + store %"char[]" zeroinitializer, ptr %taddr202, align 8 + %100 = insertvalue %"any*" undef, ptr %taddr202, 0 %101 = insertvalue %"any*" %100, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %102 = getelementptr inbounds [2 x %"any*"], ptr %varargslots184, i64 0, i64 0 - store %"any*" %101, ptr %102, align 16 - store %"char[]" { ptr @.str.33, i64 4 }, ptr %taddr186, align 8 - %103 = insertvalue %"any*" undef, ptr %taddr186, 0 - %104 = insertvalue %"any*" %103, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %105 = getelementptr inbounds [2 x %"any*"], ptr %varargslots184, i64 0, i64 1 - store %"any*" %104, ptr %105, align 16 - %106 = call i64 @std.io.printfn(ptr %retparam187, ptr @.str.31, i64 6, ptr %varargslots184, i64 2) - store %"char[]" { ptr @.str.35, i64 1 }, ptr %taddr191, align 8 - %107 = insertvalue %"any*" undef, ptr %taddr191, 0 + store %"any*" %101, ptr %varargslots201, align 16 + store %"char[]" { ptr @.str.38, i64 5 }, ptr %taddr203, align 8 + %102 = insertvalue %"any*" undef, ptr %taddr203, 0 + %103 = insertvalue %"any*" %102, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd204 = getelementptr inbounds i8, ptr %varargslots201, i64 16 + store %"any*" %103, ptr %ptradd204, align 16 + %104 = call i64 @std.io.printfn(ptr %retparam205, ptr @.str.37, i64 6, ptr %varargslots201, i64 2) + store %"char[]" { ptr @.str.40, i64 3 }, ptr %taddr209, align 8 + %105 = insertvalue %"any*" undef, ptr %taddr209, 0 + %106 = insertvalue %"any*" %105, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %106, ptr %varargslots208, align 16 + store %"char[]" { ptr @.str.41, i64 3 }, ptr %taddr210, align 8 + %107 = insertvalue %"any*" undef, ptr %taddr210, 0 %108 = insertvalue %"any*" %107, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %109 = getelementptr inbounds [2 x %"any*"], ptr %varargslots190, i64 0, i64 0 - store %"any*" %108, ptr %109, align 16 - store %"char[]" { ptr @.str.36, i64 5 }, ptr %taddr192, align 8 - %110 = insertvalue %"any*" undef, ptr %taddr192, 0 + %ptradd211 = getelementptr inbounds i8, ptr %varargslots208, i64 16 + store %"any*" %108, ptr %ptradd211, align 16 + %109 = call i64 @std.io.printfn(ptr %retparam212, ptr @.str.39, i64 6, ptr %varargslots208, i64 2) + store %"char[]" { ptr @.str.43, i64 4 }, ptr %taddr216, align 8 + %110 = insertvalue %"any*" undef, ptr %taddr216, 0 %111 = insertvalue %"any*" %110, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %112 = getelementptr inbounds [2 x %"any*"], ptr %varargslots190, i64 0, i64 1 - store %"any*" %111, ptr %112, align 16 - %113 = call i64 @std.io.printfn(ptr %retparam193, ptr @.str.34, i64 6, ptr %varargslots190, i64 2) - store %"char[]" zeroinitializer, ptr %taddr197, align 8 - %114 = insertvalue %"any*" undef, ptr %taddr197, 0 - %115 = insertvalue %"any*" %114, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %116 = getelementptr inbounds [2 x %"any*"], ptr %varargslots196, i64 0, i64 0 - store %"any*" %115, ptr %116, align 16 - store %"char[]" { ptr @.str.38, i64 5 }, ptr %taddr198, align 8 - %117 = insertvalue %"any*" undef, ptr %taddr198, 0 - %118 = insertvalue %"any*" %117, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %119 = getelementptr inbounds [2 x %"any*"], ptr %varargslots196, i64 0, i64 1 - store %"any*" %118, ptr %119, align 16 - %120 = call i64 @std.io.printfn(ptr %retparam199, ptr @.str.37, i64 6, ptr %varargslots196, i64 2) - store %"char[]" { ptr @.str.40, i64 3 }, ptr %taddr203, align 8 - %121 = insertvalue %"any*" undef, ptr %taddr203, 0 - %122 = insertvalue %"any*" %121, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %123 = getelementptr inbounds [2 x %"any*"], ptr %varargslots202, i64 0, i64 0 - store %"any*" %122, ptr %123, align 16 - store %"char[]" { ptr @.str.41, i64 3 }, ptr %taddr204, align 8 - %124 = insertvalue %"any*" undef, ptr %taddr204, 0 - %125 = insertvalue %"any*" %124, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %126 = getelementptr inbounds [2 x %"any*"], ptr %varargslots202, i64 0, i64 1 - store %"any*" %125, ptr %126, align 16 - %127 = call i64 @std.io.printfn(ptr %retparam205, ptr @.str.39, i64 6, ptr %varargslots202, i64 2) - store %"char[]" { ptr @.str.43, i64 4 }, ptr %taddr209, align 8 - %128 = insertvalue %"any*" undef, ptr %taddr209, 0 - %129 = insertvalue %"any*" %128, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %130 = getelementptr inbounds [1 x %"any*"], ptr %varargslots208, i64 0, i64 0 - store %"any*" %129, ptr %130, align 16 - %131 = call i64 @std.io.printfn(ptr %retparam210, ptr @.str.42, i64 8, ptr %varargslots208, i64 1) - store %"char[]" { ptr @.str.45, i64 1 }, ptr %taddr214, align 8 - %132 = insertvalue %"any*" undef, ptr %taddr214, 0 - %133 = insertvalue %"any*" %132, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %134 = getelementptr inbounds [2 x %"any*"], ptr %varargslots213, i64 0, i64 0 - store %"any*" %133, ptr %134, align 16 - store %"char[]" { ptr @.str.46, i64 3 }, ptr %taddr215, align 8 - %135 = insertvalue %"any*" undef, ptr %taddr215, 0 - %136 = insertvalue %"any*" %135, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %137 = getelementptr inbounds [2 x %"any*"], ptr %varargslots213, i64 0, i64 1 - store %"any*" %136, ptr %137, align 16 - %138 = call i64 @std.io.printfn(ptr %retparam216, ptr @.str.44, i64 6, ptr %varargslots213, i64 2) - store %"char[]" { ptr @.str.48, i64 1 }, ptr %taddr220, align 8 - %139 = insertvalue %"any*" undef, ptr %taddr220, 0 - %140 = insertvalue %"any*" %139, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %141 = getelementptr inbounds [2 x %"any*"], ptr %varargslots219, i64 0, i64 0 - store %"any*" %140, ptr %141, align 16 - store %"char[]" { ptr @.str.49, i64 5 }, ptr %taddr221, align 8 - %142 = insertvalue %"any*" undef, ptr %taddr221, 0 - %143 = insertvalue %"any*" %142, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %144 = getelementptr inbounds [2 x %"any*"], ptr %varargslots219, i64 0, i64 1 - store %"any*" %143, ptr %144, align 16 - %145 = call i64 @std.io.printfn(ptr %retparam222, ptr @.str.47, i64 6, ptr %varargslots219, i64 2) + store %"any*" %111, ptr %varargslots215, align 16 + %112 = call i64 @std.io.printfn(ptr %retparam217, ptr @.str.42, i64 8, ptr %varargslots215, i64 1) + store %"char[]" { ptr @.str.45, i64 1 }, ptr %taddr221, align 8 + %113 = insertvalue %"any*" undef, ptr %taddr221, 0 + %114 = insertvalue %"any*" %113, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %114, ptr %varargslots220, align 16 + store %"char[]" { ptr @.str.46, i64 3 }, ptr %taddr222, align 8 + %115 = insertvalue %"any*" undef, ptr %taddr222, 0 + %116 = insertvalue %"any*" %115, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd223 = getelementptr inbounds i8, ptr %varargslots220, i64 16 + store %"any*" %116, ptr %ptradd223, align 16 + %117 = call i64 @std.io.printfn(ptr %retparam224, ptr @.str.44, i64 6, ptr %varargslots220, i64 2) + store %"char[]" { ptr @.str.48, i64 1 }, ptr %taddr228, align 8 + %118 = insertvalue %"any*" undef, ptr %taddr228, 0 + %119 = insertvalue %"any*" %118, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %119, ptr %varargslots227, align 16 + store %"char[]" { ptr @.str.49, i64 5 }, ptr %taddr229, align 8 + %120 = insertvalue %"any*" undef, ptr %taddr229, 0 + %121 = insertvalue %"any*" %120, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd230 = getelementptr inbounds i8, ptr %varargslots227, i64 16 + store %"any*" %121, ptr %ptradd230, align 16 + %122 = call i64 @std.io.printfn(ptr %retparam231, ptr @.str.47, i64 6, ptr %varargslots227, i64 2) ret void } - +; Function Attrs: define void @test.main() #0 { entry: %varargslots = alloca [1 x %"any*"], align 16 @@ -739,140 +727,151 @@ entry: %varargslots8 = alloca [2 x %"any*"], align 16 %taddr9 = alloca i64, align 8 %taddr10 = alloca i64, align 8 - %retparam11 = alloca i64, align 8 - %varargslots12 = alloca [2 x %"any*"], align 16 - %taddr13 = alloca i64, align 8 + %retparam12 = alloca i64, align 8 + %varargslots13 = alloca [2 x %"any*"], align 16 %taddr14 = alloca i64, align 8 - %retparam15 = alloca i64, align 8 - %varargslots16 = alloca [2 x %"any*"], align 16 - %taddr17 = alloca i64, align 8 - %taddr18 = alloca i64, align 8 - %retparam19 = alloca i64, align 8 - %varargslots20 = alloca [2 x %"any*"], align 16 - %taddr21 = alloca i64, align 8 - %taddr22 = alloca i64, align 8 - %retparam23 = alloca i64, align 8 - %varargslots24 = alloca [2 x %"any*"], align 16 + %taddr15 = alloca i64, align 8 + %retparam17 = alloca i64, align 8 + %varargslots18 = alloca [2 x %"any*"], align 16 + %taddr19 = alloca i64, align 8 + %taddr20 = alloca i64, align 8 + %retparam22 = alloca i64, align 8 + %varargslots23 = alloca [2 x %"any*"], align 16 + %taddr24 = alloca i64, align 8 %taddr25 = alloca i64, align 8 - %taddr26 = alloca i64, align 8 %retparam27 = alloca i64, align 8 %varargslots28 = alloca [2 x %"any*"], align 16 %taddr29 = alloca i64, align 8 %taddr30 = alloca i64, align 8 - %retparam31 = alloca i64, align 8 - %varargslots32 = alloca [1 x %"any*"], align 16 - %taddr33 = alloca i64, align 8 - %retparam34 = alloca i64, align 8 - %varargslots35 = alloca [2 x %"any*"], align 16 - %taddr36 = alloca i64, align 8 - %taddr37 = alloca i64, align 8 - %retparam38 = alloca i64, align 8 + %retparam32 = alloca i64, align 8 + %varargslots33 = alloca [2 x %"any*"], align 16 + %taddr34 = alloca i64, align 8 + %taddr35 = alloca i64, align 8 + %retparam37 = alloca i64, align 8 + %varargslots38 = alloca [1 x %"any*"], align 16 + %taddr39 = alloca i64, align 8 + %retparam40 = alloca i64, align 8 + %varargslots41 = alloca [2 x %"any*"], align 16 + %taddr42 = alloca i64, align 8 + %taddr43 = alloca i64, align 8 + %retparam45 = alloca i64, align 8 store i64 4, ptr %taddr, align 8 %0 = insertvalue %"any*" undef, ptr %taddr, 0 %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %2 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %1, ptr %2, align 16 - %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.50, i64 7, ptr %varargslots, i64 1) + store %"any*" %1, ptr %varargslots, align 16 + %2 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.50, i64 7, ptr %varargslots, i64 1) store i64 1, ptr %taddr2, align 8 - %4 = insertvalue %"any*" undef, ptr %taddr2, 0 - %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %6 = getelementptr inbounds [1 x %"any*"], ptr %varargslots1, i64 0, i64 0 - store %"any*" %5, ptr %6, align 16 - %7 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.51, i64 7, ptr %varargslots1, i64 1) + %3 = insertvalue %"any*" undef, ptr %taddr2, 0 + %4 = insertvalue %"any*" %3, i64 ptrtoint (ptr @"$ct.long" to i64), 1 + store %"any*" %4, ptr %varargslots1, align 16 + %5 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.51, i64 7, ptr %varargslots1, i64 1) store i64 0, ptr %taddr5, align 8 - %8 = insertvalue %"any*" undef, ptr %taddr5, 0 - %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %10 = getelementptr inbounds [2 x %"any*"], ptr %varargslots4, i64 0, i64 0 - store %"any*" %9, ptr %10, align 16 + %6 = insertvalue %"any*" undef, ptr %taddr5, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %7, ptr %varargslots4, align 16 store i64 4, ptr %taddr6, align 8 - %11 = insertvalue %"any*" undef, ptr %taddr6, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %13 = getelementptr inbounds [2 x %"any*"], ptr %varargslots4, i64 0, i64 1 - store %"any*" %12, ptr %13, align 16 - %14 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.52, i64 8, ptr %varargslots4, i64 2) + %8 = insertvalue %"any*" undef, ptr %taddr6, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots4, i64 16 + store %"any*" %9, ptr %ptradd, align 16 + %10 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.52, i64 8, ptr %varargslots4, i64 2) store i64 2, ptr %taddr9, align 8 - %15 = insertvalue %"any*" undef, ptr %taddr9, 0 - %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %17 = getelementptr inbounds [2 x %"any*"], ptr %varargslots8, i64 0, i64 0 - store %"any*" %16, ptr %17, align 16 + %11 = insertvalue %"any*" undef, ptr %taddr9, 0 + %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %12, ptr %varargslots8, align 16 store i64 2, ptr %taddr10, align 8 - %18 = insertvalue %"any*" undef, ptr %taddr10, 0 - %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %20 = getelementptr inbounds [2 x %"any*"], ptr %varargslots8, i64 0, i64 1 - store %"any*" %19, ptr %20, align 16 - %21 = call i64 @std.io.printfn(ptr %retparam11, ptr @.str.53, i64 8, ptr %varargslots8, i64 2) - store i64 4, ptr %taddr13, align 8 - %22 = insertvalue %"any*" undef, ptr %taddr13, 0 - %23 = insertvalue %"any*" %22, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %24 = getelementptr inbounds [2 x %"any*"], ptr %varargslots12, i64 0, i64 0 - store %"any*" %23, ptr %24, align 16 + %13 = insertvalue %"any*" undef, ptr %taddr10, 0 + %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + %ptradd11 = getelementptr inbounds i8, ptr %varargslots8, i64 16 + store %"any*" %14, ptr %ptradd11, align 16 + %15 = call i64 @std.io.printfn(ptr %retparam12, ptr @.str.53, i64 8, ptr %varargslots8, i64 2) store i64 4, ptr %taddr14, align 8 - %25 = insertvalue %"any*" undef, ptr %taddr14, 0 - %26 = insertvalue %"any*" %25, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %27 = getelementptr inbounds [2 x %"any*"], ptr %varargslots12, i64 0, i64 1 - store %"any*" %26, ptr %27, align 16 - %28 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.54, i64 8, ptr %varargslots12, i64 2) - store i64 4, ptr %taddr17, align 8 - %29 = insertvalue %"any*" undef, ptr %taddr17, 0 - %30 = insertvalue %"any*" %29, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %31 = getelementptr inbounds [2 x %"any*"], ptr %varargslots16, i64 0, i64 0 - store %"any*" %30, ptr %31, align 16 - store i64 4, ptr %taddr18, align 8 - %32 = insertvalue %"any*" undef, ptr %taddr18, 0 - %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %34 = getelementptr inbounds [2 x %"any*"], ptr %varargslots16, i64 0, i64 1 - store %"any*" %33, ptr %34, align 16 - %35 = call i64 @std.io.printfn(ptr %retparam19, ptr @.str.55, i64 8, ptr %varargslots16, i64 2) - store i64 4, ptr %taddr21, align 8 - %36 = insertvalue %"any*" undef, ptr %taddr21, 0 + %16 = insertvalue %"any*" undef, ptr %taddr14, 0 + %17 = insertvalue %"any*" %16, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %17, ptr %varargslots13, align 16 + store i64 4, ptr %taddr15, align 8 + %18 = insertvalue %"any*" undef, ptr %taddr15, 0 + %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + %ptradd16 = getelementptr inbounds i8, ptr %varargslots13, i64 16 + store %"any*" %19, ptr %ptradd16, align 16 + %20 = call i64 @std.io.printfn(ptr %retparam17, ptr @.str.54, i64 8, ptr %varargslots13, i64 2) + store i64 4, ptr %taddr19, align 8 + %21 = insertvalue %"any*" undef, ptr %taddr19, 0 + %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %22, ptr %varargslots18, align 16 + store i64 4, ptr %taddr20, align 8 + %23 = insertvalue %"any*" undef, ptr %taddr20, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + %ptradd21 = getelementptr inbounds i8, ptr %varargslots18, i64 16 + store %"any*" %24, ptr %ptradd21, align 16 + %25 = call i64 @std.io.printfn(ptr %retparam22, ptr @.str.55, i64 8, ptr %varargslots18, i64 2) + store i64 4, ptr %taddr24, align 8 + %26 = insertvalue %"any*" undef, ptr %taddr24, 0 + %27 = insertvalue %"any*" %26, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %27, ptr %varargslots23, align 16 + store i64 4, ptr %taddr25, align 8 + %28 = insertvalue %"any*" undef, ptr %taddr25, 0 + %29 = insertvalue %"any*" %28, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + %ptradd26 = getelementptr inbounds i8, ptr %varargslots23, i64 16 + store %"any*" %29, ptr %ptradd26, align 16 + %30 = call i64 @std.io.printfn(ptr %retparam27, ptr @.str.56, i64 9, ptr %varargslots23, i64 2) + store i64 5, ptr %taddr29, align 8 + %31 = insertvalue %"any*" undef, ptr %taddr29, 0 + %32 = insertvalue %"any*" %31, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %32, ptr %varargslots28, align 16 + store i64 1, ptr %taddr30, align 8 + %33 = insertvalue %"any*" undef, ptr %taddr30, 0 + %34 = insertvalue %"any*" %33, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + %ptradd31 = getelementptr inbounds i8, ptr %varargslots28, i64 16 + store %"any*" %34, ptr %ptradd31, align 16 + %35 = call i64 @std.io.printfn(ptr %retparam32, ptr @.str.57, i64 9, ptr %varargslots28, i64 2) + store i64 8, ptr %taddr34, align 8 + %36 = insertvalue %"any*" undef, ptr %taddr34, 0 %37 = insertvalue %"any*" %36, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %38 = getelementptr inbounds [2 x %"any*"], ptr %varargslots20, i64 0, i64 0 - store %"any*" %37, ptr %38, align 16 - store i64 4, ptr %taddr22, align 8 - %39 = insertvalue %"any*" undef, ptr %taddr22, 0 - %40 = insertvalue %"any*" %39, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %41 = getelementptr inbounds [2 x %"any*"], ptr %varargslots20, i64 0, i64 1 - store %"any*" %40, ptr %41, align 16 - %42 = call i64 @std.io.printfn(ptr %retparam23, ptr @.str.56, i64 9, ptr %varargslots20, i64 2) - store i64 5, ptr %taddr25, align 8 - %43 = insertvalue %"any*" undef, ptr %taddr25, 0 - %44 = insertvalue %"any*" %43, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %45 = getelementptr inbounds [2 x %"any*"], ptr %varargslots24, i64 0, i64 0 - store %"any*" %44, ptr %45, align 16 - store i64 1, ptr %taddr26, align 8 - %46 = insertvalue %"any*" undef, ptr %taddr26, 0 + store %"any*" %37, ptr %varargslots33, align 16 + store i64 4, ptr %taddr35, align 8 + %38 = insertvalue %"any*" undef, ptr %taddr35, 0 + %39 = insertvalue %"any*" %38, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + %ptradd36 = getelementptr inbounds i8, ptr %varargslots33, i64 16 + store %"any*" %39, ptr %ptradd36, align 16 + %40 = call i64 @std.io.printfn(ptr %retparam37, ptr @.str.58, i64 10, ptr %varargslots33, i64 2) + store i64 4, ptr %taddr39, align 8 + %41 = insertvalue %"any*" undef, ptr %taddr39, 0 + %42 = insertvalue %"any*" %41, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %42, ptr %varargslots38, align 16 + %43 = call i64 @std.io.printfn(ptr %retparam40, ptr @.str.59, i64 7, ptr %varargslots38, i64 1) + store i64 8, ptr %taddr42, align 8 + %44 = insertvalue %"any*" undef, ptr %taddr42, 0 + %45 = insertvalue %"any*" %44, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %45, ptr %varargslots41, align 16 + store i64 4, ptr %taddr43, align 8 + %46 = insertvalue %"any*" undef, ptr %taddr43, 0 %47 = insertvalue %"any*" %46, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %48 = getelementptr inbounds [2 x %"any*"], ptr %varargslots24, i64 0, i64 1 - store %"any*" %47, ptr %48, align 16 - %49 = call i64 @std.io.printfn(ptr %retparam27, ptr @.str.57, i64 9, ptr %varargslots24, i64 2) - store i64 8, ptr %taddr29, align 8 - %50 = insertvalue %"any*" undef, ptr %taddr29, 0 - %51 = insertvalue %"any*" %50, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %52 = getelementptr inbounds [2 x %"any*"], ptr %varargslots28, i64 0, i64 0 - store %"any*" %51, ptr %52, align 16 - store i64 4, ptr %taddr30, align 8 - %53 = insertvalue %"any*" undef, ptr %taddr30, 0 - %54 = insertvalue %"any*" %53, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %55 = getelementptr inbounds [2 x %"any*"], ptr %varargslots28, i64 0, i64 1 - store %"any*" %54, ptr %55, align 16 - %56 = call i64 @std.io.printfn(ptr %retparam31, ptr @.str.58, i64 10, ptr %varargslots28, i64 2) - store i64 4, ptr %taddr33, align 8 - %57 = insertvalue %"any*" undef, ptr %taddr33, 0 - %58 = insertvalue %"any*" %57, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %59 = getelementptr inbounds [1 x %"any*"], ptr %varargslots32, i64 0, i64 0 - store %"any*" %58, ptr %59, align 16 - %60 = call i64 @std.io.printfn(ptr %retparam34, ptr @.str.59, i64 7, ptr %varargslots32, i64 1) - store i64 8, ptr %taddr36, align 8 - %61 = insertvalue %"any*" undef, ptr %taddr36, 0 - %62 = insertvalue %"any*" %61, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %63 = getelementptr inbounds [2 x %"any*"], ptr %varargslots35, i64 0, i64 0 - store %"any*" %62, ptr %63, align 16 - store i64 4, ptr %taddr37, align 8 - %64 = insertvalue %"any*" undef, ptr %taddr37, 0 - %65 = insertvalue %"any*" %64, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %66 = getelementptr inbounds [2 x %"any*"], ptr %varargslots35, i64 0, i64 1 - store %"any*" %65, ptr %66, align 16 - %67 = call i64 @std.io.printfn(ptr %retparam38, ptr @.str.60, i64 10, ptr %varargslots35, i64 2) + %ptradd44 = getelementptr inbounds i8, ptr %varargslots41, i64 16 + store %"any*" %47, ptr %ptradd44, align 16 + %48 = call i64 @std.io.printfn(ptr %retparam45, ptr @.str.60, i64 10, ptr %varargslots41, i64 2) call void @test.test(i32 10) ret void -} \ No newline at end of file +} + +; Function Attrs: +define i32 @main(i32 %0, ptr %1) #0 { +entry: + call void @test.main() + ret i32 0 +} + +; Function Attrs: +declare ptr @std.io.stdout() #0 + +; Function Attrs: +declare i64 @std.io.File.write(ptr, ptr, ptr, i64) #0 + +; Function Attrs: +declare i64 @std.io.File.write_byte(ptr, i8 zeroext) #0 + +; Function Attrs: +declare i64 @std.io.File.flush(ptr) #0 + +; Function Attrs: +declare i64 @std.io.printfn(ptr, ptr, i64, ptr, i64) #0 \ No newline at end of file diff --git a/test/test_suite/compile_time/ct_value_from_access.c3t b/test/test_suite/compile_time/ct_value_from_access.c3t index 1015ca9af..390363623 100644 --- a/test/test_suite/compile_time/ct_value_from_access.c3t +++ b/test/test_suite/compile_time/ct_value_from_access.c3t @@ -23,7 +23,7 @@ fn void main() @test.X = constant %Abc { i32 2, i32 3 }, align 4 @test.Y = constant i32 3, align 4 -@test.Z = local_unnamed_addr constant ptr getelementptr inbounds (%Abc, ptr @test.X, i32 0, i32 1), align 8 +@test.Z = local_unnamed_addr constant ptr getelementptr inbounds (i8, ptr @test.X, i64 4), align 8 define void @test.main() #0 { entry: @@ -34,7 +34,7 @@ entry: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @test.X, i32 8, i1 false) store i32 3, ptr %y, align 4 store ptr @test.Y, ptr %yy, align 8 - store ptr getelementptr inbounds (%Abc, ptr @test.X, i32 0, i32 1), ptr %z, align 8 + store ptr getelementptr inbounds (i8, ptr @test.X, i64 4), ptr %z, align 8 ret void } diff --git a/test/test_suite/compile_time/typed_ct_vars.c3t b/test/test_suite/compile_time/typed_ct_vars.c3t index 5c2ea6438..dcfb36bac 100644 --- a/test/test_suite/compile_time/typed_ct_vars.c3t +++ b/test/test_suite/compile_time/typed_ct_vars.c3t @@ -21,9 +21,8 @@ entry: %y = alloca %Foo, align 4 %z = alloca %Foo, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %y, ptr align 4 @.__const, i32 8, i1 false) - %0 = getelementptr inbounds %Foo, ptr %z, i32 0, i32 0 - store i32 0, ptr %0, align 4 - %1 = getelementptr inbounds %Foo, ptr %z, i32 0, i32 1 - store i32 0, ptr %1, align 4 + store i32 0, ptr %z, align 4 + %ptradd = getelementptr inbounds i8, ptr %z, i64 4 + store i32 0, ptr %ptradd, align 4 ret void } \ No newline at end of file diff --git a/test/test_suite/compile_time/untyped_conversions.c3t b/test/test_suite/compile_time/untyped_conversions.c3t index f36d05853..4744b54cf 100644 --- a/test/test_suite/compile_time/untyped_conversions.c3t +++ b/test/test_suite/compile_time/untyped_conversions.c3t @@ -28,6 +28,7 @@ fn void main() %Foo = type { i32, i32 } %"int[]" = type { ptr, i64 } %"any*" = type { ptr, i64 } + @"$ct.test.Foo" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 @.str = private unnamed_addr constant [9 x i8] c"%s %s %s\00", align 1 @"$ct.a2$int" = linkonce global %.introspect { i8 15, i64 0, ptr null, i64 8, i64 ptrtoint (ptr @"$ct.int" to i64), i64 2, [0 x i64] zeroinitializer }, align 8 @@ -48,6 +49,7 @@ fn void main() @.__const.7 = private unnamed_addr constant [2 x i32] [i32 2, i32 7], align 4 @.__const.8 = private unnamed_addr constant [2 x i32] [i32 2, i32 7], align 4 +; Function Attrs: define void @test.test(i64 %0, ptr %1, i64 %2, double %3) #0 { entry: %a = alloca [2 x i32], align 4 @@ -57,25 +59,25 @@ entry: %retparam = alloca i64, align 8 store i64 %0, ptr %a, align 4 store ptr %1, ptr %b, align 8 - %ptroffset = getelementptr inbounds i64, ptr %b, i64 1 - store i64 %2, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %b, i64 8 + store i64 %2, ptr %ptradd, align 8 store double %3, ptr %c, align 8 %4 = insertvalue %"any*" undef, ptr %a, 0 %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.a2$int" to i64), 1 - %6 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %5, ptr %6, align 16 - %7 = insertvalue %"any*" undef, ptr %b, 0 - %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 - %9 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %8, ptr %9, align 16 - %10 = insertvalue %"any*" undef, ptr %c, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.v2$int" to i64), 1 - %12 = getelementptr inbounds [3 x %"any*"], ptr %varargslots, i64 0, i64 2 - store %"any*" %11, ptr %12, align 16 - %13 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 8, ptr %varargslots, i64 3) + store %"any*" %5, ptr %varargslots, align 16 + %6 = insertvalue %"any*" undef, ptr %b, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 + %ptradd1 = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %7, ptr %ptradd1, align 16 + %8 = insertvalue %"any*" undef, ptr %c, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.v2$int" to i64), 1 + %ptradd2 = getelementptr inbounds i8, ptr %varargslots, i64 32 + store %"any*" %9, ptr %ptradd2, align 16 + %10 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 8, ptr %varargslots, i64 3) ret void } +; Function Attrs: define void @test.main() #0 { entry: %abc = alloca [1 x %Foo], align 4 @@ -85,49 +87,47 @@ entry: %varargslots = alloca [4 x %"any*"], align 16 %retparam = alloca i64, align 8 %literal = alloca [2 x i32], align 4 - %literal1 = alloca [2 x i32], align 4 + %literal4 = alloca [2 x i32], align 4 %taddr = alloca <2 x i32>, align 8 - %literal2 = alloca [2 x i32], align 4 - %literal3 = alloca [2 x i32], align 4 - %taddr4 = alloca <2 x i32>, align 8 + %literal5 = alloca [2 x i32], align 4 + %literal6 = alloca [2 x i32], align 4 + %taddr7 = alloca <2 x i32>, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %abc, ptr align 4 @.__const, i32 8, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %defg, ptr align 4 @.__const.1, i32 8, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %y, ptr align 4 @.__const.2, i32 8, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 16 %y2, ptr align 16 @.__const.3, i32 16, i1 false) %0 = insertvalue %"any*" undef, ptr %y, 0 %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.a1$a2$int" to i64), 1 - %2 = getelementptr inbounds [4 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %1, ptr %2, align 16 - %3 = insertvalue %"any*" undef, ptr %y2, 0 - %4 = insertvalue %"any*" %3, i64 ptrtoint (ptr @"$ct.a1$a2$double" to i64), 1 - %5 = getelementptr inbounds [4 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %4, ptr %5, align 16 - %6 = getelementptr inbounds %Foo, ptr %defg, i32 0, i32 0 - %7 = insertvalue %"any*" undef, ptr %6, 0 - %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %9 = getelementptr inbounds [4 x %"any*"], ptr %varargslots, i64 0, i64 2 - store %"any*" %8, ptr %9, align 16 - %10 = getelementptr inbounds %Foo, ptr %defg, i32 0, i32 1 - %11 = insertvalue %"any*" undef, ptr %10, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %13 = getelementptr inbounds [4 x %"any*"], ptr %varargslots, i64 0, i64 3 - store %"any*" %12, ptr %13, align 16 - %14 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.4, i64 14, ptr %varargslots, i64 4) + store %"any*" %1, ptr %varargslots, align 16 + %2 = insertvalue %"any*" undef, ptr %y2, 0 + %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.a1$a2$double" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %3, ptr %ptradd, align 16 + %4 = insertvalue %"any*" undef, ptr %defg, 0 + %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd1 = getelementptr inbounds i8, ptr %varargslots, i64 32 + store %"any*" %5, ptr %ptradd1, align 16 + %ptradd2 = getelementptr inbounds i8, ptr %defg, i64 4 + %6 = insertvalue %"any*" undef, ptr %ptradd2, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd3 = getelementptr inbounds i8, ptr %varargslots, i64 48 + store %"any*" %7, ptr %ptradd3, align 16 + %8 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.4, i64 14, ptr %varargslots, i64 4) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.5, i32 8, i1 false) - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.6, i32 8, i1 false) - %15 = insertvalue %"int[]" undef, ptr %literal1, 0 - %16 = insertvalue %"int[]" %15, i64 2, 1 - %17 = load i64, ptr %literal, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const.6, i32 8, i1 false) + %9 = insertvalue %"int[]" undef, ptr %literal4, 0 + %10 = insertvalue %"int[]" %9, i64 2, 1 + %11 = load i64, ptr %literal, align 4 store <2 x i32> , ptr %taddr, align 8 - %18 = load double, ptr %taddr, align 8 - call void @test.test(i64 %17, ptr %literal1, i64 2, double %18) - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal2, ptr align 4 @.__const.7, i32 8, i1 false) - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.8, i32 8, i1 false) - %19 = insertvalue %"int[]" undef, ptr %literal3, 0 - %20 = insertvalue %"int[]" %19, i64 2, 1 - %21 = load i64, ptr %literal2, align 4 - store <2 x i32> , ptr %taddr4, align 8 - %22 = load double, ptr %taddr4, align 8 - call void @test.test(i64 %21, ptr %literal3, i64 2, double %22) + %12 = load double, ptr %taddr, align 8 + call void @test.test(i64 %11, ptr %literal4, i64 2, double %12) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal5, ptr align 4 @.__const.7, i32 8, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal6, ptr align 4 @.__const.8, i32 8, i1 false) + %13 = insertvalue %"int[]" undef, ptr %literal6, 0 + %14 = insertvalue %"int[]" %13, i64 2, 1 + %15 = load i64, ptr %literal5, align 4 + store <2 x i32> , ptr %taddr7, align 8 + %16 = load double, ptr %taddr7, align 8 + call void @test.test(i64 %15, ptr %literal6, i64 2, double %16) ret void } diff --git a/test/test_suite/compile_time_introspection/parentof.c3t b/test/test_suite/compile_time_introspection/parentof.c3t index e1b28f3cc..659b6b266 100644 --- a/test/test_suite/compile_time_introspection/parentof.c3t +++ b/test/test_suite/compile_time_introspection/parentof.c3t @@ -24,26 +24,27 @@ fn void main() @"$ct.foo.Bar" = linkonce global %.introspect { i8 10, i64 ptrtoint (ptr @"$ct.foo.Foo" to i64), ptr null, i64 4, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8 @"$ct.void" = linkonce global %.introspect { i8 0, i64 0, ptr null, i64 1, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 +; Function Attrs: define void @foo.main() #0 { entry: %x = alloca i64, align 8 store i64 ptrtoint (ptr @"$ct.foo.Foo" to i64), ptr %x, align 8 %0 = load i64, ptr %x, align 8 %"introspect*" = inttoptr i64 %0 to ptr - %1 = getelementptr inbounds %.introspect, ptr %"introspect*", i32 0, i32 1 - %typeid.parent = load i64, ptr %1, align 8 - %2 = icmp eq i64 %typeid.parent, 0 - %3 = select i1 %2, i64 ptrtoint (ptr @"$ct.void" to i64), i64 %typeid.parent - %eq = icmp eq i64 %3, ptrtoint (ptr @"$ct.void" to i64) + %ptradd = getelementptr inbounds i8, ptr %"introspect*", i64 8 + %typeid.parent = load i64, ptr %ptradd, align 8 + %1 = icmp eq i64 %typeid.parent, 0 + %2 = select i1 %1, i64 ptrtoint (ptr @"$ct.void" to i64), i64 %typeid.parent + %eq = icmp eq i64 %2, ptrtoint (ptr @"$ct.void" to i64) call void @llvm.assume(i1 %eq) store i64 ptrtoint (ptr @"$ct.foo.Bar" to i64), ptr %x, align 8 - %4 = load i64, ptr %x, align 8 - %"introspect*1" = inttoptr i64 %4 to ptr - %5 = getelementptr inbounds %.introspect, ptr %"introspect*1", i32 0, i32 1 - %typeid.parent2 = load i64, ptr %5, align 8 - %6 = icmp eq i64 %typeid.parent2, 0 - %7 = select i1 %6, i64 ptrtoint (ptr @"$ct.void" to i64), i64 %typeid.parent2 - %eq3 = icmp eq i64 %7, ptrtoint (ptr @"$ct.foo.Foo" to i64) - call void @llvm.assume(i1 %eq3) + %3 = load i64, ptr %x, align 8 + %"introspect*1" = inttoptr i64 %3 to ptr + %ptradd2 = getelementptr inbounds i8, ptr %"introspect*1", i64 8 + %typeid.parent3 = load i64, ptr %ptradd2, align 8 + %4 = icmp eq i64 %typeid.parent3, 0 + %5 = select i1 %4, i64 ptrtoint (ptr @"$ct.void" to i64), i64 %typeid.parent3 + %eq4 = icmp eq i64 %5, ptrtoint (ptr @"$ct.foo.Foo" to i64) + call void @llvm.assume(i1 %eq4) ret void } \ No newline at end of file diff --git a/test/test_suite/concurrency/atomic_load_store.c3t b/test/test_suite/concurrency/atomic_load_store.c3t index 25a11c826..61d5d6e03 100644 --- a/test/test_suite/concurrency/atomic_load_store.c3t +++ b/test/test_suite/concurrency/atomic_load_store.c3t @@ -40,8 +40,7 @@ entry: store atomic volatile i32 %add1, ptr %a monotonic, align 4 %4 = insertvalue %"any*" undef, ptr %a, 0 %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %6 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %5, ptr %6, align 16 - %7 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) + store %"any*" %5, ptr %varargslots, align 16 + %6 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) ret void } diff --git a/test/test_suite/concurrency/atomic_load_store_debug.c3t b/test/test_suite/concurrency/atomic_load_store_debug.c3t index 837d33d7d..01859f393 100644 --- a/test/test_suite/concurrency/atomic_load_store_debug.c3t +++ b/test/test_suite/concurrency/atomic_load_store_debug.c3t @@ -27,6 +27,7 @@ fn void main() @.str = private unnamed_addr constant [3 x i8] c"%d\00", align 1 @"$ct.int" = linkonce global %.introspect { i8 2, i64 0, ptr null, i64 4, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 +; Function Attrs: define void @test.main() #0 !dbg !6 { entry: %a = alloca i32, align 4 @@ -50,12 +51,12 @@ entry: store atomic volatile i32 %add1, ptr %a monotonic, align 4, !dbg !29 %4 = insertvalue %"any*" undef, ptr %a, 0, !dbg !31 %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.int" to i64), 1, !dbg !31 - %6 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0, !dbg !31 - store %"any*" %5, ptr %6, align 16, !dbg !31 - %7 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1), !dbg !32 + store %"any*" %5, ptr %varargslots, align 16, !dbg !31 + %6 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1), !dbg !32 ret void, !dbg !32 } +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 !dbg !33 { entry: call void @test.main(), !dbg !39 @@ -64,7 +65,7 @@ entry: declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 - +; Function Attrs: declare i64 @std.io.printfn(ptr, ptr, i64, ptr, i64) #0 declare i1 @llvm.expect.i1(i1, i1) #2 diff --git a/test/test_suite/constants/const_var_copy.c3t b/test/test_suite/constants/const_var_copy.c3t index 4bf57d2ab..f5a1305b9 100644 --- a/test/test_suite/constants/const_var_copy.c3t +++ b/test/test_suite/constants/const_var_copy.c3t @@ -14,16 +14,17 @@ fn void test(int z) @foo.FOO = local_unnamed_addr constant { [50 x i8], i8, [49 x i8] } { [50 x i8] zeroinitializer, i8 1, [49 x i8] zeroinitializer }, align 16 @foo.BAR = local_unnamed_addr constant <4 x i32> , align 16 +; Function Attrs: define void @foo.test(i32 %0) #0 { entry: %s = alloca i8, align 1 %zd = alloca i32, align 4 %sext = sext i32 %0 to i64 - %1 = getelementptr inbounds [100 x i8], ptr @foo.FOO, i64 0, i64 %sext - %2 = load i8, ptr %1, align 1 - store i8 %2, ptr %s, align 1 + %ptradd = getelementptr inbounds i8, ptr @foo.FOO, i64 %sext + %1 = load i8, ptr %ptradd, align 1 + store i8 %1, ptr %s, align 1 %sext1 = sext i32 %0 to i64 - %3 = extractelement <4 x i32> , i64 %sext1 - store i32 %3, ptr %zd, align 4 + %2 = extractelement <4 x i32> , i64 %sext1 + store i32 %2, ptr %zd, align 4 ret void } diff --git a/test/test_suite/dynamic/dynamic_with_default.c3t b/test/test_suite/dynamic/dynamic_with_default.c3t index 0ac897252..60afc591d 100644 --- a/test/test_suite/dynamic/dynamic_with_default.c3t +++ b/test/test_suite/dynamic/dynamic_with_default.c3t @@ -32,75 +32,100 @@ define double @test.Abc.test(i64 %0, ptr %1) #0 { define double @test.Hello.test(ptr %0) #0 { define i32 @test.Hello.bye(ptr %0) #0 { +; Function Attrs: define void @test.main() #0 { entry: - %2 = getelementptr inbounds %"any*", ptr %x, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - %4 = getelementptr inbounds %"any*", ptr %x, i32 0, i32 0 - %5 = inttoptr i64 %3 to ptr + %z = alloca %Hello, align 4 + %x = alloca %"any*", align 8 + %z2 = alloca <2 x i32>, align 8 + %.inlinecache = alloca ptr, align 8 + %.cachedtype = alloca ptr, align 8 + %result = alloca <2 x i32>, align 8 + %result3 = alloca <2 x i32>, align 8 + %w = alloca i32, align 4 + %.inlinecache6 = alloca ptr, align 8 + %.cachedtype7 = alloca ptr, align 8 + store ptr null, ptr %.cachedtype7, align 8 + store ptr null, ptr %.cachedtype, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %z, ptr align 4 @.__const, i32 4, i1 false) + %0 = insertvalue %"any*" undef, ptr %z, 0 + %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.test.Hello" to i64), 1 + store %"any*" %1, ptr %x, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + %2 = load i64, ptr %ptradd, align 8 + %3 = inttoptr i64 %2 to ptr %type = load ptr, ptr %.cachedtype, align 8 - %6 = icmp eq ptr %5, %type - br i1 %6, label %cache_hit, label %cache_miss + %4 = icmp eq ptr %3, %type + br i1 %4, label %cache_hit, label %cache_miss + cache_miss: ; preds = %entry - %7 = getelementptr inbounds %.introspect, ptr %5, i32 0, i32 2 - %8 = load ptr, ptr %7, align 8 - %9 = call ptr @.dyn_search(ptr %8, ptr @"$sel.test") - store ptr %9, ptr %.inlinecache, align 8 - store ptr %5, ptr %.cachedtype, align 8 - br label %10 + %ptradd1 = getelementptr inbounds i8, ptr %3, i64 16 + %5 = load ptr, ptr %ptradd1, align 8 + %6 = call ptr @.dyn_search(ptr %5, ptr @"$sel.test") + store ptr %6, ptr %.inlinecache, align 8 + store ptr %3, ptr %.cachedtype, align 8 + br label %7 + cache_hit: ; preds = %entry %cache_hit_fn = load ptr, ptr %.inlinecache, align 8 - br label %10 -10: ; preds = %cache_hit, %cache_miss - %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %9, %cache_miss ] - %11 = icmp eq ptr %fn_phi, null - br i1 %11, label %missing_function, label %match -missing_function: ; preds = %10 - %12 = getelementptr inbounds { i64, ptr }, ptr %x, i32 0, i32 0 - %lo = load i64, ptr %12, align 8 - %13 = getelementptr inbounds { i64, ptr }, ptr %x, i32 0, i32 1 - %hi = load ptr, ptr %13, align 8 - %14 = call double @test.Abc.test(i64 %lo, ptr %hi) - store double %14, ptr %result, align 8 - %15 = load <2 x i32>, ptr %result, align 8 + br label %7 + +7: ; preds = %cache_hit, %cache_miss + %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %6, %cache_miss ] + %8 = icmp eq ptr %fn_phi, null + br i1 %8, label %missing_function, label %match + +missing_function: ; preds = %7 + %lo = load i64, ptr %x, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %x, i64 8 + %hi = load ptr, ptr %ptradd2, align 8 + %9 = call double @test.Abc.test(i64 %lo, ptr %hi) + store double %9, ptr %result, align 8 + %10 = load <2 x i32>, ptr %result, align 8 br label %after_call -match: ; preds = %10 - %16 = load ptr, ptr %4, align 8 - %17 = call double %fn_phi(ptr %16) - store double %17, ptr %result1, align 8 - %18 = load <2 x i32>, ptr %result1, align 8 + +match: ; preds = %7 + %11 = load ptr, ptr %x, align 8 + %12 = call double %fn_phi(ptr %11) + store double %12, ptr %result3, align 8 + %13 = load <2 x i32>, ptr %result3, align 8 br label %after_call + after_call: ; preds = %match, %missing_function - %result2 = phi <2 x i32> [ %15, %missing_function ], [ %18, %match ] - store <2 x i32> %result2, ptr %z2, align 8 - %19 = getelementptr inbounds %"any*", ptr %x, i32 0, i32 1 - %20 = load i64, ptr %19, align 8 - %21 = getelementptr inbounds %"any*", ptr %x, i32 0, i32 0 - %22 = inttoptr i64 %20 to ptr - %type5 = load ptr, ptr %.cachedtype4, align 8 - %23 = icmp eq ptr %22, %type5 - br i1 %23, label %cache_hit7, label %cache_miss6 -cache_miss6: ; preds = %after_call - %24 = getelementptr inbounds %.introspect, ptr %22, i32 0, i32 2 - %25 = load ptr, ptr %24, align 8 - %26 = call ptr @.dyn_search(ptr %25, ptr @"$sel.bye") - store ptr %26, ptr %.inlinecache3, align 8 - store ptr %22, ptr %.cachedtype4, align 8 - br label %27 -cache_hit7: ; preds = %after_call - %cache_hit_fn8 = load ptr, ptr %.inlinecache3, align 8 - br label %27 -27: ; preds = %cache_hit7, %cache_miss6 - %fn_phi9 = phi ptr [ %cache_hit_fn8, %cache_hit7 ], [ %26, %cache_miss6 ] - %28 = icmp eq ptr %fn_phi9, null - br i1 %28, label %missing_function10, label %match11 -missing_function10: ; preds = %27 - %29 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %29(ptr @.panic_msg, i64 40, ptr @.file, i64 23, ptr @.func, i64 4, i32 26) + %result4 = phi <2 x i32> [ %10, %missing_function ], [ %13, %match ] + store <2 x i32> %result4, ptr %z2, align 8 + %ptradd5 = getelementptr inbounds i8, ptr %x, i64 8 + %14 = load i64, ptr %ptradd5, align 8 + %15 = inttoptr i64 %14 to ptr + %type8 = load ptr, ptr %.cachedtype7, align 8 + %16 = icmp eq ptr %15, %type8 + br i1 %16, label %cache_hit11, label %cache_miss9 + +cache_miss9: ; preds = %after_call + %ptradd10 = getelementptr inbounds i8, ptr %15, i64 16 + %17 = load ptr, ptr %ptradd10, align 8 + %18 = call ptr @.dyn_search(ptr %17, ptr @"$sel.bye") + store ptr %18, ptr %.inlinecache6, align 8 + store ptr %15, ptr %.cachedtype7, align 8 + br label %19 + +cache_hit11: ; preds = %after_call + %cache_hit_fn12 = load ptr, ptr %.inlinecache6, align 8 + br label %19 + +19: ; preds = %cache_hit11, %cache_miss9 + %fn_phi13 = phi ptr [ %cache_hit_fn12, %cache_hit11 ], [ %18, %cache_miss9 ] + %20 = icmp eq ptr %fn_phi13, null + br i1 %20, label %missing_function14, label %match15 + +missing_function14: ; preds = %19 + %21 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %21(ptr @.panic_msg, i64 40, ptr @.file, i64 23, ptr @.func, i64 4, i32 26) unreachable -match11: ; preds = %27 - %30 = load ptr, ptr %21, align 8 - %31 = call i32 %fn_phi9(ptr %30) - store i32 %31, ptr %w, align 4 + +match15: ; preds = %19 + %22 = load ptr, ptr %x, align 8 + %23 = call i32 %fn_phi13(ptr %22) + store i32 %23, ptr %w, align 4 ret void } \ No newline at end of file diff --git a/test/test_suite/dynamic/inherit.c3t b/test/test_suite/dynamic/inherit.c3t index 4de10d8a6..4968dbdf1 100644 --- a/test/test_suite/dynamic/inherit.c3t +++ b/test/test_suite/dynamic/inherit.c3t @@ -39,8 +39,15 @@ fn void main() /* #expect: inherit.ll +%.introspect = type { i8, i64, ptr, i64, i64, i64, [0 x i64] } +%"any*" = type { ptr, i64 } +%"any*[]" = type { ptr, i64 } @"$ct.inherit.Test" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 8, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8 +@std.core.mem.thread_allocator = external thread_local global %"any*", align 8 +@"$sel.acquire" = linkonce_odr constant [8 x i8] c"acquire\00", align 1 +@.panic_msg = internal constant [45 x i8] c"No method 'acquire' could be found on target\00", align 1 +@.file = internal constant [17 x i8] c"mem_allocator.c3\00", align 1 @.func = internal constant [5 x i8] c"main\00", align 1 @std.core.builtin.panic = external global ptr, align 8 @"$ct.anyfault" = linkonce global %.introspect { i8 6, i64 0, ptr null, i64 8, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 @@ -53,6 +60,19 @@ fn void main() @"$sel.hello" = linkonce_odr constant [6 x i8] c"hello\00", align 1 @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 1, ptr @.static_initialize.0, ptr null }] +; Function Attrs: +define void @inherit.Test.tesT(ptr %0) #0 { +entry: + ret void +} + +; Function Attrs: +define void @inherit.Test.hello(ptr %0) #0 { +entry: + ret void +} + +; Function Attrs: define void @inherit.main() #0 { entry: %z = alloca %"any*", align 8 @@ -64,174 +84,212 @@ entry: %retparam = alloca ptr, align 8 %varargslots = alloca [1 x %"any*"], align 16 %indirectarg = alloca %"any*[]", align 8 - %.inlinecache2 = alloca ptr, align 8 - %.cachedtype3 = alloca ptr, align 8 + %.inlinecache4 = alloca ptr, align 8 + %.cachedtype5 = alloca ptr, align 8 %w = alloca %"any*", align 8 - %.inlinecache11 = alloca ptr, align 8 - %.cachedtype12 = alloca ptr, align 8 - store ptr null, ptr %.cachedtype12, align 8 - store ptr null, ptr %.cachedtype3, align 8 + %.inlinecache15 = alloca ptr, align 8 + %.cachedtype16 = alloca ptr, align 8 + store ptr null, ptr %.cachedtype16, align 8 + store ptr null, ptr %.cachedtype5, align 8 store ptr null, ptr %.cachedtype, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %self, ptr align 8 @std.core.mem.thread_allocator, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %self1, ptr align 8 %self, i32 16, i1 false) - %0 = getelementptr inbounds %"any*", ptr %self1, i32 0, i32 1 - %1 = load i64, ptr %0, align 8 - %2 = getelementptr inbounds %"any*", ptr %self1, i32 0, i32 0 - %3 = inttoptr i64 %1 to ptr + %ptradd = getelementptr inbounds i8, ptr %self1, i64 8 + %0 = load i64, ptr %ptradd, align 8 + %1 = inttoptr i64 %0 to ptr %type = load ptr, ptr %.cachedtype, align 8 - %4 = icmp eq ptr %3, %type - br i1 %4, label %cache_hit, label %cache_miss + %2 = icmp eq ptr %1, %type + br i1 %2, label %cache_hit, label %cache_miss + cache_miss: ; preds = %entry - %5 = getelementptr inbounds %.introspect, ptr %3, i32 0, i32 2 - %6 = load ptr, ptr %5, align 8 - %7 = call ptr @.dyn_search(ptr %6, ptr @"$sel.acquire") - store ptr %7, ptr %.inlinecache, align 8 - store ptr %3, ptr %.cachedtype, align 8 - br label %8 + %ptradd2 = getelementptr inbounds i8, ptr %1, i64 16 + %3 = load ptr, ptr %ptradd2, align 8 + %4 = call ptr @.dyn_search(ptr %3, ptr @"$sel.acquire") + store ptr %4, ptr %.inlinecache, align 8 + store ptr %1, ptr %.cachedtype, align 8 + br label %5 + cache_hit: ; preds = %entry %cache_hit_fn = load ptr, ptr %.inlinecache, align 8 - br label %8 -8: ; preds = %cache_hit, %cache_miss - %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %7, %cache_miss ] - %9 = icmp eq ptr %fn_phi, null - br i1 %9, label %missing_function, label %match -missing_function: ; preds = %8 - %10 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %10(ptr @.panic_msg, i64 44, ptr @.file, i64 16 + br label %5 + +5: ; preds = %cache_hit, %cache_miss + %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %4, %cache_miss ] + %6 = icmp eq ptr %fn_phi, null + br i1 %6, label %missing_function, label %match + +missing_function: ; preds = %5 + %7 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %7(ptr @.panic_msg, i64 44, ptr @.file, i64 16, ptr @.func, i64 4, i32 117) unreachable -match: ; preds = %8 - %11 = load ptr, ptr %2, align 8 - %12 = call i64 %fn_phi(ptr %retparam, ptr %11, i64 8, i8 zeroext 0, i64 0, i64 0) - %not_err = icmp eq i64 %12, 0 - %13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %13, label %after_check, label %assign_optional + +match: ; preds = %5 + %8 = load ptr, ptr %self1, align 8 + %9 = call i64 %fn_phi(ptr %retparam, ptr %8, i64 8, i8 zeroext 0, i64 0, i64 0) + %not_err = icmp eq i64 %9, 0 + %10 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %10, label %after_check, label %assign_optional + assign_optional: ; preds = %match - store i64 %12, ptr %error_var, align 8 + store i64 %9, ptr %error_var, align 8 br label %panic_block + after_check: ; preds = %match - %14 = load ptr, ptr %retparam, align 8 + %11 = load ptr, ptr %retparam, align 8 br label %noerr_block + panic_block: ; preds = %assign_optional - %15 = insertvalue %"any*" undef, ptr %error_var, 0 - %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %17 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %16, ptr %17, align 16 - %18 = insertvalue %"any*[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"any*[]" %18, i64 1, 1 + %12 = insertvalue %"any*" undef, ptr %error_var, 0 + %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %13, ptr %varargslots, align 16 + %14 = insertvalue %"any*[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"any*[]" %14, i64 1, 1 store %"any*[]" %"$$temp", ptr %indirectarg, align 8 - call void @std.core.builtin.panicf(ptr @.panic_msg.1, i64 36, ptr @.file + call void @std.core.builtin.panicf(ptr @.panic_msg.1, i64 36, ptr @.file, i64 16, ptr @.func, i64 4, i32 152, ptr byval(%"any*[]") align 8 %indirectarg) unreachable + noerr_block: ; preds = %after_check - %19 = insertvalue %"any*" undef, ptr %14, 0 - %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.inherit.Test" to i64), 1 - store %"any*" %20, ptr %z, align 8 - %21 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 1 - %22 = load i64, ptr %21, align 8 - %23 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 0 - %24 = inttoptr i64 %22 to ptr - %type4 = load ptr, ptr %.cachedtype3, align 8 - %25 = icmp eq ptr %24, %type4 - br i1 %25, label %cache_hit6, label %cache_miss5 -cache_miss5: ; preds = %noerr_block - %26 = getelementptr inbounds %.introspect, ptr %24, i32 0, i32 2 - %27 = load ptr, ptr %26, align 8 - %28 = call ptr @.dyn_search(ptr %27, ptr @"$sel.tesT") - store ptr %28, ptr %.inlinecache2, align 8 - store ptr %24, ptr %.cachedtype3, align 8 - br label %29 -cache_hit6: ; preds = %noerr_block - %cache_hit_fn7 = load ptr, ptr %.inlinecache2, align 8 - br label %29 -29: ; preds = %cache_hit6, %cache_miss5 - %fn_phi8 = phi ptr [ %cache_hit_fn7, %cache_hit6 ], [ %28, %cache_miss5 ] - %30 = icmp eq ptr %fn_phi8, null - br i1 %30, label %missing_function9, label %match10 -missing_function9: ; preds = %29 - %31 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %31(ptr @.panic_msg.2, i64 41 + %15 = insertvalue %"any*" undef, ptr %11, 0 + %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.inherit.Test" to i64), 1 + store %"any*" %16, ptr %z, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %z, i64 8 + %17 = load i64, ptr %ptradd3, align 8 + %18 = inttoptr i64 %17 to ptr + %type6 = load ptr, ptr %.cachedtype5, align 8 + %19 = icmp eq ptr %18, %type6 + br i1 %19, label %cache_hit9, label %cache_miss7 + +cache_miss7: ; preds = %noerr_block + %ptradd8 = getelementptr inbounds i8, ptr %18, i64 16 + %20 = load ptr, ptr %ptradd8, align 8 + %21 = call ptr @.dyn_search(ptr %20, ptr @"$sel.tesT") + store ptr %21, ptr %.inlinecache4, align 8 + store ptr %18, ptr %.cachedtype5, align 8 + br label %22 + +cache_hit9: ; preds = %noerr_block + %cache_hit_fn10 = load ptr, ptr %.inlinecache4, align 8 + br label %22 + +22: ; preds = %cache_hit9, %cache_miss7 + %fn_phi11 = phi ptr [ %cache_hit_fn10, %cache_hit9 ], [ %21, %cache_miss7 ] + %23 = icmp eq ptr %fn_phi11, null + br i1 %23, label %missing_function12, label %match13 + +missing_function12: ; preds = %22 + %24 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %24(ptr @.panic_msg.2, i64 41, ptr @.file.3, i64 10, ptr @.func, i64 4, i32 34) unreachable -match10: ; preds = %29 - %32 = load ptr, ptr %23, align 8 - call void %fn_phi8(ptr %32) - %33 = load %"any*", ptr %z, align 8 - store %"any*" %33, ptr %w, align 8 - %34 = getelementptr inbounds %"any*", ptr %w, i32 0, i32 1 - %35 = load i64, ptr %34, align 8 - %36 = getelementptr inbounds %"any*", ptr %w, i32 0, i32 0 - %37 = inttoptr i64 %35 to ptr - %type13 = load ptr, ptr %.cachedtype12, align 8 - %38 = icmp eq ptr %37, %type13 - br i1 %38, label %cache_hit15, label %cache_miss14 -cache_miss14: ; preds = %match10 - %39 = getelementptr inbounds %.introspect, ptr %37, i32 0, i32 2 - %40 = load ptr, ptr %39, align 8 - %41 = call ptr @.dyn_search(ptr %40, ptr @"$sel.tesT") - store ptr %41, ptr %.inlinecache11, align 8 - store ptr %37, ptr %.cachedtype12, align 8 - br label %42 -cache_hit15: ; preds = %match10 - %cache_hit_fn16 = load ptr, ptr %.inlinecache11, align 8 - br label %42 -42: ; preds = %cache_hit15, %cache_miss14 - %fn_phi17 = phi ptr [ %cache_hit_fn16, %cache_hit15 ], [ %41, %cache_miss14 ] - %43 = icmp eq ptr %fn_phi17, null - br i1 %43, label %missing_function18, label %match19 -missing_function18: ; preds = %42 - %44 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %44(ptr @.panic_msg.2, i64 41, ptr @.file.3, i64 10, ptr @.func, i64 4, i32 36) + +match13: ; preds = %22 + %25 = load ptr, ptr %z, align 8 + call void %fn_phi11(ptr %25) + %26 = load %"any*", ptr %z, align 8 + store %"any*" %26, ptr %w, align 8 + %ptradd14 = getelementptr inbounds i8, ptr %w, i64 8 + %27 = load i64, ptr %ptradd14, align 8 + %28 = inttoptr i64 %27 to ptr + %type17 = load ptr, ptr %.cachedtype16, align 8 + %29 = icmp eq ptr %28, %type17 + br i1 %29, label %cache_hit20, label %cache_miss18 + +cache_miss18: ; preds = %match13 + %ptradd19 = getelementptr inbounds i8, ptr %28, i64 16 + %30 = load ptr, ptr %ptradd19, align 8 + %31 = call ptr @.dyn_search(ptr %30, ptr @"$sel.tesT") + store ptr %31, ptr %.inlinecache15, align 8 + store ptr %28, ptr %.cachedtype16, align 8 + br label %32 + +cache_hit20: ; preds = %match13 + %cache_hit_fn21 = load ptr, ptr %.inlinecache15, align 8 + br label %32 + +32: ; preds = %cache_hit20, %cache_miss18 + %fn_phi22 = phi ptr [ %cache_hit_fn21, %cache_hit20 ], [ %31, %cache_miss18 ] + %33 = icmp eq ptr %fn_phi22, null + br i1 %33, label %missing_function23, label %match24 + +missing_function23: ; preds = %32 + %34 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %34(ptr @.panic_msg.2, i64 41, ptr @.file.3, i64 10, ptr @.func, i64 4, i32 36) unreachable -match19: ; preds = %42 - %45 = load ptr, ptr %36, align 8 - call void %fn_phi17(ptr %45) + +match24: ; preds = %32 + %35 = load ptr, ptr %w, align 8 + call void %fn_phi22(ptr %35) ret void } +; Function Attrs: +define i32 @main(i32 %0, ptr %1) #0 { +entry: + call void @inherit.main() + ret i32 0 +} + +; Function Attrs: +declare void @llvm.memcpy.p0.p0.i32(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i32, i1 immarg) #1 define weak_odr ptr @.dyn_search(ptr %0, ptr %1) unnamed_addr { entry: br label %check + check: ; preds = %no_match, %entry %2 = phi ptr [ %0, %entry ], [ %9, %no_match ] %3 = icmp eq ptr %2, null br i1 %3, label %missing_function, label %compare + missing_function: ; preds = %check ret ptr null + compare: ; preds = %check %4 = getelementptr inbounds { ptr, ptr, ptr }, ptr %2, i32 0, i32 1 %5 = load ptr, ptr %4, align 8 %6 = icmp eq ptr %5, %1 br i1 %6, label %match, label %no_match + match: ; preds = %compare %7 = load ptr, ptr %2, align 8 ret ptr %7 + no_match: ; preds = %compare %8 = getelementptr inbounds { ptr, ptr, ptr }, ptr %2, i32 0, i32 2 %9 = load ptr, ptr %8, align 8 br label %check } +; Function Attrs: +declare void @std.core.builtin.panicf(ptr, i64, ptr, i64, ptr, i64, i32, ptr byval(%"any*[]") align 8) #0 + define internal void @.static_initialize.0() { entry: br label %dtable_check + dtable_check: ; preds = %dtable_next, %entry %dtable_ref = phi ptr [ getelementptr inbounds (%.introspect, ptr @"$ct.inherit.Test", i32 0, i32 2), %entry ], [ %next_dtable_ref, %dtable_next ] %dtable_ptr = load ptr, ptr %dtable_ref, align 8 %0 = icmp eq ptr %dtable_ptr, null br i1 %0, label %dtable_found, label %dtable_next + dtable_next: ; preds = %dtable_check %next_dtable_ref = getelementptr inbounds { ptr, ptr, ptr }, ptr %dtable_ptr, i32 0, i32 2 br label %dtable_check + dtable_found: ; preds = %dtable_check store ptr @"$ct.dyn.inherit.Test.tesT", ptr %dtable_ref, align 8 br label %dtable_check1 + dtable_check1: ; preds = %dtable_next4, %dtable_found %dtable_ref2 = phi ptr [ getelementptr inbounds (%.introspect, ptr @"$ct.inherit.Test", i32 0, i32 2), %dtable_found ], [ %next_dtable_ref5, %dtable_next4 ] %dtable_ptr3 = load ptr, ptr %dtable_ref2, align 8 %1 = icmp eq ptr %dtable_ptr3, null br i1 %1, label %dtable_found6, label %dtable_next4 + dtable_next4: ; preds = %dtable_check1 %next_dtable_ref5 = getelementptr inbounds { ptr, ptr, ptr }, ptr %dtable_ptr3, i32 0, i32 2 br label %dtable_check1 + dtable_found6: ; preds = %dtable_check1 store ptr @"$ct.dyn.inherit.Test.hello", ptr %dtable_ref2, align 8 ret void diff --git a/test/test_suite/dynamic/null_and_protocol.c3t b/test/test_suite/dynamic/null_and_protocol.c3t index 31d20be91..be83c91c3 100644 --- a/test/test_suite/dynamic/null_and_protocol.c3t +++ b/test/test_suite/dynamic/null_and_protocol.c3t @@ -23,14 +23,13 @@ entry: %x = alloca i8, align 1 %z = alloca %"any*", align 8 store %"any*" zeroinitializer, ptr %a, align 8 - %0 = getelementptr inbounds %"any*", ptr %a, i32 0, i32 0 - %1 = load ptr, ptr %0, align 8 - %eq = icmp eq ptr %1, null - %2 = zext i1 %eq to i8 - store i8 %2, ptr %x, align 1 + %0 = load ptr, ptr %a, align 8 + %eq = icmp eq ptr %0, null + %1 = zext i1 %eq to i8 + store i8 %1, ptr %x, align 1 store %"any*" { ptr null, i64 ptrtoint (ptr @"$ct.void" to i64) }, ptr %a, align 8 - %3 = load %"any*", ptr %a, align 8 - store %"any*" %3, ptr %z, align 8 + %2 = load %"any*", ptr %a, align 8 + store %"any*" %2, ptr %z, align 8 store %"any*" { ptr null, i64 ptrtoint (ptr @"$ct.void" to i64) }, ptr %z, align 8 ret void } \ No newline at end of file diff --git a/test/test_suite/dynamic/overlapping_function.c3t b/test/test_suite/dynamic/overlapping_function.c3t index edc538b9b..fa49c2887 100644 --- a/test/test_suite/dynamic/overlapping_function.c3t +++ b/test/test_suite/dynamic/overlapping_function.c3t @@ -33,13 +33,40 @@ fn void main() /* #expect: overlap.ll +%.introspect = type { i8, i64, ptr, i64, i64, i64, [0 x i64] } +%"any*" = type { ptr, i64 } +%"any*[]" = type { ptr, i64 } + @"$ct.overlap.Test" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 8, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8 +@std.core.mem.thread_allocator = external thread_local global %"any*", align 8 +@"$sel.acquire" = linkonce_odr constant [8 x i8] c"acquire\00", align 1 +@.panic_msg = internal constant [45 x i8] c"No method 'acquire' could be found on target\00", align 1 +@.file = internal constant [17 x i8] c"mem_allocator.c3\00", align 1 +@.func = internal constant [5 x i8] c"main\00", align 1 +@std.core.builtin.panic = external global ptr, align 8 +@"$ct.anyfault" = linkonce global %.introspect { i8 6, i64 0, ptr null, i64 8, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 +@.panic_msg.1 = internal constant [37 x i8] c"Unexpected fault '%s' was unwrapped!\00", align 1 +@"$sel.tesT" = linkonce_odr constant [5 x i8] c"tesT\00", align 1 +@.panic_msg.2 = internal constant [42 x i8] c"No method 'tesT' could be found on target\00", align 1 +@.file.3 = internal constant [24 x i8] c"overlapping_function.c3\00", align 1 @"$ct.dyn.overlap.Test.tesT" = global { ptr, ptr, ptr } { ptr @overlap.Test.tesT, ptr @"$sel.tesT", ptr null }, align 8 @"$ct.dyn.overlap.Test.foo" = global { ptr, ptr, ptr } { ptr @overlap.Test.foo, ptr @"$sel.foo", ptr null }, align 8 @"$sel.foo" = linkonce_odr constant [4 x i8] c"foo\00", align 1 @llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 1, ptr @.static_initialize.0, ptr null }] +; Function Attrs: nounwind uwtable +define void @overlap.Test.tesT(ptr %0) #0 { +entry: + ret void +} + +; Function Attrs: +define void @overlap.Test.foo(ptr %0) #0 { +entry: + ret void +} +; Function Attrs: define void @overlap.main() #0 { entry: %z = alloca %"any*", align 8 @@ -51,150 +78,211 @@ entry: %retparam = alloca ptr, align 8 %varargslots = alloca [1 x %"any*"], align 16 %indirectarg = alloca %"any*[]", align 8 - %.inlinecache2 = alloca ptr, align 8 - %.cachedtype3 = alloca ptr, align 8 + %.inlinecache4 = alloca ptr, align 8 + %.cachedtype5 = alloca ptr, align 8 %w = alloca %"any*", align 8 - %.inlinecache11 = alloca ptr, align 8 - %.cachedtype12 = alloca ptr, align 8 - store ptr null, ptr %.cachedtype12, align 8 - store ptr null, ptr %.cachedtype3, align 8 + %.inlinecache15 = alloca ptr, align 8 + %.cachedtype16 = alloca ptr, align 8 + store ptr null, ptr %.cachedtype16, align 8 + store ptr null, ptr %.cachedtype5, align 8 store ptr null, ptr %.cachedtype, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %self, ptr align 8 @std.core.mem.thread_allocator, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %self1, ptr align 8 %self, i32 16, i1 false) - %0 = getelementptr inbounds %"any*", ptr %self1, i32 0, i32 1 - %1 = load i64, ptr %0, align 8 - %2 = getelementptr inbounds %"any*", ptr %self1, i32 0, i32 0 - %3 = inttoptr i64 %1 to ptr + %ptradd = getelementptr inbounds i8, ptr %self1, i64 8 + %0 = load i64, ptr %ptradd, align 8 + %1 = inttoptr i64 %0 to ptr %type = load ptr, ptr %.cachedtype, align 8 - %4 = icmp eq ptr %3, %type - br i1 %4, label %cache_hit, label %cache_miss + %2 = icmp eq ptr %1, %type + br i1 %2, label %cache_hit, label %cache_miss + cache_miss: ; preds = %entry - %5 = getelementptr inbounds %.introspect, ptr %3, i32 0, i32 2 - %6 = load ptr, ptr %5, align 8 - %7 = call ptr @.dyn_search(ptr %6, ptr @"$sel.acquire") - store ptr %7, ptr %.inlinecache, align 8 - store ptr %3, ptr %.cachedtype, align 8 - br label %8 + %ptradd2 = getelementptr inbounds i8, ptr %1, i64 16 + %3 = load ptr, ptr %ptradd2, align 8 + %4 = call ptr @.dyn_search(ptr %3, ptr @"$sel.acquire") + store ptr %4, ptr %.inlinecache, align 8 + store ptr %1, ptr %.cachedtype, align 8 + br label %5 + cache_hit: ; preds = %entry %cache_hit_fn = load ptr, ptr %.inlinecache, align 8 - br label %8 -8: ; preds = %cache_hit, %cache_miss - %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %7, %cache_miss ] - %9 = icmp eq ptr %fn_phi, null - br i1 %9, label %missing_function, label %match -missing_function: ; preds = %8 - %10 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %10(ptr @.panic_msg, i64 44, ptr @.file, i64 16, ptr @.func, i64 4 + br label %5 + +5: ; preds = %cache_hit, %cache_miss + %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %4, %cache_miss ] + %6 = icmp eq ptr %fn_phi, null + br i1 %6, label %missing_function, label %match + +missing_function: ; preds = %5 + %7 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %7(ptr @.panic_msg, i64 44, ptr @.file, i64 16, ptr @.func, i64 4, i32 117) unreachable -match: ; preds = %8 - %11 = load ptr, ptr %2, align 8 - %12 = call i64 %fn_phi(ptr %retparam, ptr %11, i64 8, i8 zeroext 0, i64 0, i64 0) - %not_err = icmp eq i64 %12, 0 - %13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %13, label %after_check, label %assign_optional + +match: ; preds = %5 + %8 = load ptr, ptr %self1, align 8 + %9 = call i64 %fn_phi(ptr %retparam, ptr %8, i64 8, i8 zeroext 0, i64 0, i64 0) + %not_err = icmp eq i64 %9, 0 + %10 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %10, label %after_check, label %assign_optional + assign_optional: ; preds = %match - store i64 %12, ptr %error_var, align 8 + store i64 %9, ptr %error_var, align 8 br label %panic_block + after_check: ; preds = %match - %14 = load ptr, ptr %retparam, align 8 + %11 = load ptr, ptr %retparam, align 8 br label %noerr_block + panic_block: ; preds = %assign_optional - %15 = insertvalue %"any*" undef, ptr %error_var, 0 - %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %17 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %16, ptr %17, align 16 - %18 = insertvalue %"any*[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"any*[]" %18, i64 1, 1 + %12 = insertvalue %"any*" undef, ptr %error_var, 0 + %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %13, ptr %varargslots, align 16 + %14 = insertvalue %"any*[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"any*[]" %14, i64 1, 1 store %"any*[]" %"$$temp", ptr %indirectarg, align 8 - call void @std.core.builtin.panicf(ptr @.panic_msg.1 + call void @std.core.builtin.panicf(ptr @.panic_msg.1, i64 36, ptr @.file, i64 16, ptr @.func, i64 4, i32 152, ptr byval(%"any*[]") align 8 %indirectarg) unreachable + noerr_block: ; preds = %after_check - %19 = insertvalue %"any*" undef, ptr %14, 0 - %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.overlap.Test" to i64), 1 - store %"any*" %20, ptr %z, align 8 - %21 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 1 - %22 = load i64, ptr %21, align 8 - %23 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 0 - %24 = inttoptr i64 %22 to ptr - %type4 = load ptr, ptr %.cachedtype3, align 8 - %25 = icmp eq ptr %24, %type4 - br i1 %25, label %cache_hit6, label %cache_miss5 -cache_miss5: ; preds = %noerr_block - %26 = getelementptr inbounds %.introspect, ptr %24, i32 0, i32 2 - %27 = load ptr, ptr %26, align 8 - %28 = call ptr @.dyn_search(ptr %27, ptr @"$sel.tesT") - store ptr %28, ptr %.inlinecache2, align 8 - store ptr %24, ptr %.cachedtype3, align 8 - br label %29 -cache_hit6: ; preds = %noerr_block - %cache_hit_fn7 = load ptr, ptr %.inlinecache2, align 8 - br label %29 -29: ; preds = %cache_hit6, %cache_miss5 - %fn_phi8 = phi ptr [ %cache_hit_fn7, %cache_hit6 ], [ %28, %cache_miss5 ] - %30 = icmp eq ptr %fn_phi8, null - br i1 %30, label %missing_function9, label %match10 -missing_function9: ; preds = %29 - %31 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %31(ptr @.panic_msg.2, i64 41, ptr @.file + %15 = insertvalue %"any*" undef, ptr %11, 0 + %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.overlap.Test" to i64), 1 + store %"any*" %16, ptr %z, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %z, i64 8 + %17 = load i64, ptr %ptradd3, align 8 + %18 = inttoptr i64 %17 to ptr + %type6 = load ptr, ptr %.cachedtype5, align 8 + %19 = icmp eq ptr %18, %type6 + br i1 %19, label %cache_hit9, label %cache_miss7 + +cache_miss7: ; preds = %noerr_block + %ptradd8 = getelementptr inbounds i8, ptr %18, i64 16 + %20 = load ptr, ptr %ptradd8, align 8 + %21 = call ptr @.dyn_search(ptr %20, ptr @"$sel.tesT") + store ptr %21, ptr %.inlinecache4, align 8 + store ptr %18, ptr %.cachedtype5, align 8 + br label %22 + +cache_hit9: ; preds = %noerr_block + %cache_hit_fn10 = load ptr, ptr %.inlinecache4, align 8 + br label %22 + +22: ; preds = %cache_hit9, %cache_miss7 + %fn_phi11 = phi ptr [ %cache_hit_fn10, %cache_hit9 ], [ %21, %cache_miss7 ] + %23 = icmp eq ptr %fn_phi11, null + br i1 %23, label %missing_function12, label %match13 + +missing_function12: ; preds = %22 + %24 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %24(ptr @.panic_msg.2, i64 41, ptr @.file.3, i64 23, ptr @.func, i64 4, i32 28) unreachable -match10: ; preds = %29 - %32 = load ptr, ptr %23, align 8 - call void %fn_phi8(ptr %32) - %33 = load %"any*", ptr %z, align 8 - store %"any*" %33, ptr %w, align 8 - %34 = getelementptr inbounds %"any*", ptr %w, i32 0, i32 1 - %35 = load i64, ptr %34, align 8 - %36 = getelementptr inbounds %"any*", ptr %w, i32 0, i32 0 - %37 = inttoptr i64 %35 to ptr - %type13 = load ptr, ptr %.cachedtype12, align 8 - %38 = icmp eq ptr %37, %type13 - br i1 %38, label %cache_hit15, label %cache_miss14 -cache_miss14: ; preds = %match10 - %39 = getelementptr inbounds %.introspect, ptr %37, i32 0, i32 2 - %40 = load ptr, ptr %39, align 8 - %41 = call ptr @.dyn_search(ptr %40, ptr @"$sel.tesT") - store ptr %41, ptr %.inlinecache11, align 8 - store ptr %37, ptr %.cachedtype12, align 8 - br label %42 -cache_hit15: ; preds = %match10 - %cache_hit_fn16 = load ptr, ptr %.inlinecache11, align 8 - br label %42 -42: ; preds = %cache_hit15, %cache_miss14 - %fn_phi17 = phi ptr [ %cache_hit_fn16, %cache_hit15 ], [ %41, %cache_miss14 ] - %43 = icmp eq ptr %fn_phi17, null - br i1 %43, label %missing_function18, label %match19 -missing_function18: ; preds = %42 - %44 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %44(ptr @.panic_msg.2, i64 41, ptr @.file.3, i64 23, ptr @.func, i64 4, i32 30) + +match13: ; preds = %22 + %25 = load ptr, ptr %z, align 8 + call void %fn_phi11(ptr %25) + %26 = load %"any*", ptr %z, align 8 + store %"any*" %26, ptr %w, align 8 + %ptradd14 = getelementptr inbounds i8, ptr %w, i64 8 + %27 = load i64, ptr %ptradd14, align 8 + %28 = inttoptr i64 %27 to ptr + %type17 = load ptr, ptr %.cachedtype16, align 8 + %29 = icmp eq ptr %28, %type17 + br i1 %29, label %cache_hit20, label %cache_miss18 + +cache_miss18: ; preds = %match13 + %ptradd19 = getelementptr inbounds i8, ptr %28, i64 16 + %30 = load ptr, ptr %ptradd19, align 8 + %31 = call ptr @.dyn_search(ptr %30, ptr @"$sel.tesT") + store ptr %31, ptr %.inlinecache15, align 8 + store ptr %28, ptr %.cachedtype16, align 8 + br label %32 + +cache_hit20: ; preds = %match13 + %cache_hit_fn21 = load ptr, ptr %.inlinecache15, align 8 + br label %32 + +32: ; preds = %cache_hit20, %cache_miss18 + %fn_phi22 = phi ptr [ %cache_hit_fn21, %cache_hit20 ], [ %31, %cache_miss18 ] + %33 = icmp eq ptr %fn_phi22, null + br i1 %33, label %missing_function23, label %match24 + +missing_function23: ; preds = %32 + %34 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %34(ptr @.panic_msg.2, i64 41, ptr @.file.3, i64 23, ptr @.func, i64 4, i32 30) unreachable -match19: ; preds = %42 - %45 = load ptr, ptr %36, align 8 - call void %fn_phi17(ptr %45) + +match24: ; preds = %32 + %35 = load ptr, ptr %w, align 8 + call void %fn_phi22(ptr %35) ret void } + +; Function Attrs: +define i32 @main(i32 %0, ptr %1) #0 { +entry: + call void @overlap.main() + ret i32 0 +} + +define weak_odr ptr @.dyn_search(ptr %0, ptr %1) unnamed_addr { +entry: + br label %check + +check: ; preds = %no_match, %entry + %2 = phi ptr [ %0, %entry ], [ %9, %no_match ] + %3 = icmp eq ptr %2, null + br i1 %3, label %missing_function, label %compare + +missing_function: ; preds = %check + ret ptr null + +compare: ; preds = %check + %4 = getelementptr inbounds { ptr, ptr, ptr }, ptr %2, i32 0, i32 1 + %5 = load ptr, ptr %4, align 8 + %6 = icmp eq ptr %5, %1 + br i1 %6, label %match, label %no_match + +match: ; preds = %compare + %7 = load ptr, ptr %2, align 8 + ret ptr %7 + +no_match: ; preds = %compare + %8 = getelementptr inbounds { ptr, ptr, ptr }, ptr %2, i32 0, i32 2 + %9 = load ptr, ptr %8, align 8 + br label %check +} + + +; Function Attrs: +declare void @std.core.builtin.panicf(ptr, i64, ptr, i64, ptr, i64, i32, ptr byval(%"any*[]") align 8) #0 + define internal void @.static_initialize.0() { entry: br label %dtable_check + dtable_check: ; preds = %dtable_next, %entry %dtable_ref = phi ptr [ getelementptr inbounds (%.introspect, ptr @"$ct.overlap.Test", i32 0, i32 2), %entry ], [ %next_dtable_ref, %dtable_next ] %dtable_ptr = load ptr, ptr %dtable_ref, align 8 %0 = icmp eq ptr %dtable_ptr, null br i1 %0, label %dtable_found, label %dtable_next + dtable_next: ; preds = %dtable_check %next_dtable_ref = getelementptr inbounds { ptr, ptr, ptr }, ptr %dtable_ptr, i32 0, i32 2 br label %dtable_check + dtable_found: ; preds = %dtable_check store ptr @"$ct.dyn.overlap.Test.tesT", ptr %dtable_ref, align 8 br label %dtable_check1 + dtable_check1: ; preds = %dtable_next4, %dtable_found %dtable_ref2 = phi ptr [ getelementptr inbounds (%.introspect, ptr @"$ct.overlap.Test", i32 0, i32 2), %dtable_found ], [ %next_dtable_ref5, %dtable_next4 ] %dtable_ptr3 = load ptr, ptr %dtable_ref2, align 8 %1 = icmp eq ptr %dtable_ptr3, null br i1 %1, label %dtable_found6, label %dtable_next4 + dtable_next4: ; preds = %dtable_check1 %next_dtable_ref5 = getelementptr inbounds { ptr, ptr, ptr }, ptr %dtable_ptr3, i32 0, i32 2 br label %dtable_check1 + dtable_found6: ; preds = %dtable_check1 store ptr @"$ct.dyn.overlap.Test.foo", ptr %dtable_ref2, align 8 ret void -} \ No newline at end of file +} diff --git a/test/test_suite/enumerations/enum_associated_value.c3t b/test/test_suite/enumerations/enum_associated_value.c3t index bb7a75f2c..c78e43b1e 100644 --- a/test/test_suite/enumerations/enum_associated_value.c3t +++ b/test/test_suite/enumerations/enum_associated_value.c3t @@ -20,6 +20,7 @@ fn void main() %.introspect = type { i8, i64, ptr, i64, i64, i64, [0 x i64] } %"char[]" = type { ptr, i64 } + @.enum.A = internal constant [2 x i8] c"A\00", align 1 @.enum.B = internal constant [2 x i8] c"B\00", align 1 @"$ct.uint" = linkonce global %.introspect { i8 3, i64 0, ptr null, i64 4, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 @@ -30,6 +31,7 @@ fn void main() @"test.Foo$testme" = linkonce constant [2 x ptr] [ptr @.str, ptr @.str.1], align 8 @.str.2 = private unnamed_addr constant [17 x i8] c"%d (%s) %d (%s)\0A\00", align 1 +; Function Attrs: define void @test.main() #0 { entry: %x = alloca i32, align 4 @@ -39,21 +41,17 @@ entry: store i32 1, ptr %f, align 4 store i32 0, ptr %g, align 4 %0 = load i32, ptr %f, align 4 - %zext = zext i32 %0 to i64 - %1 = getelementptr inbounds [2 x i32], ptr @"test.Foo$val", i64 0, i64 %zext - %2 = load i32, ptr %f, align 4 - %zext1 = zext i32 %2 to i64 - %3 = getelementptr inbounds [2 x ptr], ptr @"test.Foo$testme", i64 0, i64 %zext1 - %4 = load i32, ptr %g, align 4 - %zext2 = zext i32 %4 to i64 - %5 = getelementptr inbounds [2 x i32], ptr @"test.Foo$val", i64 0, i64 %zext2 - %6 = load i32, ptr %g, align 4 - %zext3 = zext i32 %6 to i64 - %7 = getelementptr inbounds [2 x ptr], ptr @"test.Foo$testme", i64 0, i64 %zext3 - %8 = load i32, ptr %1, align 4 - %9 = load ptr, ptr %3, align 8 - %10 = load i32, ptr %5, align 4 - %11 = load ptr, ptr %7, align 8 - %12 = call i32 (ptr, ...) @printf(ptr @.str.2, i32 %8, ptr %9, i32 %10, ptr %11) + %ptroffset = getelementptr inbounds [4 x i8], ptr @"test.Foo$val", i32 %0 + %1 = load i32, ptr %f, align 4 + %ptroffset1 = getelementptr inbounds [8 x i8], ptr @"test.Foo$testme", i32 %1 + %2 = load i32, ptr %g, align 4 + %ptroffset2 = getelementptr inbounds [4 x i8], ptr @"test.Foo$val", i32 %2 + %3 = load i32, ptr %g, align 4 + %ptroffset3 = getelementptr inbounds [8 x i8], ptr @"test.Foo$testme", i32 %3 + %4 = load i32, ptr %ptroffset, align 4 + %5 = load ptr, ptr %ptroffset1, align 8 + %6 = load i32, ptr %ptroffset2, align 4 + %7 = load ptr, ptr %ptroffset3, align 8 + %8 = call i32 (ptr, ...) @printf(ptr @.str.2, i32 %4, ptr %5, i32 %6, ptr %7) ret void } diff --git a/test/test_suite/enumerations/enum_associated_values_other.c3t b/test/test_suite/enumerations/enum_associated_values_other.c3t index a4258e20d..792d89901 100644 --- a/test/test_suite/enumerations/enum_associated_values_other.c3t +++ b/test/test_suite/enumerations/enum_associated_values_other.c3t @@ -24,6 +24,8 @@ enum Foo : int(String val) /* #expect: abc.ll +%.introspect = type { i8, i64, ptr, i64, i64, i64, [0 x i64] } +%"char[]" = type { ptr, i64 } @"$ct.abc.Abc" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 4, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8 @.enum.ABC = internal constant [4 x i8] c"ABC\00", align 1 @.enum.DEF = internal constant [4 x i8] c"DEF\00", align 1 @@ -32,48 +34,4 @@ enum Foo : int(String val) @.str = private unnamed_addr constant [6 x i8] c"hello\00", align 1 @.str.1 = private unnamed_addr constant [6 x i8] c"world\00", align 1 @"abc.Foo$val" = linkonce constant [2 x %"char[]"] [%"char[]" { ptr @.str, i64 5 }, %"char[]" { ptr @.str.1, i64 5 }], align 8 -@abc.dabc = global i32 0, align 4 - - -// #expect: test.ll - -@"$ct.abc.Abc" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 4, i64 0, i64 1, [0 x i64] zeroinitializer }, align 8 -@abc.dabc = external global i32, align 4 -@.enum.ABC = internal constant [4 x i8] c"ABC\00", align 1 -@.enum.DEF = internal constant [4 x i8] c"DEF\00", align 1 -@"$ct.int" = linkonce global %.introspect { i8 2, i64 0, ptr null, i64 4, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 -@"$ct.abc.Foo" = linkonce global { i8, i64, ptr, i64, i64, i64, [2 x %"char[]"] } { i8 8, i64 0, ptr null, i64 4, i64 ptrtoint (ptr @"$ct.int" to i64), i64 2, [2 x %"char[]"] [%"char[]" { ptr @.enum.ABC, i64 3 }, %"char[]" { ptr @.enum.DEF, i64 3 }] }, align 8 -@.str = private unnamed_addr constant [6 x i8] c"hello\00", align 1 -@.str.1 = private unnamed_addr constant [6 x i8] c"world\00", align 1 -@"abc.Foo$val" = linkonce constant [2 x %"char[]"] [%"char[]" { ptr @.str, i64 5 }, %"char[]" { ptr @.str.1, i64 5 }], align 8 -@.str.2 = private unnamed_addr constant [3 x i8] c"%s\00", align 1 -@"$ct.String" = linkonce global %.introspect { i8 18, i64 ptrtoint (ptr @"$ct.sa$char" to i64), ptr null, i64 16, i64 ptrtoint (ptr @"$ct.sa$char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8 -@"$ct.sa$char" = linkonce global %.introspect { i8 16, i64 0, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8 -@"$ct.char" = linkonce global %.introspect { i8 3, i64 0, ptr null, i64 1, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 -@"$ct.anyfault" = linkonce global %.introspect { i8 6, i64 0, ptr null, i64 8, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 - -define void @test.main(ptr %0, i64 %1) #0 { -entry: - %args = alloca %"char[][]", align 8 - %y = alloca i64, align 8 - %x = alloca ptr, align 8 - %a = alloca i32, align 4 - %z = alloca %"char[]", align 8 - %varargslots = alloca [1 x %"any*"], align 16 - %retparam = alloca i64, align 8 - store ptr %0, ptr %args, align 8 - %ptroffset = getelementptr inbounds i64, ptr %args, i64 1 - store i64 %1, ptr %ptroffset, align 8 - store i64 ptrtoint (ptr @"$ct.abc.Abc" to i64), ptr %y, align 8 - store ptr @abc.dabc, ptr %x, align 8 - store i32 1, ptr %a, align 4 - %2 = load i32, ptr %a, align 4 - %3 = getelementptr inbounds [2 x %"char[]"], ptr @"abc.Foo$val", i32 0, i32 %2 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %z, ptr align 8 %3, i32 16, i1 false) - %4 = insertvalue %"any*" undef, ptr %z, 0 - %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %6 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %5, ptr %6, align 16 - %7 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.2, i64 2, ptr %varargslots, i64 1) - ret void -} \ No newline at end of file +@abc.dabc = global i32 0, align 4 \ No newline at end of file diff --git a/test/test_suite/enumerations/enum_conversions.c3t b/test/test_suite/enumerations/enum_conversions.c3t index c1c597b43..fb2c3a873 100644 --- a/test/test_suite/enumerations/enum_conversions.c3t +++ b/test/test_suite/enumerations/enum_conversions.c3t @@ -26,146 +26,130 @@ entry: store i32 0, ptr %a, align 4 %0 = load i32, ptr %a, align 4 %lt = icmp slt i32 %0, 0 - br i1 %lt, label %panic, label %checkok - + %1 = call i1 @llvm.expect.i1(i1 %lt, i1 false) + br i1 %1, label %panic, label %checkok +checkok: ; preds = %entry + %ge = icmp sge i32 %0, 1 + %2 = call i1 @llvm.expect.i1(i1 %ge, i1 false) + br i1 %2, label %panic1, label %checkok6 +checkok6: ; preds = %checkok + %trunc = trunc i32 %0 to i8 + store i8 %trunc, ptr %x, align 1 + store i64 0, ptr %z, align 8 + %3 = load i64, ptr %z, align 8 + %lt7 = icmp slt i64 %3, 0 + %4 = call i1 @llvm.expect.i1(i1 %lt7, i1 false) + br i1 %4, label %panic8, label %checkok13 +checkok13: ; preds = %checkok6 + %ge14 = icmp sge i64 %3, 1 + %5 = call i1 @llvm.expect.i1(i1 %ge14, i1 false) + br i1 %5, label %panic15, label %checkok20 +checkok20: ; preds = %checkok13 + %trunc21 = trunc i64 %3 to i8 + store i8 %trunc21, ptr %y, align 1 + store i32 256, ptr %a, align 4 + %6 = load i32, ptr %a, align 4 + %lt22 = icmp slt i32 %6, 0 + %7 = call i1 @llvm.expect.i1(i1 %lt22, i1 false) + br i1 %7, label %panic23, label %checkok28 +checkok28: ; preds = %checkok20 + %ge29 = icmp sge i32 %6, 1 + %8 = call i1 @llvm.expect.i1(i1 %ge29, i1 false) + br i1 %8, label %panic30, label %checkok35 +checkok35: ; preds = %checkok28 + %trunc36 = trunc i32 %6 to i8 + store i8 %trunc36, ptr %y, align 1 + store i32 -1, ptr %a, align 4 + %9 = load i32, ptr %a, align 4 + %lt37 = icmp slt i32 %9, 0 + %10 = call i1 @llvm.expect.i1(i1 %lt37, i1 false) + br i1 %10, label %panic38, label %checkok43 +checkok43: ; preds = %checkok35 + %ge44 = icmp sge i32 %9, 1 + %11 = call i1 @llvm.expect.i1(i1 %ge44, i1 false) + br i1 %11, label %panic45, label %checkok50 +checkok50: ; preds = %checkok43 + %trunc51 = trunc i32 %9 to i8 + store i8 %trunc51, ptr %y, align 1 + ret void panic: ; preds = %entry store i32 %0, ptr %taddr, align 4 - %1 = insertvalue %"any*" undef, ptr %taddr, 0 - %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %3 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %2, ptr %3, align 16 - %4 = insertvalue %"any*[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"any*[]" %4, i64 1, 1 + %12 = insertvalue %"any*" undef, ptr %taddr, 0 + %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %13, ptr %varargslots, align 16 + %14 = insertvalue %"any*[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"any*[]" %14, i64 1, 1 store %"any*[]" %"$$temp", ptr %indirectarg, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 7, ptr @.file, i64 19, ptr @.func, i64 4, i32 7, ptr byval(%"any*[]") align 8 %indirectarg) unreachable - -checkok: ; preds = %entry - %ge = icmp sge i32 %0, 1 - br i1 %ge, label %panic1, label %checkok6 - panic1: ; preds = %checkok store i32 %0, ptr %taddr2, align 4 - %5 = insertvalue %"any*" undef, ptr %taddr2, 0 - %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %7 = getelementptr inbounds [1 x %"any*"], ptr %varargslots3, i64 0, i64 0 - store %"any*" %6, ptr %7, align 16 - %8 = insertvalue %"any*[]" undef, ptr %varargslots3, 0 - %"$$temp4" = insertvalue %"any*[]" %8, i64 1, 1 + %15 = insertvalue %"any*" undef, ptr %taddr2, 0 + %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %16, ptr %varargslots3, align 16 + %17 = insertvalue %"any*[]" undef, ptr %varargslots3, 0 + %"$$temp4" = insertvalue %"any*[]" %17, i64 1, 1 store %"any*[]" %"$$temp4", ptr %indirectarg5, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg.1, i64 87, ptr @.file, i64 19, ptr @.func, i64 4, i32 7, ptr byval(%"any*[]") align 8 %indirectarg5) unreachable - -checkok6: ; preds = %checkok - %trunc = trunc i32 %0 to i8 - store i8 %trunc, ptr %x, align 1 - store i64 0, ptr %z, align 8 - %9 = load i64, ptr %z, align 8 - %lt7 = icmp slt i64 %9, 0 - br i1 %lt7, label %panic8, label %checkok13 - panic8: ; preds = %checkok6 - store i64 %9, ptr %taddr9, align 8 - %10 = insertvalue %"any*" undef, ptr %taddr9, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %12 = getelementptr inbounds [1 x %"any*"], ptr %varargslots10, i64 0, i64 0 - store %"any*" %11, ptr %12, align 16 - %13 = insertvalue %"any*[]" undef, ptr %varargslots10, 0 - %"$$temp11" = insertvalue %"any*[]" %13, i64 1, 1 + store i64 %3, ptr %taddr9, align 8 + %18 = insertvalue %"any*" undef, ptr %taddr9, 0 + %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.long" to i64), 1 + store %"any*" %19, ptr %varargslots10, align 16 + %20 = insertvalue %"any*[]" undef, ptr %varargslots10, 0 + %"$$temp11" = insertvalue %"any*[]" %20, i64 1, 1 store %"any*[]" %"$$temp11", ptr %indirectarg12, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg.2, i64 8, ptr @.file, i64 19, ptr @.func, i64 4, i32 9, ptr byval(%"any*[]") align 8 %indirectarg12) unreachable - -checkok13: ; preds = %checkok6 - %ge14 = icmp sge i64 %9, 1 - br i1 %ge14, label %panic15, label %checkok20 - panic15: ; preds = %checkok13 - store i64 %9, ptr %taddr16, align 8 - %14 = insertvalue %"any*" undef, ptr %taddr16, 0 - %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %16 = getelementptr inbounds [1 x %"any*"], ptr %varargslots17, i64 0, i64 0 - store %"any*" %15, ptr %16, align 16 - %17 = insertvalue %"any*[]" undef, ptr %varargslots17, 0 - %"$$temp18" = insertvalue %"any*[]" %17, i64 1, 1 + store i64 %3, ptr %taddr16, align 8 + %21 = insertvalue %"any*" undef, ptr %taddr16, 0 + %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.long" to i64), 1 + store %"any*" %22, ptr %varargslots17, align 16 + %23 = insertvalue %"any*[]" undef, ptr %varargslots17, 0 + %"$$temp18" = insertvalue %"any*[]" %23, i64 1, 1 store %"any*[]" %"$$temp18", ptr %indirectarg19, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg.1, i64 87, ptr @.file, i64 19, ptr @.func, i64 4, i32 9, ptr byval(%"any*[]") align 8 %indirectarg19) unreachable - -checkok20: ; preds = %checkok13 - %trunc21 = trunc i64 %9 to i8 - store i8 %trunc21, ptr %y, align 1 - store i32 256, ptr %a, align 4 - %18 = load i32, ptr %a, align 4 - %lt22 = icmp slt i32 %18, 0 - br i1 %lt22, label %panic23, label %checkok28 - panic23: ; preds = %checkok20 - store i32 %18, ptr %taddr24, align 4 - %19 = insertvalue %"any*" undef, ptr %taddr24, 0 - %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %21 = getelementptr inbounds [1 x %"any*"], ptr %varargslots25, i64 0, i64 0 - store %"any*" %20, ptr %21, align 16 - %22 = insertvalue %"any*[]" undef, ptr %varargslots25, 0 - %"$$temp26" = insertvalue %"any*[]" %22, i64 1, 1 + store i32 %6, ptr %taddr24, align 4 + %24 = insertvalue %"any*" undef, ptr %taddr24, 0 + %25 = insertvalue %"any*" %24, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %25, ptr %varargslots25, align 16 + %26 = insertvalue %"any*[]" undef, ptr %varargslots25, 0 + %"$$temp26" = insertvalue %"any*[]" %26, i64 1, 1 store %"any*[]" %"$$temp26", ptr %indirectarg27, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg.3, i64 62, ptr @.file, i64 19, ptr @.func, i64 4, i32 11, ptr byval(%"any*[]") align 8 %indirectarg27) unreachable - -checkok28: ; preds = %checkok20 - %ge29 = icmp sge i32 %18, 1 - br i1 %ge29, label %panic30, label %checkok35 - panic30: ; preds = %checkok28 - store i32 %18, ptr %taddr31, align 4 - %23 = insertvalue %"any*" undef, ptr %taddr31, 0 - %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %25 = getelementptr inbounds [1 x %"any*"], ptr %varargslots32, i64 0, i64 0 - store %"any*" %24, ptr %25, align 16 - %26 = insertvalue %"any*[]" undef, ptr %varargslots32, 0 - %"$$temp33" = insertvalue %"any*[]" %26, i64 1, 1 + store i32 %6, ptr %taddr31, align 4 + %27 = insertvalue %"any*" undef, ptr %taddr31, 0 + %28 = insertvalue %"any*" %27, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %28, ptr %varargslots32, align 16 + %29 = insertvalue %"any*[]" undef, ptr %varargslots32, 0 + %"$$temp33" = insertvalue %"any*[]" %29, i64 1, 1 store %"any*[]" %"$$temp33", ptr %indirectarg34, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg.1, i64 87, ptr @.file, i64 19, ptr @.func, i64 4, i32 11, ptr byval(%"any*[]") align 8 %indirectarg34) unreachable - -checkok35: ; preds = %checkok28 - %trunc36 = trunc i32 %18 to i8 - store i8 %trunc36, ptr %y, align 1 - store i32 -1, ptr %a, align 4 - %27 = load i32, ptr %a, align 4 - %lt37 = icmp slt i32 %27, 0 - br i1 %lt37, label %panic38, label %checkok43 - panic38: ; preds = %checkok35 - store i32 %27, ptr %taddr39, align 4 - %28 = insertvalue %"any*" undef, ptr %taddr39, 0 - %29 = insertvalue %"any*" %28, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %30 = getelementptr inbounds [1 x %"any*"], ptr %varargslots40, i64 0, i64 0 - store %"any*" %29, ptr %30, align 16 - %31 = insertvalue %"any*[]" undef, ptr %varargslots40, 0 - %"$$temp41" = insertvalue %"any*[]" %31, i64 1, 1 + store i32 %9, ptr %taddr39, align 4 + %30 = insertvalue %"any*" undef, ptr %taddr39, 0 + %31 = insertvalue %"any*" %30, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %31, ptr %varargslots40, align 16 + %32 = insertvalue %"any*[]" undef, ptr %varargslots40, 0 + %"$$temp41" = insertvalue %"any*[]" %32, i64 1, 1 store %"any*[]" %"$$temp41", ptr %indirectarg42, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg.3, i64 62, ptr @.file, i64 19, ptr @.func, i64 4, i32 13, ptr byval(%"any*[]") align 8 %indirectarg42) unreachable - -checkok43: ; preds = %checkok35 - %ge44 = icmp sge i32 %27, 1 - br i1 %ge44, label %panic45, label %checkok50 - panic45: ; preds = %checkok43 - store i32 %27, ptr %taddr46, align 4 - %32 = insertvalue %"any*" undef, ptr %taddr46, 0 - %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %34 = getelementptr inbounds [1 x %"any*"], ptr %varargslots47, i64 0, i64 0 - store %"any*" %33, ptr %34, align 16 + store i32 %9, ptr %taddr46, align 4 + %33 = insertvalue %"any*" undef, ptr %taddr46, 0 + %34 = insertvalue %"any*" %33, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %34, ptr %varargslots47, align 16 %35 = insertvalue %"any*[]" undef, ptr %varargslots47, 0 %"$$temp48" = insertvalue %"any*[]" %35, i64 1, 1 store %"any*[]" %"$$temp48", ptr %indirectarg49, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg.1, i64 87, ptr @.file, i64 19, ptr @.func, i64 4, i32 13, ptr byval(%"any*[]") align 8 %indirectarg49) unreachable - -checkok50: ; preds = %checkok43 - %trunc51 = trunc i32 %27 to i8 - store i8 %trunc51, ptr %y, align 1 - ret void } diff --git a/test/test_suite/enumerations/enum_reflect_associated.c3t b/test/test_suite/enumerations/enum_reflect_associated.c3t index d65f89ce7..f264a038b 100644 --- a/test/test_suite/enumerations/enum_reflect_associated.c3t +++ b/test/test_suite/enumerations/enum_reflect_associated.c3t @@ -20,6 +20,7 @@ fn int main() @.str.4 = private unnamed_addr constant [7 x i8] c"double\00", align 1 @.str.6 = private unnamed_addr constant [7 x i8] c"String\00", align 1 +; Function Attrs: define i32 @main() #0 { entry: %varargslots = alloca [1 x %"any*"], align 16 @@ -34,20 +35,17 @@ entry: store %"char[]" { ptr @.str.2, i64 3 }, ptr %taddr, align 8 %0 = insertvalue %"any*" undef, ptr %taddr, 0 %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %2 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %1, ptr %2, align 16 - %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.1, i64 2, ptr %varargslots, i64 1) + store %"any*" %1, ptr %varargslots, align 16 + %2 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.1, i64 2, ptr %varargslots, i64 1) store %"char[]" { ptr @.str.4, i64 6 }, ptr %taddr2, align 8 - %4 = insertvalue %"any*" undef, ptr %taddr2, 0 - %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %6 = getelementptr inbounds [1 x %"any*"], ptr %varargslots1, i64 0, i64 0 - store %"any*" %5, ptr %6, align 16 - %7 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.3, i64 2, ptr %varargslots1, i64 1) + %3 = insertvalue %"any*" undef, ptr %taddr2, 0 + %4 = insertvalue %"any*" %3, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %4, ptr %varargslots1, align 16 + %5 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.3, i64 2, ptr %varargslots1, i64 1) store %"char[]" { ptr @.str.6, i64 6 }, ptr %taddr5, align 8 - %8 = insertvalue %"any*" undef, ptr %taddr5, 0 - %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %10 = getelementptr inbounds [1 x %"any*"], ptr %varargslots4, i64 0, i64 0 - store %"any*" %9, ptr %10, align 16 - %11 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.5, i64 2, ptr %varargslots4, i64 1) + %6 = insertvalue %"any*" undef, ptr %taddr5, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %7, ptr %varargslots4, align 16 + %8 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.5, i64 2, ptr %varargslots4, i64 1) ret i32 0 } diff --git a/test/test_suite/enumerations/enum_values.c3t b/test/test_suite/enumerations/enum_values.c3t index 7d38672e0..fd863582f 100644 --- a/test/test_suite/enumerations/enum_values.c3t +++ b/test/test_suite/enumerations/enum_values.c3t @@ -22,14 +22,15 @@ fn void test(int x) @.taddr = private global [2 x i32] [i32 0, i32 1], align 4 @test.zw = local_unnamed_addr global %"int[]" { ptr @.taddr, i64 2 }, align 8 +; Function Attrs: define void @test.test(i32 %0) #0 { entry: %zonk = alloca i32, align 4 %literal = alloca [2 x i32], align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 8, i1 false) %sext = sext i32 %0 to i64 - %1 = getelementptr inbounds [2 x i32], ptr %literal, i64 0, i64 %sext - %2 = load i32, ptr %1, align 4 - store i32 %2, ptr %zonk, align 4 + %ptroffset = getelementptr inbounds [4 x i8], ptr %literal, i64 %sext + %1 = load i32, ptr %ptroffset, align 4 + store i32 %1, ptr %zonk, align 4 ret void } diff --git a/test/test_suite/errors/error_introspect.c3t b/test/test_suite/errors/error_introspect.c3t index 80112fcaa..0642a604b 100644 --- a/test/test_suite/errors/error_introspect.c3t +++ b/test/test_suite/errors/error_introspect.c3t @@ -25,16 +25,20 @@ fn void main() @"$ct.foo.Foo" = linkonce global %.introspect { i8 9, i64 0, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 @.str = private unnamed_addr constant [4 x i8] c"BAR\00", align 1 @.str.2 = private unnamed_addr constant [4 x i8] c"BAZ\00", align 1 +@.__const = private unnamed_addr constant [2 x %"char[]"] [%"char[]" { ptr @.str, i64 3 }, %"char[]" { ptr @.str.2, i64 3 }], align 16 @.str.3 = private unnamed_addr constant [14 x i8] c"Foo.names: %s\00", align 1 @"$ct.sa$String" = linkonce global %.introspect { i8 16, i64 0, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.String" to i64), i64 0, [0 x i64] zeroinitializer }, align 8 @"$ct.String" = linkonce global %.introspect { i8 18, i64 ptrtoint (ptr @"$ct.sa$char" to i64), ptr null, i64 16, i64 ptrtoint (ptr @"$ct.sa$char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8 @"$ct.sa$char" = linkonce global %.introspect { i8 16, i64 0, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.char" to i64), i64 0, [0 x i64] zeroinitializer }, align 8 @"$ct.char" = linkonce global %.introspect { i8 3, i64 0, ptr null, i64 1, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 @.str.4 = private unnamed_addr constant [15 x i8] c"Foo.values: %s\00", align 1 +@.__const.5 = private unnamed_addr constant [2 x i64] [i64 ptrtoint (ptr @"foo.Foo$BAR" to i64), i64 ptrtoint (ptr @"foo.Foo$BAZ" to i64)], align 16 @"$ct.a2$foo.Foo" = linkonce global %.introspect { i8 15, i64 0, ptr null, i64 16, i64 ptrtoint (ptr @"$ct.foo.Foo" to i64), i64 2, [0 x i64] zeroinitializer }, align 8 @.str.6 = private unnamed_addr constant [17 x i8] c"Foo.elements: %s\00", align 1 @"$ct.long" = linkonce global %.introspect { i8 2, i64 0, ptr null, i64 8, i64 0, i64 0, [0 x i64] zeroinitializer }, align 8 +; Function Attrs: +define void @foo.main() #0 { entry: %x = alloca %"char[][]", align 8 %literal = alloca [2 x %"char[]"], align 16 @@ -52,20 +56,17 @@ entry: store %"char[][]" %1, ptr %x, align 8 %2 = insertvalue %"any*" undef, ptr %x, 0 %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.sa$String" to i64), 1 - %4 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %3, ptr %4, align 16 - %5 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.3, i64 13, ptr %varargslots, i64 1) + store %"any*" %3, ptr %varargslots, align 16 + %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.3, i64 13, ptr %varargslots, i64 1) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal2, ptr align 16 @.__const.5, i32 16, i1 false) - %6 = insertvalue %"any*" undef, ptr %literal2, 0 - %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.a2$foo.Foo" to i64), 1 - %8 = getelementptr inbounds [1 x %"any*"], ptr %varargslots1, i64 0, i64 0 - store %"any*" %7, ptr %8, align 16 - %9 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.4, i64 14, ptr %varargslots1, i64 1) + %5 = insertvalue %"any*" undef, ptr %literal2, 0 + %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.a2$foo.Foo" to i64), 1 + store %"any*" %6, ptr %varargslots1, align 16 + %7 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.4, i64 14, ptr %varargslots1, i64 1) store i64 2, ptr %taddr, align 8 - %10 = insertvalue %"any*" undef, ptr %taddr, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %12 = getelementptr inbounds [1 x %"any*"], ptr %varargslots4, i64 0, i64 0 - store %"any*" %11, ptr %12, align 16 - %13 = call i64 @std.io.printfn(ptr %retparam5, ptr @.str.6, i64 16, ptr %varargslots4, i64 1) + %8 = insertvalue %"any*" undef, ptr %taddr, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.long" to i64), 1 + store %"any*" %9, ptr %varargslots4, align 16 + %10 = call i64 @std.io.printfn(ptr %retparam5, ptr @.str.6, i64 16, ptr %varargslots4, i64 1) ret void } diff --git a/test/test_suite/errors/error_regression_2.c3t b/test/test_suite/errors/error_regression_2.c3t index 95edda84f..92d6e182a 100644 --- a/test/test_suite/errors/error_regression_2.c3t +++ b/test/test_suite/errors/error_regression_2.c3t @@ -153,37 +153,34 @@ fn void main() define void @test.Summary.print(ptr %0, ptr %1) #0 { entry: %title = alloca %"char[]", align 8 - %2 = getelementptr inbounds %Summary, ptr %0, i32 0, i32 0 - %3 = load ptr, ptr %2, align 8 - %ptrbool = icmp ne ptr %3, null + %2 = load ptr, ptr %0, align 8 + %ptrbool = icmp ne ptr %2, null br i1 %ptrbool, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry - %4 = getelementptr inbounds %Summary, ptr %0, i32 0, i32 0 - %5 = load ptr, ptr %4, align 8 - %6 = load %"char[]", ptr %5, align 8 + %3 = load ptr, ptr %0, align 8 + %4 = load %"char[]", ptr %3, align 8 br label %cond.phi cond.rhs: ; preds = %entry br label %cond.phi cond.phi: ; preds = %cond.rhs, %cond.lhs - %val = phi %"char[]" [ %6, %cond.lhs ], [ { ptr @.str.28, i64 7 }, %cond.rhs ] + %val = phi %"char[]" [ %4, %cond.lhs ], [ { ptr @.str.28, i64 7 }, %cond.rhs ] store %"char[]" %val, ptr %title, align 8 - %7 = getelementptr inbounds %"char[]", ptr %title, i32 0, i32 1 - %8 = load i64, ptr %7, align 8 - %trunc = trunc i64 %8 to i32 - %9 = getelementptr inbounds %"char[]", ptr %title, i32 0, i32 0 - %10 = getelementptr inbounds %Summary, ptr %0, i32 0, i32 1 - %11 = load i8, ptr %10, align 8 - %12 = trunc i8 %11 to i1 - %ternary = select i1 %12, ptr @.str.30, ptr @.str.31 - %13 = load ptr, ptr %9, align 8 - %14 = call i32 (ptr, ptr, ...) @fprintf(ptr %1, ptr @.str.29, i32 %trunc, ptr %13, ptr %ternary) + %ptradd = getelementptr inbounds i8, ptr %title, i64 8 + %5 = load i64, ptr %ptradd, align 8 + %trunc = trunc i64 %5 to i32 + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 8 + %6 = load i8, ptr %ptradd1, align 8 + %7 = trunc i8 %6 to i1 + %ternary = select i1 %7, ptr @.str.30, ptr @.str.31 + %8 = load ptr, ptr %title, align 8 + %9 = call i32 (ptr, ptr, ...) @fprintf(ptr %1, ptr @.str.29, i32 %trunc, ptr %8, ptr %ternary) ret void } - +; Function Attrs: define zeroext i8 @test.contains(ptr %0, i64 %1, ptr %2, i64 %3) #0 { entry: %haystack = alloca %"char[]", align 8 @@ -192,66 +189,64 @@ entry: %needle_len = alloca i64, align 8 %i = alloca i64, align 8 store ptr %0, ptr %haystack, align 8 - %ptroffset = getelementptr inbounds i64, ptr %haystack, i64 1 - store i64 %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %haystack, i64 8 + store i64 %1, ptr %ptradd, align 8 store ptr %2, ptr %needle, align 8 - %ptroffset1 = getelementptr inbounds i64, ptr %needle, i64 1 - store i64 %3, ptr %ptroffset1, align 8 - %4 = getelementptr inbounds %"char[]", ptr %haystack, i32 0, i32 1 - %5 = load i64, ptr %4, align 8 - store i64 %5, ptr %len, align 8 - %6 = getelementptr inbounds %"char[]", ptr %needle, i32 0, i32 1 - %7 = load i64, ptr %6, align 8 - store i64 %7, ptr %needle_len, align 8 - %8 = load i64, ptr %len, align 8 - %9 = load i64, ptr %needle_len, align 8 - %lt = icmp ult i64 %8, %9 + %ptradd1 = getelementptr inbounds i8, ptr %needle, i64 8 + store i64 %3, ptr %ptradd1, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %haystack, i64 8 + %4 = load i64, ptr %ptradd2, align 8 + store i64 %4, ptr %len, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %needle, i64 8 + %5 = load i64, ptr %ptradd3, align 8 + store i64 %5, ptr %needle_len, align 8 + %6 = load i64, ptr %len, align 8 + %7 = load i64, ptr %needle_len, align 8 + %lt = icmp ult i64 %6, %7 br i1 %lt, label %if.then, label %if.exit if.then: ; preds = %entry ret i8 0 if.exit: ; preds = %entry - %10 = load i64, ptr %needle_len, align 8 - %not = icmp eq i64 %10, 0 - br i1 %not, label %if.then2, label %if.exit3 + %8 = load i64, ptr %needle_len, align 8 + %not = icmp eq i64 %8, 0 + br i1 %not, label %if.then4, label %if.exit5 -if.then2: ; preds = %if.exit +if.then4: ; preds = %if.exit ret i8 1 -if.exit3: ; preds = %if.exit - %11 = load i64, ptr %len, align 8 - %12 = load i64, ptr %needle_len, align 8 - %sub = sub i64 %12, 1 - %sub4 = sub i64 %11, %sub - store i64 %sub4, ptr %len, align 8 +if.exit5: ; preds = %if.exit + %9 = load i64, ptr %len, align 8 + %10 = load i64, ptr %needle_len, align 8 + %sub = sub i64 %10, 1 + %sub6 = sub i64 %9, %sub + store i64 %sub6, ptr %len, align 8 store i64 0, ptr %i, align 8 br label %loop.cond -loop.cond: ; preds = %if.exit8, %if.exit3 - %13 = load i64, ptr %i, align 8 - %14 = load i64, ptr %len, align 8 - %lt5 = icmp ult i64 %13, %14 - br i1 %lt5, label %loop.body, label %loop.exit +loop.cond: ; preds = %if.exit10, %if.exit5 + %11 = load i64, ptr %i, align 8 + %12 = load i64, ptr %len, align 8 + %lt7 = icmp ult i64 %11, %12 + br i1 %lt7, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %15 = getelementptr inbounds %"char[]", ptr %haystack, i32 0, i32 0 - %16 = load ptr, ptr %15, align 8 - %17 = load i64, ptr %i, align 8 - %ptroffset6 = getelementptr inbounds i8, ptr %16, i64 %17 - %18 = getelementptr inbounds %"char[]", ptr %needle, i32 0, i32 0 - %19 = load ptr, ptr %18, align 8 - %20 = load i64, ptr %needle_len, align 8 - %21 = call i32 @memcmp(ptr %ptroffset6, ptr %19, i64 %20) - %eq = icmp eq i32 %21, 0 - br i1 %eq, label %if.then7, label %if.exit8 - -if.then7: ; preds = %loop.body + %13 = load ptr, ptr %haystack, align 8 + %14 = load i64, ptr %i, align 8 + %ptradd8 = getelementptr inbounds i8, ptr %13, i64 %14 + %15 = load ptr, ptr %needle, align 8 + %16 = load i64, ptr %needle_len, align 8 + %17 = call i32 @memcmp(ptr %ptradd8, ptr %15, i64 %16) + %eq = icmp eq i32 %17, 0 + br i1 %eq, label %if.then9, label %if.exit10 + +if.then9: ; preds = %loop.body ret i8 1 -if.exit8: ; preds = %loop.body - %22 = load i64, ptr %i, align 8 - %add = add i64 %22, 1 +if.exit10: ; preds = %loop.body + %18 = load i64, ptr %i, align 8 + %add = add i64 %18, 1 store i64 %add, ptr %i, align 8 br label %loop.cond @@ -259,293 +254,276 @@ loop.exit: ; preds = %loop.cond ret i8 0 } - +; Function Attrs: define i64 @test.readDoc(ptr %0, ptr %1, i64 %2) #0 { entry: %url = alloca %"char[]", align 8 %reterr = alloca i64, align 8 %literal = alloca %Doc, align 8 - %reterr8 = alloca i64, align 8 - %literal9 = alloca %Doc, align 8 + %reterr11 = alloca i64, align 8 + %literal12 = alloca %Doc, align 8 %error_var = alloca i64, align 8 - %literal10 = alloca %Head, align 8 + %literal13 = alloca %Head, align 8 %value = alloca %Head, align 8 %temp = alloca ptr, align 8 - %reterr17 = alloca i64, align 8 - %literal18 = alloca %Doc, align 8 - %error_var19 = alloca i64, align 8 - %literal20 = alloca %Head, align 8 - %error_var21 = alloca i64, align 8 - %value22 = alloca %"char[]", align 8 - %temp23 = alloca ptr, align 8 - %value29 = alloca %Head, align 8 - %temp30 = alloca ptr, align 8 + %reterr21 = alloca i64, align 8 + %literal22 = alloca %Doc, align 8 + %error_var23 = alloca i64, align 8 + %literal24 = alloca %Head, align 8 + %error_var25 = alloca i64, align 8 + %value26 = alloca %"char[]", align 8 + %temp27 = alloca ptr, align 8 + %value33 = alloca %Head, align 8 + %temp34 = alloca ptr, align 8 %len = alloca i64, align 8 %str = alloca ptr, align 8 - %reterr42 = alloca i64, align 8 - %literal43 = alloca %Doc, align 8 - %error_var44 = alloca i64, align 8 - %literal45 = alloca %Head, align 8 - %error_var46 = alloca i64, align 8 - %value48 = alloca %"char[]", align 8 - %temp49 = alloca ptr, align 8 - %value55 = alloca %Head, align 8 - %temp56 = alloca ptr, align 8 + %reterr48 = alloca i64, align 8 + %literal49 = alloca %Doc, align 8 + %error_var50 = alloca i64, align 8 + %literal51 = alloca %Head, align 8 + %error_var52 = alloca i64, align 8 + %value53 = alloca %"char[]", align 8 + %temp54 = alloca ptr, align 8 + %value60 = alloca %Head, align 8 + %temp61 = alloca ptr, align 8 store ptr %1, ptr %url, align 8 - %ptroffset = getelementptr inbounds i64, ptr %url, i64 1 - store i64 %2, ptr %ptroffset, align 8 - %3 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo = load ptr, ptr %3, align 8 - %4 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi = load i64, ptr %4, align 8 - %5 = call i8 @test.contains(ptr %lo, i64 %hi, ptr @.str, i64 4) - %6 = trunc i8 %5 to i1 - br i1 %6, label %if.then, label %if.exit + %ptradd = getelementptr inbounds i8, ptr %url, i64 8 + store i64 %2, ptr %ptradd, align 8 + %lo = load ptr, ptr %url, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %url, i64 8 + %hi = load i64, ptr %ptradd1, align 8 + %3 = call i8 @test.contains(ptr %lo, i64 %hi, ptr @.str, i64 4) + %4 = trunc i8 %3 to i1 + br i1 %4, label %if.then, label %if.exit if.then: ; preds = %entry ret i64 ptrtoint (ptr @"test.ReadError$BAD_READ" to i64) if.exit: ; preds = %entry - %7 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo1 = load ptr, ptr %7, align 8 - %8 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi2 = load i64, ptr %8, align 8 - %9 = call i8 @test.contains(ptr %lo1, i64 %hi2, ptr @.str.3, i64 12) - %10 = trunc i8 %9 to i1 - br i1 %10, label %if.then3, label %if.exit4 - -if.then3: ; preds = %if.exit + %lo2 = load ptr, ptr %url, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %url, i64 8 + %hi4 = load i64, ptr %ptradd3, align 8 + %5 = call i8 @test.contains(ptr %lo2, i64 %hi4, ptr @.str.3, i64 12) + %6 = trunc i8 %5 to i1 + br i1 %6, label %if.then5, label %if.exit6 + +if.then5: ; preds = %if.exit call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 8, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal, i32 8, i1 false) ret i64 0 -if.exit4: ; preds = %if.exit - %11 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo5 = load ptr, ptr %11, align 8 - %12 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi6 = load i64, ptr %12, align 8 - %13 = call i8 @test.contains(ptr %lo5, i64 %hi6, ptr @.str.4, i64 13) - %14 = trunc i8 %13 to i1 - br i1 %14, label %if.then7, label %if.exit13 - -if.then7: ; preds = %if.exit4 - %15 = getelementptr inbounds %Doc, ptr %literal9, i32 0, i32 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal10, ptr align 8 @.__const.5, i32 8, i1 false) - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value, ptr align 8 %literal10, i32 8, i1 false) - %16 = call ptr @std.core.mem.malloc(i64 8) #3 - store ptr %16, ptr %temp, align 8 - %17 = load ptr, ptr %temp, align 8 - %not = icmp eq ptr %17, null - br i1 %not, label %if.then11, label %if.exit12 - -if.then11: ; preds = %if.then7 +if.exit6: ; preds = %if.exit + %lo7 = load ptr, ptr %url, align 8 + %ptradd8 = getelementptr inbounds i8, ptr %url, i64 8 + %hi9 = load i64, ptr %ptradd8, align 8 + %7 = call i8 @test.contains(ptr %lo7, i64 %hi9, ptr @.str.4, i64 13) + %8 = trunc i8 %7 to i1 + br i1 %8, label %if.then10, label %if.exit16 + +if.then10: ; preds = %if.exit6 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal13, ptr align 8 @.__const.5, i32 8, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value, ptr align 8 %literal13, i32 8, i1 false) + %9 = call ptr @std.core.mem.malloc(i64 8) #3 + store ptr %9, ptr %temp, align 8 + %10 = load ptr, ptr %temp, align 8 + %not = icmp eq ptr %10, null + br i1 %not, label %if.then14, label %if.exit15 + +if.then14: ; preds = %if.then10 store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var, align 8 br label %guard_block -if.exit12: ; preds = %if.then7 - %18 = load ptr, ptr %temp, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %18, ptr align 8 %value, i32 8, i1 false) +if.exit15: ; preds = %if.then10 + %11 = load ptr, ptr %temp, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %11, ptr align 8 %value, i32 8, i1 false) br label %noerr_block -guard_block: ; preds = %if.then11 - %19 = load i64, ptr %error_var, align 8 - ret i64 %19 +guard_block: ; preds = %if.then14 + %12 = load i64, ptr %error_var, align 8 + ret i64 %12 -noerr_block: ; preds = %if.exit12 - %20 = load ptr, ptr %temp, align 8 - store ptr %20, ptr %15, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal9, i32 8, i1 false) +noerr_block: ; preds = %if.exit15 + %13 = load ptr, ptr %temp, align 8 + store ptr %13, ptr %literal12, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal12, i32 8, i1 false) ret i64 0 -if.exit13: ; preds = %if.exit4 - %21 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo14 = load ptr, ptr %21, align 8 - %22 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi15 = load i64, ptr %22, align 8 - %23 = call i8 @test.contains(ptr %lo14, i64 %hi15, ptr @.str.6, i64 11) - %24 = trunc i8 %23 to i1 - br i1 %24, label %if.then16, label %if.exit36 - -if.then16: ; preds = %if.exit13 - %25 = getelementptr inbounds %Doc, ptr %literal18, i32 0, i32 0 - store ptr null, ptr %literal20, align 8 - %26 = getelementptr inbounds %Head, ptr %literal20, i32 0, i32 0 - store %"char[]" zeroinitializer, ptr %value22, align 8 - %27 = call ptr @std.core.mem.malloc(i64 16) #3 - store ptr %27, ptr %temp23, align 8 - %28 = load ptr, ptr %temp23, align 8 - %not24 = icmp eq ptr %28, null - br i1 %not24, label %if.then25, label %if.exit26 - -if.then25: ; preds = %if.then16 - store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var21, align 8 - br label %guard_block27 - -if.exit26: ; preds = %if.then16 - %29 = load ptr, ptr %temp23, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %29, ptr align 8 %value22, i32 16, i1 false) - br label %noerr_block28 - -guard_block27: ; preds = %if.then25 - %30 = load i64, ptr %error_var21, align 8 - ret i64 %30 - -noerr_block28: ; preds = %if.exit26 - %31 = load ptr, ptr %temp23, align 8 - store ptr %31, ptr %26, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value29, ptr align 8 %literal20, i32 8, i1 false) - %32 = call ptr @std.core.mem.malloc(i64 8) #3 - store ptr %32, ptr %temp30, align 8 - %33 = load ptr, ptr %temp30, align 8 - %not31 = icmp eq ptr %33, null - br i1 %not31, label %if.then32, label %if.exit33 - -if.then32: ; preds = %noerr_block28 - store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var19, align 8 - br label %guard_block34 - -if.exit33: ; preds = %noerr_block28 - %34 = load ptr, ptr %temp30, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %34, ptr align 8 %value29, i32 8, i1 false) - br label %noerr_block35 - -guard_block34: ; preds = %if.then32 - %35 = load i64, ptr %error_var19, align 8 - ret i64 %35 - -noerr_block35: ; preds = %if.exit33 - %36 = load ptr, ptr %temp30, align 8 - store ptr %36, ptr %25, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal18, i32 8, i1 false) +if.exit16: ; preds = %if.exit6 + %lo17 = load ptr, ptr %url, align 8 + %ptradd18 = getelementptr inbounds i8, ptr %url, i64 8 + %hi19 = load i64, ptr %ptradd18, align 8 + %14 = call i8 @test.contains(ptr %lo17, i64 %hi19, ptr @.str.6, i64 11) + %15 = trunc i8 %14 to i1 + br i1 %15, label %if.then20, label %if.exit40 + +if.then20: ; preds = %if.exit16 + store ptr null, ptr %literal24, align 8 + store %"char[]" zeroinitializer, ptr %value26, align 8 + %16 = call ptr @std.core.mem.malloc(i64 16) #3 + store ptr %16, ptr %temp27, align 8 + %17 = load ptr, ptr %temp27, align 8 + %not28 = icmp eq ptr %17, null + br i1 %not28, label %if.then29, label %if.exit30 + +if.then29: ; preds = %if.then20 + store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var25, align 8 + br label %guard_block31 + +if.exit30: ; preds = %if.then20 + %18 = load ptr, ptr %temp27, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %18, ptr align 8 %value26, i32 16, i1 false) + br label %noerr_block32 + +guard_block31: ; preds = %if.then29 + %19 = load i64, ptr %error_var25, align 8 + ret i64 %19 + +noerr_block32: ; preds = %if.exit30 + %20 = load ptr, ptr %temp27, align 8 + store ptr %20, ptr %literal24, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value33, ptr align 8 %literal24, i32 8, i1 false) + %21 = call ptr @std.core.mem.malloc(i64 8) #3 + store ptr %21, ptr %temp34, align 8 + %22 = load ptr, ptr %temp34, align 8 + %not35 = icmp eq ptr %22, null + br i1 %not35, label %if.then36, label %if.exit37 + +if.then36: ; preds = %noerr_block32 + store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var23, align 8 + br label %guard_block38 + +if.exit37: ; preds = %noerr_block32 + %23 = load ptr, ptr %temp34, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %23, ptr align 8 %value33, i32 8, i1 false) + br label %noerr_block39 + +guard_block38: ; preds = %if.then36 + %24 = load i64, ptr %error_var23, align 8 + ret i64 %24 + +noerr_block39: ; preds = %if.exit37 + %25 = load ptr, ptr %temp34, align 8 + store ptr %25, ptr %literal22, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal22, i32 8, i1 false) ret i64 0 -if.exit36: ; preds = %if.exit13 - %37 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %38 = load i64, ptr %37, align 8 - %trunc = trunc i64 %38 to i32 - %39 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %40 = load ptr, ptr %39, align 8 - %41 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr null, i64 0, ptr @.str.7, i32 %trunc, ptr %40) - %sext = sext i32 %41 to i64 +if.exit40: ; preds = %if.exit16 + %ptradd41 = getelementptr inbounds i8, ptr %url, i64 8 + %26 = load i64, ptr %ptradd41, align 8 + %trunc = trunc i64 %26 to i32 + %27 = load ptr, ptr %url, align 8 + %28 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr null, i64 0, ptr @.str.7, i32 %trunc, ptr %27) + %sext = sext i32 %28 to i64 store i64 %sext, ptr %len, align 8 - %42 = load i64, ptr %len, align 8 - %add = add i64 %42, 1 - %43 = call ptr @std.core.mem.malloc(i64 %add) #3 - store ptr %43, ptr %str, align 8 - %44 = load ptr, ptr %str, align 8 - %not37 = icmp eq ptr %44, null - br i1 %not37, label %if.then38, label %if.exit39 - -if.then38: ; preds = %if.exit36 + %29 = load i64, ptr %len, align 8 + %add = add i64 %29, 1 + %30 = call ptr @std.core.mem.malloc(i64 %add) #3 + store ptr %30, ptr %str, align 8 + %31 = load ptr, ptr %str, align 8 + %not42 = icmp eq ptr %31, null + br i1 %not42, label %if.then43, label %if.exit44 + +if.then43: ; preds = %if.exit40 ret i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64) -if.exit39: ; preds = %if.exit36 - %45 = load i64, ptr %len, align 8 - %add40 = add i64 %45, 1 - %46 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %47 = load i64, ptr %46, align 8 - %trunc41 = trunc i64 %47 to i32 - %48 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %49 = load ptr, ptr %str, align 8 - %50 = load ptr, ptr %48, align 8 - %51 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr %49, i64 %add40, ptr @.str.8, i32 %trunc41, ptr %50) - %52 = getelementptr inbounds %Doc, ptr %literal43, i32 0, i32 0 - store ptr null, ptr %literal45, align 8 - %53 = getelementptr inbounds %Head, ptr %literal45, i32 0, i32 0 - %54 = load ptr, ptr %str, align 8 - %55 = load i64, ptr %len, align 8 - %sub = sub i64 %55, 1 - %56 = add i64 %sub, 1 - %size = sub i64 %56, 0 - %ptroffset47 = getelementptr inbounds i8, ptr %54, i64 0 - %57 = insertvalue %"char[]" undef, ptr %ptroffset47, 0 - %58 = insertvalue %"char[]" %57, i64 %size, 1 - store %"char[]" %58, ptr %value48, align 8 - %59 = call ptr @std.core.mem.malloc(i64 16) #3 - store ptr %59, ptr %temp49, align 8 - %60 = load ptr, ptr %temp49, align 8 - %not50 = icmp eq ptr %60, null - br i1 %not50, label %if.then51, label %if.exit52 - -if.then51: ; preds = %if.exit39 - store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var46, align 8 - br label %guard_block53 - -if.exit52: ; preds = %if.exit39 - %61 = load ptr, ptr %temp49, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %61, ptr align 8 %value48, i32 16, i1 false) - br label %noerr_block54 - -guard_block53: ; preds = %if.then51 - %62 = load i64, ptr %error_var46, align 8 - ret i64 %62 - -noerr_block54: ; preds = %if.exit52 - %63 = load ptr, ptr %temp49, align 8 - store ptr %63, ptr %53, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value55, ptr align 8 %literal45, i32 8, i1 false) - %64 = call ptr @std.core.mem.malloc(i64 8) #3 - store ptr %64, ptr %temp56, align 8 - %65 = load ptr, ptr %temp56, align 8 - %not57 = icmp eq ptr %65, null - br i1 %not57, label %if.then58, label %if.exit59 - -if.then58: ; preds = %noerr_block54 - store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var44, align 8 - br label %guard_block60 - -if.exit59: ; preds = %noerr_block54 - %66 = load ptr, ptr %temp56, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %66, ptr align 8 %value55, i32 8, i1 false) - br label %noerr_block61 - -guard_block60: ; preds = %if.then58 - %67 = load i64, ptr %error_var44, align 8 - ret i64 %67 - -noerr_block61: ; preds = %if.exit59 - %68 = load ptr, ptr %temp56, align 8 - store ptr %68, ptr %52, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal43, i32 8, i1 false) +if.exit44: ; preds = %if.exit40 + %32 = load i64, ptr %len, align 8 + %add45 = add i64 %32, 1 + %ptradd46 = getelementptr inbounds i8, ptr %url, i64 8 + %33 = load i64, ptr %ptradd46, align 8 + %trunc47 = trunc i64 %33 to i32 + %34 = load ptr, ptr %str, align 8 + %35 = load ptr, ptr %url, align 8 + %36 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr %34, i64 %add45, ptr @.str.8, i32 %trunc47, ptr %35) + store ptr null, ptr %literal51, align 8 + %37 = load ptr, ptr %str, align 8 + %38 = load i64, ptr %len, align 8 + %sub = sub i64 %38, 1 + %39 = add i64 %sub, 1 + %size = sub i64 %39, 0 + %40 = insertvalue %"char[]" undef, ptr %37, 0 + %41 = insertvalue %"char[]" %40, i64 %size, 1 + store %"char[]" %41, ptr %value53, align 8 + %42 = call ptr @std.core.mem.malloc(i64 16) #3 + store ptr %42, ptr %temp54, align 8 + %43 = load ptr, ptr %temp54, align 8 + %not55 = icmp eq ptr %43, null + br i1 %not55, label %if.then56, label %if.exit57 + +if.then56: ; preds = %if.exit44 + store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var52, align 8 + br label %guard_block58 + +if.exit57: ; preds = %if.exit44 + %44 = load ptr, ptr %temp54, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %44, ptr align 8 %value53, i32 16, i1 false) + br label %noerr_block59 + +guard_block58: ; preds = %if.then56 + %45 = load i64, ptr %error_var52, align 8 + ret i64 %45 + +noerr_block59: ; preds = %if.exit57 + %46 = load ptr, ptr %temp54, align 8 + store ptr %46, ptr %literal51, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %value60, ptr align 8 %literal51, i32 8, i1 false) + %47 = call ptr @std.core.mem.malloc(i64 8) #3 + store ptr %47, ptr %temp61, align 8 + %48 = load ptr, ptr %temp61, align 8 + %not62 = icmp eq ptr %48, null + br i1 %not62, label %if.then63, label %if.exit64 + +if.then63: ; preds = %noerr_block59 + store i64 ptrtoint (ptr @"test.ReadError$OUT_OF_MEMORY" to i64), ptr %error_var50, align 8 + br label %guard_block65 + +if.exit64: ; preds = %noerr_block59 + %49 = load ptr, ptr %temp61, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %49, ptr align 8 %value60, i32 8, i1 false) + br label %noerr_block66 + +guard_block65: ; preds = %if.then63 + %50 = load i64, ptr %error_var50, align 8 + ret i64 %50 + +noerr_block66: ; preds = %if.exit64 + %51 = load ptr, ptr %temp61, align 8 + store ptr %51, ptr %literal49, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %0, ptr align 8 %literal49, i32 8, i1 false) ret i64 0 } - +; Function Attrs: define { ptr, i8 } @test.buildSummary(ptr %0) #0 { entry: %doc = alloca %Doc, align 8 %literal = alloca %Summary, align 8 store ptr %0, ptr %doc, align 8 - %1 = getelementptr inbounds %Summary, ptr %literal, i32 0, i32 0 - store ptr null, ptr %1, align 8 - %2 = getelementptr inbounds %Summary, ptr %literal, i32 0, i32 1 - store i8 0, ptr %2, align 8 - %3 = getelementptr inbounds %Summary, ptr %literal, i32 0, i32 0 - %4 = getelementptr inbounds %Doc, ptr %doc, i32 0, i32 0 - %5 = load ptr, ptr %4, align 8 - %ptrbool = icmp ne ptr %5, null + store ptr null, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 8 + store i8 0, ptr %ptradd, align 8 + %1 = load ptr, ptr %doc, align 8 + %ptrbool = icmp ne ptr %1, null br i1 %ptrbool, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %entry - %6 = getelementptr inbounds %Doc, ptr %doc, i32 0, i32 0 - %7 = load ptr, ptr %6, align 8 - %8 = getelementptr inbounds %Head, ptr %7, i32 0, i32 0 - %9 = load ptr, ptr %8, align 8 + %2 = load ptr, ptr %doc, align 8 + %3 = load ptr, ptr %2, align 8 br label %cond.phi cond.rhs: ; preds = %entry br label %cond.phi cond.phi: ; preds = %cond.rhs, %cond.lhs - %val = phi ptr [ %9, %cond.lhs ], [ null, %cond.rhs ] - store ptr %val, ptr %3, align 8 - %10 = getelementptr inbounds %Summary, ptr %literal, i32 0, i32 1 - store i8 1, ptr %10, align 8 - %11 = load { ptr, i8 }, ptr %literal, align 8 - ret { ptr, i8 } %11 + %val = phi ptr [ %3, %cond.lhs ], [ null, %cond.rhs ] + store ptr %val, ptr %literal, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %literal, i64 8 + store i8 1, ptr %ptradd1, align 8 + %4 = load { ptr, i8 }, ptr %literal, align 8 + ret { ptr, i8 } %4 } - +; Function Attrs: define { ptr, i8 } @test.readAndBuildSummary(ptr %0, i64 %1) #0 { entry: %url = alloca %"char[]", align 8 @@ -554,119 +532,114 @@ entry: %literal = alloca %Summary, align 8 %taddr = alloca %Summary, align 8 store ptr %0, ptr %url, align 8 - %ptroffset = getelementptr inbounds i64, ptr %url, i64 1 - store i64 %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo = load ptr, ptr %2, align 8 - %3 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi = load i64, ptr %3, align 8 - %4 = call i64 @test.readDoc(ptr %retparam, ptr %lo, i64 %hi) - %not_err = icmp eq i64 %4, 0 - %5 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %5, label %after_check, label %else_block + %ptradd = getelementptr inbounds i8, ptr %url, i64 8 + store i64 %1, ptr %ptradd, align 8 + %lo = load ptr, ptr %url, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %url, i64 8 + %hi = load i64, ptr %ptradd1, align 8 + %2 = call i64 @test.readDoc(ptr %retparam, ptr %lo, i64 %hi) + %not_err = icmp eq i64 %2, 0 + %3 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %3, label %after_check, label %else_block after_check: ; preds = %entry - %6 = load ptr, ptr %retparam, align 8 - %7 = call { ptr, i8 } @test.buildSummary(ptr %6) - store { ptr, i8 } %7, ptr %result, align 8 - %8 = load %Summary, ptr %result, align 8 + %4 = load ptr, ptr %retparam, align 8 + %5 = call { ptr, i8 } @test.buildSummary(ptr %4) + store { ptr, i8 } %5, ptr %result, align 8 + %6 = load %Summary, ptr %result, align 8 br label %phi_block else_block: ; preds = %entry call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const.9, i32 16, i1 false) - %9 = load %Summary, ptr %literal, align 8 + %7 = load %Summary, ptr %literal, align 8 br label %phi_block phi_block: ; preds = %else_block, %after_check - %val = phi %Summary [ %8, %after_check ], [ %9, %else_block ] + %val = phi %Summary [ %6, %after_check ], [ %7, %else_block ] store %Summary %val, ptr %taddr, align 8 - %10 = load { ptr, i8 }, ptr %taddr, align 8 - ret { ptr, i8 } %10 + %8 = load { ptr, i8 }, ptr %taddr, align 8 + ret { ptr, i8 } %8 } - +; Function Attrs: define i64 @test.isTitleNonEmpty(ptr %0, ptr %1) #0 { entry: %doc = alloca %Doc, align 8 %head = alloca ptr, align 8 %reterr = alloca i64, align 8 store ptr %1, ptr %doc, align 8 - %2 = getelementptr inbounds %Doc, ptr %doc, i32 0, i32 0 - %3 = load ptr, ptr %2, align 8 - %not = icmp eq ptr %3, null + %2 = load ptr, ptr %doc, align 8 + %not = icmp eq ptr %2, null br i1 %not, label %if.then, label %if.exit if.then: ; preds = %entry ret i64 ptrtoint (ptr @"test.TitleResult$TITLE_MISSING" to i64) if.exit: ; preds = %entry - %4 = getelementptr inbounds %Doc, ptr %doc, i32 0, i32 0 - %5 = load ptr, ptr %4, align 8 - %6 = getelementptr inbounds %Head, ptr %5, i32 0, i32 0 - %7 = load ptr, ptr %6, align 8 - store ptr %7, ptr %head, align 8 - %8 = load ptr, ptr %head, align 8 - %not1 = icmp eq ptr %8, null + %3 = load ptr, ptr %doc, align 8 + %4 = load ptr, ptr %3, align 8 + store ptr %4, ptr %head, align 8 + %5 = load ptr, ptr %head, align 8 + %not1 = icmp eq ptr %5, null br i1 %not1, label %if.then2, label %if.exit3 if.then2: ; preds = %if.exit ret i64 ptrtoint (ptr @"test.TitleResult$TITLE_MISSING" to i64) if.exit3: ; preds = %if.exit - %9 = load ptr, ptr %head, align 8 - %10 = getelementptr inbounds %"char[]", ptr %9, i32 0, i32 1 - %11 = load i64, ptr %10, align 8 - %lt = icmp ult i64 0, %11 - %12 = zext i1 %lt to i8 - store i8 %12, ptr %0, align 1 + %6 = load ptr, ptr %head, align 8 + %ptradd = getelementptr inbounds i8, ptr %6, i64 8 + %7 = load i64, ptr %ptradd, align 8 + %lt = icmp ult i64 0, %7 + %8 = zext i1 %lt to i8 + store i8 %8, ptr %0, align 1 ret i64 0 } - +; Function Attrs: define i64 @test.readWhetherTitleNonEmpty(ptr %0, ptr %1, i64 %2) #0 { entry: %url = alloca %"char[]", align 8 %reterr = alloca i64, align 8 %retparam = alloca %Doc, align 8 - %retparam1 = alloca i8, align 1 + %retparam2 = alloca i8, align 1 store ptr %1, ptr %url, align 8 - %ptroffset = getelementptr inbounds i64, ptr %url, i64 1 - store i64 %2, ptr %ptroffset, align 8 - %3 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo = load ptr, ptr %3, align 8 - %4 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi = load i64, ptr %4, align 8 - %5 = call i64 @test.readDoc(ptr %retparam, ptr %lo, i64 %hi) - %not_err = icmp eq i64 %5, 0 - %6 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %6, label %after_check, label %assign_optional + %ptradd = getelementptr inbounds i8, ptr %url, i64 8 + store i64 %2, ptr %ptradd, align 8 + %lo = load ptr, ptr %url, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %url, i64 8 + %hi = load i64, ptr %ptradd1, align 8 + %3 = call i64 @test.readDoc(ptr %retparam, ptr %lo, i64 %hi) + %not_err = icmp eq i64 %3, 0 + %4 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %4, label %after_check, label %assign_optional assign_optional: ; preds = %entry - store i64 %5, ptr %reterr, align 8 + store i64 %3, ptr %reterr, align 8 br label %err_retblock after_check: ; preds = %entry - %7 = load ptr, ptr %retparam, align 8 - %8 = call i64 @test.isTitleNonEmpty(ptr %retparam1, ptr %7) - %not_err2 = icmp eq i64 %8, 0 - %9 = call i1 @llvm.expect.i1(i1 %not_err2, i1 true) - br i1 %9, label %after_check4, label %assign_optional3 - -assign_optional3: ; preds = %after_check - store i64 %8, ptr %reterr, align 8 + %5 = load ptr, ptr %retparam, align 8 + %6 = call i64 @test.isTitleNonEmpty(ptr %retparam2, ptr %5) + %not_err3 = icmp eq i64 %6, 0 + %7 = call i1 @llvm.expect.i1(i1 %not_err3, i1 true) + br i1 %7, label %after_check5, label %assign_optional4 + +assign_optional4: ; preds = %after_check + store i64 %6, ptr %reterr, align 8 br label %err_retblock -after_check4: ; preds = %after_check - %10 = load i8, ptr %retparam1, align 1 - store i8 %10, ptr %0, align 1 +after_check5: ; preds = %after_check + %8 = load i8, ptr %retparam2, align 1 + store i8 %8, ptr %0, align 1 ret i64 0 -err_retblock: ; preds = %assign_optional3, %assign_optional - %11 = load i64, ptr %reterr, align 8 - ret i64 %11 +err_retblock: ; preds = %assign_optional4, %assign_optional + %9 = load i64, ptr %reterr, align 8 + ret i64 %9 } - +; Function Attrs: define ptr @test.bool_to_string(i8 zeroext %0) #0 { entry: %1 = trunc i8 %0 to i1 @@ -675,7 +648,7 @@ entry: ret ptr %2 } - +; Function Attrs: define ptr @test.nameFromError(i64 %0) #0 { entry: %switch = alloca i64, align 8 @@ -711,7 +684,7 @@ switch.default: ; preds = %next_if6 ret ptr @.str.15 } - +; Function Attrs: define void @test.main() #0 { entry: %.anon = alloca i64, align 8 @@ -725,12 +698,12 @@ entry: %retparam = alloca i8, align 1 %blockret = alloca i64, align 8 %f = alloca i64, align 8 - %0 = load i64, ptr getelementptr inbounds (%"char[][]", ptr @main.URLS, i32 0, i32 1), align 8 + %0 = load i64, ptr getelementptr inbounds (i8, ptr @main.URLS, i64 8), align 8 store i64 %0, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond -loop.cond: ; preds = %phi_block16, %entry +loop.cond: ; preds = %phi_block19, %entry %1 = load i64, ptr %.anon1, align 8 %2 = load i64, ptr %.anon, align 8 %lt = icmp ult i64 %1, %2 @@ -739,103 +712,97 @@ loop.cond: ; preds = %phi_block16, %entry loop.body: ; preds = %loop.cond %3 = load ptr, ptr @main.URLS, align 8 %4 = load i64, ptr %.anon1, align 8 - %ptroffset = getelementptr inbounds %"char[]", ptr %3, i64 %4 + %ptroffset = getelementptr inbounds [16 x i8], ptr %3, i64 %4 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %url, ptr align 8 %ptroffset, i32 16, i1 false) - %5 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %6 = load i64, ptr %5, align 8 - %trunc = trunc i64 %6 to i32 - %7 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %8 = load ptr, ptr %7, align 8 - %9 = call i32 (ptr, ...) @printf(ptr @.str.21, i32 %trunc, ptr %8) - %10 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo = load ptr, ptr %10, align 8 - %11 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi = load i64, ptr %11, align 8 - %12 = call { ptr, i8 } @test.readAndBuildSummary(ptr %lo, i64 %hi) - store { ptr, i8 } %12, ptr %result, align 8 + %ptradd = getelementptr inbounds i8, ptr %url, i64 8 + %5 = load i64, ptr %ptradd, align 8 + %trunc = trunc i64 %5 to i32 + %6 = load ptr, ptr %url, align 8 + %7 = call i32 (ptr, ...) @printf(ptr @.str.21, i32 %trunc, ptr %6) + %lo = load ptr, ptr %url, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %url, i64 8 + %hi = load i64, ptr %ptradd2, align 8 + %8 = call { ptr, i8 } @test.readAndBuildSummary(ptr %lo, i64 %hi) + store { ptr, i8 } %8, ptr %result, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %summary, ptr align 8 %result, i32 16, i1 false) - %13 = call i32 (ptr, ...) @printf(ptr @.str.22) - %14 = load ptr, ptr @__stdoutp, align 8 - call void @test.Summary.print(ptr %summary, ptr %14) - %15 = call i32 (ptr, ...) @printf(ptr @.str.23) - %16 = getelementptr inbounds %Summary, ptr %summary, i32 0, i32 0 - %17 = load ptr, ptr %16, align 8 - %ptrbool = icmp ne ptr %17, null + %9 = call i32 (ptr, ...) @printf(ptr @.str.22) + %10 = load ptr, ptr @__stdoutp, align 8 + call void @test.Summary.print(ptr %summary, ptr %10) + %11 = call i32 (ptr, ...) @printf(ptr @.str.23) + %12 = load ptr, ptr %summary, align 8 + %ptrbool = icmp ne ptr %12, null br i1 %ptrbool, label %cond.lhs, label %cond.rhs cond.lhs: ; preds = %loop.body - %18 = getelementptr inbounds %Summary, ptr %summary, i32 0, i32 0 - %19 = load ptr, ptr %18, align 8 - %20 = load %"char[]", ptr %19, align 8 + %13 = load ptr, ptr %summary, align 8 + %14 = load %"char[]", ptr %13, align 8 br label %cond.phi cond.rhs: ; preds = %loop.body br label %cond.phi cond.phi: ; preds = %cond.rhs, %cond.lhs - %val = phi %"char[]" [ %20, %cond.lhs ], [ zeroinitializer, %cond.rhs ] + %val = phi %"char[]" [ %14, %cond.lhs ], [ zeroinitializer, %cond.rhs ] store %"char[]" %val, ptr %title_sure, align 8 - %21 = getelementptr inbounds %"char[]", ptr %title_sure, i32 0, i32 1 - %22 = load i64, ptr %21, align 8 - %trunc2 = trunc i64 %22 to i32 - %23 = getelementptr inbounds %"char[]", ptr %title_sure, i32 0, i32 0 - %24 = load ptr, ptr %23, align 8 - %25 = call i32 (ptr, ...) @printf(ptr @.str.24, i32 %trunc2, ptr %24) - %26 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 0 - %lo3 = load ptr, ptr %26, align 8 - %27 = getelementptr inbounds %"char[]", ptr %url, i32 0, i32 1 - %hi4 = load i64, ptr %27, align 8 - %28 = call i64 @test.readWhetherTitleNonEmpty(ptr %retparam, ptr %lo3, i64 %hi4) - %not_err = icmp eq i64 %28, 0 - %29 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %29, label %after_check, label %assign_optional + %ptradd3 = getelementptr inbounds i8, ptr %title_sure, i64 8 + %15 = load i64, ptr %ptradd3, align 8 + %trunc4 = trunc i64 %15 to i32 + %16 = load ptr, ptr %title_sure, align 8 + %17 = call i32 (ptr, ...) @printf(ptr @.str.24, i32 %trunc4, ptr %16) + %lo5 = load ptr, ptr %url, align 8 + %ptradd6 = getelementptr inbounds i8, ptr %url, i64 8 + %hi7 = load i64, ptr %ptradd6, align 8 + %18 = call i64 @test.readWhetherTitleNonEmpty(ptr %retparam, ptr %lo5, i64 %hi7) + %not_err = icmp eq i64 %18, 0 + %19 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %19, label %after_check, label %assign_optional assign_optional: ; preds = %cond.phi - store i64 %28, ptr %has_title.f, align 8 + store i64 %18, ptr %has_title.f, align 8 br label %after_assign after_check: ; preds = %cond.phi - %30 = load i8, ptr %retparam, align 1 - store i8 %30, ptr %has_title, align 1 + %20 = load i8, ptr %retparam, align 1 + store i8 %20, ptr %has_title, align 1 store i64 0, ptr %has_title.f, align 8 br label %after_assign after_assign: ; preds = %after_check, %assign_optional %optval = load i64, ptr %has_title.f, align 8 - %not_err5 = icmp eq i64 %optval, 0 - %31 = call i1 @llvm.expect.i1(i1 %not_err5, i1 true) - br i1 %31, label %after_check6, label %else_block + %not_err8 = icmp eq i64 %optval, 0 + %21 = call i1 @llvm.expect.i1(i1 %not_err8, i1 true) + br i1 %21, label %after_check9, label %else_block -after_check6: ; preds = %after_assign - %32 = load i8, ptr %has_title, align 1 - %33 = call ptr @test.bool_to_string(i8 zeroext %32) +after_check9: ; preds = %after_assign + %22 = load i8, ptr %has_title, align 1 + %23 = call ptr @test.bool_to_string(i8 zeroext %22) br label %phi_block else_block: ; preds = %after_assign br label %testblock testblock: ; preds = %else_block - %optval7 = load i64, ptr %has_title.f, align 8 - %not_err8 = icmp eq i64 %optval7, 0 - %34 = call i1 @llvm.expect.i1(i1 %not_err8, i1 true) - br i1 %34, label %after_check10, label %assign_optional9 + %optval10 = load i64, ptr %has_title.f, align 8 + %not_err11 = icmp eq i64 %optval10, 0 + %24 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) + br i1 %24, label %after_check13, label %assign_optional12 -assign_optional9: ; preds = %testblock - store i64 %optval7, ptr %f, align 8 +assign_optional12: ; preds = %testblock + store i64 %optval10, ptr %f, align 8 br label %end_block -after_check10: ; preds = %testblock +after_check13: ; preds = %testblock store i64 0, ptr %f, align 8 br label %end_block -end_block: ; preds = %after_check10, %assign_optional9 - %35 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %35, 0 +end_block: ; preds = %after_check13, %assign_optional12 + %25 = load i64, ptr %f, align 8 + %neq = icmp ne i64 %25, 0 br i1 %neq, label %if.then, label %if.exit if.then: ; preds = %end_block - %36 = load i64, ptr %f, align 8 - store i64 %36, ptr %blockret, align 8 + %26 = load i64, ptr %f, align 8 + store i64 %26, ptr %blockret, align 8 br label %expr_block.exit if.exit: ; preds = %end_block @@ -843,31 +810,31 @@ if.exit: ; preds = %end_block br label %expr_block.exit expr_block.exit: ; preds = %if.exit, %if.then - %37 = load i64, ptr %blockret, align 8 - %38 = call ptr @test.nameFromError(i64 %37) + %27 = load i64, ptr %blockret, align 8 + %28 = call ptr @test.nameFromError(i64 %27) br label %phi_block -phi_block: ; preds = %expr_block.exit, %after_check6 - %val11 = phi ptr [ %33, %after_check6 ], [ %38, %expr_block.exit ] - %optval12 = load i64, ptr %has_title.f, align 8 - %not_err13 = icmp eq i64 %optval12, 0 - %39 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) - br i1 %39, label %after_check14, label %else_block15 - -after_check14: ; preds = %phi_block - %40 = load i8, ptr %has_title, align 1 - %41 = trunc i8 %40 to i1 - br label %phi_block16 - -else_block15: ; preds = %phi_block - br label %phi_block16 - -phi_block16: ; preds = %else_block15, %after_check14 - %val17 = phi i1 [ %41, %after_check14 ], [ false, %else_block15 ] - %ternary = select i1 %val17, ptr @.str.26, ptr @.str.27 - %42 = call i32 (ptr, ...) @printf(ptr @.str.25, ptr %val11, ptr %ternary) - %43 = load i64, ptr %.anon1, align 8 - %add = add i64 %43, 1 +phi_block: ; preds = %expr_block.exit, %after_check9 + %val14 = phi ptr [ %23, %after_check9 ], [ %28, %expr_block.exit ] + %optval15 = load i64, ptr %has_title.f, align 8 + %not_err16 = icmp eq i64 %optval15, 0 + %29 = call i1 @llvm.expect.i1(i1 %not_err16, i1 true) + br i1 %29, label %after_check17, label %else_block18 + +after_check17: ; preds = %phi_block + %30 = load i8, ptr %has_title, align 1 + %31 = trunc i8 %30 to i1 + br label %phi_block19 + +else_block18: ; preds = %phi_block + br label %phi_block19 + +phi_block19: ; preds = %else_block18, %after_check17 + %val20 = phi i1 [ %31, %after_check17 ], [ false, %else_block18 ] + %ternary = select i1 %val20, ptr @.str.26, ptr @.str.27 + %32 = call i32 (ptr, ...) @printf(ptr @.str.25, ptr %val14, ptr %ternary) + %33 = load i64, ptr %.anon1, align 8 + %add = add i64 %33, 1 store i64 %add, ptr %.anon1, align 8 br label %loop.cond diff --git a/test/test_suite/errors/multiple_catch.c3t b/test/test_suite/errors/multiple_catch.c3t index d16fba3d4..ab106fe4e 100644 --- a/test/test_suite/errors/multiple_catch.c3t +++ b/test/test_suite/errors/multiple_catch.c3t @@ -100,35 +100,34 @@ end_block: ; preds = %after_check4, %assi if.then: ; preds = %end_block %5 = insertvalue %"any*" undef, ptr %err, 0 %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %7 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %6, ptr %7, align 16 - %8 = call i64 @std.io.printfn(ptr %retparam5, ptr @.str.3, i64 8, ptr %varargslots, i64 1) + store %"any*" %6, ptr %varargslots, align 16 + %7 = call i64 @std.io.printfn(ptr %retparam5, ptr @.str.3, i64 8, ptr %varargslots, i64 1) br label %if.exit if.exit: ; preds = %if.then, %end_block br label %testblock9 testblock9: ; preds = %if.exit - %9 = call i64 @demo1.hello(ptr %retparam10, i32 0) - %not_err11 = icmp eq i64 %9, 0 - %10 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) - br i1 %10, label %after_check13, label %assign_optional12 + %8 = call i64 @demo1.hello(ptr %retparam10, i32 0) + %not_err11 = icmp eq i64 %8, 0 + %9 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) + br i1 %9, label %after_check13, label %assign_optional12 assign_optional12: ; preds = %testblock9 - store i64 %9, ptr %err8, align 8 + store i64 %8, ptr %err8, align 8 br label %end_block18 after_check13: ; preds = %testblock9 br label %testblock14 testblock14: ; preds = %after_check13 - %11 = call i64 @demo1.bye() - %not_err15 = icmp eq i64 %11, 0 - %12 = call i1 @llvm.expect.i1(i1 %not_err15, i1 true) - br i1 %12, label %after_check17, label %assign_optional16 + %10 = call i64 @demo1.bye() + %not_err15 = icmp eq i64 %10, 0 + %11 = call i1 @llvm.expect.i1(i1 %not_err15, i1 true) + br i1 %11, label %after_check17, label %assign_optional16 assign_optional16: ; preds = %testblock14 - store i64 %11, ptr %err8, align 8 + store i64 %10, ptr %err8, align 8 br label %end_block18 after_check17: ; preds = %testblock14 @@ -136,42 +135,41 @@ after_check17: ; preds = %testblock14 br label %end_block18 end_block18: ; preds = %after_check17, %assign_optional16, %assign_optional12 - %13 = load i64, ptr %err8, align 8 - %neq19 = icmp ne i64 %13, 0 + %12 = load i64, ptr %err8, align 8 + %neq19 = icmp ne i64 %12, 0 br i1 %neq19, label %if.then20, label %if.exit25 if.then20: ; preds = %end_block18 - %14 = insertvalue %"any*" undef, ptr %err8, 0 - %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %16 = getelementptr inbounds [1 x %"any*"], ptr %varargslots21, i64 0, i64 0 - store %"any*" %15, ptr %16, align 16 - %17 = call i64 @std.io.printfn(ptr %retparam22, ptr @.str.4, i64 8, ptr %varargslots21, i64 1) + %13 = insertvalue %"any*" undef, ptr %err8, 0 + %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %14, ptr %varargslots21, align 16 + %15 = call i64 @std.io.printfn(ptr %retparam22, ptr @.str.4, i64 8, ptr %varargslots21, i64 1) br label %if.exit25 if.exit25: ; preds = %if.then20, %end_block18 br label %testblock26 testblock26: ; preds = %if.exit25 - %18 = call i64 @demo1.hello(ptr %retparam27, i32 0) - %not_err28 = icmp eq i64 %18, 0 - %19 = call i1 @llvm.expect.i1(i1 %not_err28, i1 true) - br i1 %19, label %after_check30, label %assign_optional29 + %16 = call i64 @demo1.hello(ptr %retparam27, i32 0) + %not_err28 = icmp eq i64 %16, 0 + %17 = call i1 @llvm.expect.i1(i1 %not_err28, i1 true) + br i1 %17, label %after_check30, label %assign_optional29 assign_optional29: ; preds = %testblock26 - store i64 %18, ptr %temp_err, align 8 + store i64 %16, ptr %temp_err, align 8 br label %end_block35 after_check30: ; preds = %testblock26 br label %testblock31 testblock31: ; preds = %after_check30 - %20 = call i64 @demo1.bye() - %not_err32 = icmp eq i64 %20, 0 - %21 = call i1 @llvm.expect.i1(i1 %not_err32, i1 true) - br i1 %21, label %after_check34, label %assign_optional33 + %18 = call i64 @demo1.bye() + %not_err32 = icmp eq i64 %18, 0 + %19 = call i1 @llvm.expect.i1(i1 %not_err32, i1 true) + br i1 %19, label %after_check34, label %assign_optional33 assign_optional33: ; preds = %testblock31 - store i64 %20, ptr %temp_err, align 8 + store i64 %18, ptr %temp_err, align 8 br label %end_block35 after_check34: ; preds = %testblock31 @@ -179,19 +177,19 @@ after_check34: ; preds = %testblock31 br label %end_block35 end_block35: ; preds = %after_check34, %assign_optional33, %assign_optional29 - %22 = load i64, ptr %temp_err, align 8 - %neq36 = icmp ne i64 %22, 0 + %20 = load i64, ptr %temp_err, align 8 + %neq36 = icmp ne i64 %20, 0 br i1 %neq36, label %if.then37, label %if.exit55 if.then37: ; preds = %end_block35 - %23 = call ptr @std.io.stdout() - %24 = call i64 @std.io.File.write(ptr %retparam39, ptr %23, ptr @.str.5, i64 4) - %not_err40 = icmp eq i64 %24, 0 - %25 = call i1 @llvm.expect.i1(i1 %not_err40, i1 true) - br i1 %25, label %after_check42, label %assign_optional41 + %21 = call ptr @std.io.stdout() + %22 = call i64 @std.io.File.write(ptr %retparam39, ptr %21, ptr @.str.5, i64 4) + %not_err40 = icmp eq i64 %22, 0 + %23 = call i1 @llvm.expect.i1(i1 %not_err40, i1 true) + br i1 %23, label %after_check42, label %assign_optional41 assign_optional41: ; preds = %if.then37 - store i64 %24, ptr %error_var, align 8 + store i64 %22, ptr %error_var, align 8 br label %guard_block after_check42: ; preds = %if.then37 @@ -201,15 +199,15 @@ guard_block: ; preds = %assign_optional41 br label %voiderr noerr_block: ; preds = %after_check42 - %26 = load i64, ptr %retparam39, align 8 - store i64 %26, ptr %len, align 8 - %27 = call i64 @std.io.File.write_byte(ptr %23, i8 zeroext 10) - %not_err44 = icmp eq i64 %27, 0 - %28 = call i1 @llvm.expect.i1(i1 %not_err44, i1 true) - br i1 %28, label %after_check46, label %assign_optional45 + %24 = load i64, ptr %retparam39, align 8 + store i64 %24, ptr %len, align 8 + %25 = call i64 @std.io.File.write_byte(ptr %21, i8 zeroext 10) + %not_err44 = icmp eq i64 %25, 0 + %26 = call i1 @llvm.expect.i1(i1 %not_err44, i1 true) + br i1 %26, label %after_check46, label %assign_optional45 assign_optional45: ; preds = %noerr_block - store i64 %27, ptr %error_var43, align 8 + store i64 %25, ptr %error_var43, align 8 br label %guard_block47 after_check46: ; preds = %noerr_block @@ -219,13 +217,13 @@ guard_block47: ; preds = %assign_optional45 br label %voiderr noerr_block48: ; preds = %after_check46 - %29 = call i64 @std.io.File.flush(ptr %23) - %not_err50 = icmp eq i64 %29, 0 - %30 = call i1 @llvm.expect.i1(i1 %not_err50, i1 true) - br i1 %30, label %after_check52, label %assign_optional51 + %27 = call i64 @std.io.File.flush(ptr %21) + %not_err50 = icmp eq i64 %27, 0 + %28 = call i1 @llvm.expect.i1(i1 %not_err50, i1 true) + br i1 %28, label %after_check52, label %assign_optional51 assign_optional51: ; preds = %noerr_block48 - store i64 %29, ptr %error_var49, align 8 + store i64 %27, ptr %error_var49, align 8 br label %guard_block53 after_check52: ; preds = %noerr_block48 @@ -235,8 +233,8 @@ guard_block53: ; preds = %assign_optional51 br label %voiderr noerr_block54: ; preds = %after_check52 - %31 = load i64, ptr %len, align 8 - %add = add i64 %31, 1 + %29 = load i64, ptr %len, align 8 + %add = add i64 %29, 1 br label %voiderr voiderr: ; preds = %noerr_block54, %guard_block53, %guard_block47, %guard_block @@ -246,26 +244,26 @@ if.exit55: ; preds = %voiderr, %end_block br label %testblock57 testblock57: ; preds = %if.exit55 - %32 = call i64 @demo1.hello(ptr %retparam58, i32 0) - %not_err59 = icmp eq i64 %32, 0 - %33 = call i1 @llvm.expect.i1(i1 %not_err59, i1 true) - br i1 %33, label %after_check61, label %assign_optional60 + %30 = call i64 @demo1.hello(ptr %retparam58, i32 0) + %not_err59 = icmp eq i64 %30, 0 + %31 = call i1 @llvm.expect.i1(i1 %not_err59, i1 true) + br i1 %31, label %after_check61, label %assign_optional60 assign_optional60: ; preds = %testblock57 - store i64 %32, ptr %err56, align 8 + store i64 %30, ptr %err56, align 8 br label %end_block66 after_check61: ; preds = %testblock57 br label %testblock62 testblock62: ; preds = %after_check61 - %34 = call i64 @demo1.bye() - %not_err63 = icmp eq i64 %34, 0 - %35 = call i1 @llvm.expect.i1(i1 %not_err63, i1 true) - br i1 %35, label %after_check65, label %assign_optional64 + %32 = call i64 @demo1.bye() + %not_err63 = icmp eq i64 %32, 0 + %33 = call i1 @llvm.expect.i1(i1 %not_err63, i1 true) + br i1 %33, label %after_check65, label %assign_optional64 assign_optional64: ; preds = %testblock62 - store i64 %34, ptr %err56, align 8 + store i64 %32, ptr %err56, align 8 br label %end_block66 after_check65: ; preds = %testblock62 @@ -273,16 +271,15 @@ after_check65: ; preds = %testblock62 br label %end_block66 end_block66: ; preds = %after_check65, %assign_optional64, %assign_optional60 - %36 = load i64, ptr %err56, align 8 - %neq67 = icmp ne i64 %36, 0 + %34 = load i64, ptr %err56, align 8 + %neq67 = icmp ne i64 %34, 0 br i1 %neq67, label %if.then68, label %if.exit73 if.then68: ; preds = %end_block66 - %37 = insertvalue %"any*" undef, ptr %err56, 0 - %38 = insertvalue %"any*" %37, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %39 = getelementptr inbounds [1 x %"any*"], ptr %varargslots69, i64 0, i64 0 - store %"any*" %38, ptr %39, align 16 - %40 = call i64 @std.io.printfn(ptr %retparam70, ptr @.str.6, i64 8, ptr %varargslots69, i64 1) + %35 = insertvalue %"any*" undef, ptr %err56, 0 + %36 = insertvalue %"any*" %35, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %36, ptr %varargslots69, align 16 + %37 = call i64 @std.io.printfn(ptr %retparam70, ptr @.str.6, i64 8, ptr %varargslots69, i64 1) br label %if.exit73 if.exit73: ; preds = %if.then68, %end_block66 diff --git a/test/test_suite/errors/optional_chained_init.c3t b/test/test_suite/errors/optional_chained_init.c3t index c67fb5719..624ab87ad 100644 --- a/test/test_suite/errors/optional_chained_init.c3t +++ b/test/test_suite/errors/optional_chained_init.c3t @@ -93,9 +93,8 @@ end_block: ; preds = %after_check, %assig if.then: ; preds = %end_block %2 = insertvalue %"any*" undef, ptr %err, 0 %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %4 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %3, ptr %4, align 16 - %5 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 13, ptr %varargslots, i64 1) + store %"any*" %3, ptr %varargslots, align 16 + %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 13, ptr %varargslots, i64 1) br label %if.exit if.exit: ; preds = %if.then, %end_block @@ -104,8 +103,8 @@ if.exit: ; preds = %if.then, %end_block testblock4: ; preds = %if.exit %optval5 = load i64, ptr %b.f, align 8 %not_err6 = icmp eq i64 %optval5, 0 - %6 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true) - br i1 %6, label %after_check8, label %assign_optional7 + %5 = call i1 @llvm.expect.i1(i1 %not_err6, i1 true) + br i1 %5, label %after_check8, label %assign_optional7 assign_optional7: ; preds = %testblock4 store i64 %optval5, ptr %err3, align 8 @@ -116,55 +115,52 @@ after_check8: ; preds = %testblock4 br label %end_block9 end_block9: ; preds = %after_check8, %assign_optional7 - %7 = load i64, ptr %err3, align 8 - %neq10 = icmp ne i64 %7, 0 + %6 = load i64, ptr %err3, align 8 + %neq10 = icmp ne i64 %6, 0 br i1 %neq10, label %if.then11, label %if.exit16 if.then11: ; preds = %end_block9 - %8 = insertvalue %"any*" undef, ptr %err3, 0 - %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %10 = getelementptr inbounds [1 x %"any*"], ptr %varargslots12, i64 0, i64 0 - store %"any*" %9, ptr %10, align 16 - %11 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.1, i64 13, ptr %varargslots12, i64 1) + %7 = insertvalue %"any*" undef, ptr %err3, 0 + %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %8, ptr %varargslots12, align 16 + %9 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.1, i64 13, ptr %varargslots12, i64 1) br label %if.exit16 if.exit16: ; preds = %if.then11, %end_block9 %optval18 = load i64, ptr %a.f, align 8 %not_err19 = icmp eq i64 %optval18, 0 - %12 = call i1 @llvm.expect.i1(i1 %not_err19, i1 true) - br i1 %12, label %after_check20, label %after_check23 + %10 = call i1 @llvm.expect.i1(i1 %not_err19, i1 true) + br i1 %10, label %after_check20, label %after_check23 after_check20: ; preds = %if.exit16 - %13 = insertvalue %"any*" undef, ptr %a, 0 - %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %15 = getelementptr inbounds [1 x %"any*"], ptr %varargslots17, i64 0, i64 0 - store %"any*" %14, ptr %15, align 16 - %16 = call i64 @std.io.printfn(ptr %retparam21, ptr @.str.2, i64 9, ptr %varargslots17, i64 1) - %not_err22 = icmp eq i64 %16, 0 - %17 = call i1 @llvm.expect.i1(i1 %not_err22, i1 true) - br i1 %17, label %after_check23, label %after_check23 + %11 = insertvalue %"any*" undef, ptr %a, 0 + %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %12, ptr %varargslots17, align 16 + %13 = call i64 @std.io.printfn(ptr %retparam21, ptr @.str.2, i64 9, ptr %varargslots17, i64 1) + %not_err22 = icmp eq i64 %13, 0 + %14 = call i1 @llvm.expect.i1(i1 %not_err22, i1 true) + br i1 %14, label %after_check23, label %after_check23 after_check23: ; preds = %if.exit16, %after_check20, %after_check20 %optval25 = load i64, ptr %b.f, align 8 %not_err26 = icmp eq i64 %optval25, 0 - %18 = call i1 @llvm.expect.i1(i1 %not_err26, i1 true) - br i1 %18, label %after_check27, label %after_check30 + %15 = call i1 @llvm.expect.i1(i1 %not_err26, i1 true) + br i1 %15, label %after_check27, label %after_check30 after_check27: ; preds = %after_check23 - %19 = insertvalue %"any*" undef, ptr %b, 0 - %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %21 = getelementptr inbounds [1 x %"any*"], ptr %varargslots24, i64 0, i64 0 - store %"any*" %20, ptr %21, align 16 - %22 = call i64 @std.io.printfn(ptr %retparam28, ptr @.str.3, i64 9, ptr %varargslots24, i64 1) - %not_err29 = icmp eq i64 %22, 0 - %23 = call i1 @llvm.expect.i1(i1 %not_err29, i1 true) - br i1 %23, label %after_check30, label %after_check30 + %16 = insertvalue %"any*" undef, ptr %b, 0 + %17 = insertvalue %"any*" %16, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %17, ptr %varargslots24, align 16 + %18 = call i64 @std.io.printfn(ptr %retparam28, ptr @.str.3, i64 9, ptr %varargslots24, i64 1) + %not_err29 = icmp eq i64 %18, 0 + %19 = call i1 @llvm.expect.i1(i1 %not_err29, i1 true) + br i1 %19, label %after_check30, label %after_check30 after_check30: ; preds = %after_check23, %after_check27, %after_check27 ret void } - +; Function Attrs: define void @test.test2() #0 { entry: %x = alloca i32, align 4 @@ -236,9 +232,8 @@ end_block: ; preds = %after_check5, %assi if.then: ; preds = %end_block %4 = insertvalue %"any*" undef, ptr %err, 0 %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %6 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %5, ptr %6, align 16 - %7 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.4, i64 13, ptr %varargslots, i64 1) + store %"any*" %5, ptr %varargslots, align 16 + %6 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.4, i64 13, ptr %varargslots, i64 1) br label %if.exit if.exit: ; preds = %if.then, %end_block @@ -247,8 +242,8 @@ if.exit: ; preds = %if.then, %end_block testblock9: ; preds = %if.exit %optval10 = load i64, ptr %b.f, align 8 %not_err11 = icmp eq i64 %optval10, 0 - %8 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) - br i1 %8, label %after_check13, label %assign_optional12 + %7 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) + br i1 %7, label %after_check13, label %assign_optional12 assign_optional12: ; preds = %testblock9 store i64 %optval10, ptr %err8, align 8 @@ -259,55 +254,52 @@ after_check13: ; preds = %testblock9 br label %end_block14 end_block14: ; preds = %after_check13, %assign_optional12 - %9 = load i64, ptr %err8, align 8 - %neq15 = icmp ne i64 %9, 0 + %8 = load i64, ptr %err8, align 8 + %neq15 = icmp ne i64 %8, 0 br i1 %neq15, label %if.then16, label %if.exit21 if.then16: ; preds = %end_block14 - %10 = insertvalue %"any*" undef, ptr %err8, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %12 = getelementptr inbounds [1 x %"any*"], ptr %varargslots17, i64 0, i64 0 - store %"any*" %11, ptr %12, align 16 - %13 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.5, i64 13, ptr %varargslots17, i64 1) + %9 = insertvalue %"any*" undef, ptr %err8, 0 + %10 = insertvalue %"any*" %9, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %10, ptr %varargslots17, align 16 + %11 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.5, i64 13, ptr %varargslots17, i64 1) br label %if.exit21 if.exit21: ; preds = %if.then16, %end_block14 %optval23 = load i64, ptr %a.f, align 8 %not_err24 = icmp eq i64 %optval23, 0 - %14 = call i1 @llvm.expect.i1(i1 %not_err24, i1 true) - br i1 %14, label %after_check25, label %after_check28 + %12 = call i1 @llvm.expect.i1(i1 %not_err24, i1 true) + br i1 %12, label %after_check25, label %after_check28 after_check25: ; preds = %if.exit21 - %15 = insertvalue %"any*" undef, ptr %a, 0 - %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %17 = getelementptr inbounds [1 x %"any*"], ptr %varargslots22, i64 0, i64 0 - store %"any*" %16, ptr %17, align 16 - %18 = call i64 @std.io.printfn(ptr %retparam26, ptr @.str.6, i64 9, ptr %varargslots22, i64 1) - %not_err27 = icmp eq i64 %18, 0 - %19 = call i1 @llvm.expect.i1(i1 %not_err27, i1 true) - br i1 %19, label %after_check28, label %after_check28 + %13 = insertvalue %"any*" undef, ptr %a, 0 + %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %14, ptr %varargslots22, align 16 + %15 = call i64 @std.io.printfn(ptr %retparam26, ptr @.str.6, i64 9, ptr %varargslots22, i64 1) + %not_err27 = icmp eq i64 %15, 0 + %16 = call i1 @llvm.expect.i1(i1 %not_err27, i1 true) + br i1 %16, label %after_check28, label %after_check28 after_check28: ; preds = %if.exit21, %after_check25, %after_check25 %optval30 = load i64, ptr %b.f, align 8 %not_err31 = icmp eq i64 %optval30, 0 - %20 = call i1 @llvm.expect.i1(i1 %not_err31, i1 true) - br i1 %20, label %after_check32, label %after_check35 + %17 = call i1 @llvm.expect.i1(i1 %not_err31, i1 true) + br i1 %17, label %after_check32, label %after_check35 after_check32: ; preds = %after_check28 - %21 = insertvalue %"any*" undef, ptr %b, 0 - %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %23 = getelementptr inbounds [1 x %"any*"], ptr %varargslots29, i64 0, i64 0 - store %"any*" %22, ptr %23, align 16 - %24 = call i64 @std.io.printfn(ptr %retparam33, ptr @.str.7, i64 9, ptr %varargslots29, i64 1) - %not_err34 = icmp eq i64 %24, 0 - %25 = call i1 @llvm.expect.i1(i1 %not_err34, i1 true) - br i1 %25, label %after_check35, label %after_check35 + %18 = insertvalue %"any*" undef, ptr %b, 0 + %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %19, ptr %varargslots29, align 16 + %20 = call i64 @std.io.printfn(ptr %retparam33, ptr @.str.7, i64 9, ptr %varargslots29, i64 1) + %not_err34 = icmp eq i64 %20, 0 + %21 = call i1 @llvm.expect.i1(i1 %not_err34, i1 true) + br i1 %21, label %after_check35, label %after_check35 after_check35: ; preds = %after_check28, %after_check32, %after_check32 ret void } - +; Function Attrs: define void @test.test3() #0 { entry: %x = alloca i32, align 4 @@ -380,9 +372,8 @@ end_block: ; preds = %after_check5, %assi if.then: ; preds = %end_block %4 = insertvalue %"any*" undef, ptr %err, 0 %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %6 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %5, ptr %6, align 16 - %7 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.8, i64 13, ptr %varargslots, i64 1) + store %"any*" %5, ptr %varargslots, align 16 + %6 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.8, i64 13, ptr %varargslots, i64 1) br label %if.exit if.exit: ; preds = %if.then, %end_block @@ -391,8 +382,8 @@ if.exit: ; preds = %if.then, %end_block testblock9: ; preds = %if.exit %optval10 = load i64, ptr %b.f, align 8 %not_err11 = icmp eq i64 %optval10, 0 - %8 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) - br i1 %8, label %after_check13, label %assign_optional12 + %7 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) + br i1 %7, label %after_check13, label %assign_optional12 assign_optional12: ; preds = %testblock9 store i64 %optval10, ptr %err8, align 8 @@ -403,49 +394,46 @@ after_check13: ; preds = %testblock9 br label %end_block14 end_block14: ; preds = %after_check13, %assign_optional12 - %9 = load i64, ptr %err8, align 8 - %neq15 = icmp ne i64 %9, 0 + %8 = load i64, ptr %err8, align 8 + %neq15 = icmp ne i64 %8, 0 br i1 %neq15, label %if.then16, label %if.exit21 if.then16: ; preds = %end_block14 - %10 = insertvalue %"any*" undef, ptr %err8, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %12 = getelementptr inbounds [1 x %"any*"], ptr %varargslots17, i64 0, i64 0 - store %"any*" %11, ptr %12, align 16 - %13 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.9, i64 13, ptr %varargslots17, i64 1) + %9 = insertvalue %"any*" undef, ptr %err8, 0 + %10 = insertvalue %"any*" %9, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %10, ptr %varargslots17, align 16 + %11 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.9, i64 13, ptr %varargslots17, i64 1) br label %if.exit21 if.exit21: ; preds = %if.then16, %end_block14 %optval23 = load i64, ptr %a.f, align 8 %not_err24 = icmp eq i64 %optval23, 0 - %14 = call i1 @llvm.expect.i1(i1 %not_err24, i1 true) - br i1 %14, label %after_check25, label %after_check28 + %12 = call i1 @llvm.expect.i1(i1 %not_err24, i1 true) + br i1 %12, label %after_check25, label %after_check28 after_check25: ; preds = %if.exit21 - %15 = insertvalue %"any*" undef, ptr %a, 0 - %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %17 = getelementptr inbounds [1 x %"any*"], ptr %varargslots22, i64 0, i64 0 - store %"any*" %16, ptr %17, align 16 - %18 = call i64 @std.io.printfn(ptr %retparam26, ptr @.str.10, i64 9, ptr %varargslots22, i64 1) - %not_err27 = icmp eq i64 %18, 0 - %19 = call i1 @llvm.expect.i1(i1 %not_err27, i1 true) - br i1 %19, label %after_check28, label %after_check28 + %13 = insertvalue %"any*" undef, ptr %a, 0 + %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %14, ptr %varargslots22, align 16 + %15 = call i64 @std.io.printfn(ptr %retparam26, ptr @.str.10, i64 9, ptr %varargslots22, i64 1) + %not_err27 = icmp eq i64 %15, 0 + %16 = call i1 @llvm.expect.i1(i1 %not_err27, i1 true) + br i1 %16, label %after_check28, label %after_check28 after_check28: ; preds = %if.exit21, %after_check25, %after_check25 %optval30 = load i64, ptr %b.f, align 8 %not_err31 = icmp eq i64 %optval30, 0 - %20 = call i1 @llvm.expect.i1(i1 %not_err31, i1 true) - br i1 %20, label %after_check32, label %after_check35 + %17 = call i1 @llvm.expect.i1(i1 %not_err31, i1 true) + br i1 %17, label %after_check32, label %after_check35 after_check32: ; preds = %after_check28 - %21 = insertvalue %"any*" undef, ptr %b, 0 - %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %23 = getelementptr inbounds [1 x %"any*"], ptr %varargslots29, i64 0, i64 0 - store %"any*" %22, ptr %23, align 16 - %24 = call i64 @std.io.printfn(ptr %retparam33, ptr @.str.11, i64 9, ptr %varargslots29, i64 1) - %not_err34 = icmp eq i64 %24, 0 - %25 = call i1 @llvm.expect.i1(i1 %not_err34, i1 true) - br i1 %25, label %after_check35, label %after_check35 + %18 = insertvalue %"any*" undef, ptr %b, 0 + %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %19, ptr %varargslots29, align 16 + %20 = call i64 @std.io.printfn(ptr %retparam33, ptr @.str.11, i64 9, ptr %varargslots29, i64 1) + %not_err34 = icmp eq i64 %20, 0 + %21 = call i1 @llvm.expect.i1(i1 %not_err34, i1 true) + br i1 %21, label %after_check35, label %after_check35 after_check35: ; preds = %after_check28, %after_check32, %after_check32 ret void diff --git a/test/test_suite/errors/optional_taddr_and_access.c3t b/test/test_suite/errors/optional_taddr_and_access.c3t index ef8cf320b..5bec60fb4 100644 --- a/test/test_suite/errors/optional_taddr_and_access.c3t +++ b/test/test_suite/errors/optional_taddr_and_access.c3t @@ -34,10 +34,10 @@ fn void main() @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 @.str.1 = private unnamed_addr constant [17 x i8] c"Not visible: %d\0A\00", align 1 - +; Function Attrs: declare i32 @printf(ptr, ...) #0 - +; Function Attrs: define void @test.main() #0 { entry: %z = alloca i32, align 4 @@ -48,21 +48,20 @@ entry: %literal5 = alloca %Foo, align 4 store i32 2, ptr %z, align 4 store i64 0, ptr %z.f, align 8 - %0 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 0 %optval = load i64, ptr %z.f, align 8 %not_err = icmp eq i64 %optval, 0 - %1 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %1, label %after_check, label %assign_optional + %0 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %0, label %after_check, label %assign_optional assign_optional: ; preds = %entry store i64 %optval, ptr %w.f, align 8 br label %after_assign after_check: ; preds = %entry - %2 = load i32, ptr %z, align 4 - store i32 %2, ptr %0, align 4 - %3 = getelementptr inbounds %Foo, ptr %literal, i32 0, i32 1 - store i32 0, ptr %3, align 4 + %1 = load i32, ptr %z, align 4 + store i32 %1, ptr %literal, align 4 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 4 + store i32 0, ptr %ptradd, align 4 store ptr %literal, ptr %w, align 8 store i64 0, ptr %w.f, align 8 br label %after_assign @@ -70,14 +69,13 @@ after_check: ; preds = %entry after_assign: ; preds = %after_check, %assign_optional %optval1 = load i64, ptr %w.f, align 8 %not_err2 = icmp eq i64 %optval1, 0 - %4 = call i1 @llvm.expect.i1(i1 %not_err2, i1 true) - br i1 %4, label %after_check3, label %voiderr + %2 = call i1 @llvm.expect.i1(i1 %not_err2, i1 true) + br i1 %2, label %after_check3, label %voiderr after_check3: ; preds = %after_assign - %5 = load ptr, ptr %w, align 8 - %6 = getelementptr inbounds %Foo, ptr %5, i32 0, i32 0 - %7 = load i32, ptr %6, align 4 - %8 = call i32 (ptr, ...) @printf(ptr @.str, i32 %7) + %3 = load ptr, ptr %w, align 8 + %4 = load i32, ptr %3, align 4 + %5 = call i32 (ptr, ...) @printf(ptr @.str, i32 %4) br label %voiderr voiderr: ; preds = %after_check3, %after_assign @@ -85,38 +83,36 @@ voiderr: ; preds = %after_check3, %afte br label %after_check4 after_check4: ; preds = %voiderr - %9 = getelementptr inbounds %Foo, ptr %literal5, i32 0, i32 0 %optval6 = load i64, ptr %z.f, align 8 %not_err7 = icmp eq i64 %optval6, 0 - %10 = call i1 @llvm.expect.i1(i1 %not_err7, i1 true) - br i1 %10, label %after_check9, label %assign_optional8 + %6 = call i1 @llvm.expect.i1(i1 %not_err7, i1 true) + br i1 %6, label %after_check9, label %assign_optional8 assign_optional8: ; preds = %after_check4 store i64 %optval6, ptr %w.f, align 8 - br label %after_assign10 + br label %after_assign11 after_check9: ; preds = %after_check4 - %11 = load i32, ptr %z, align 4 - store i32 %11, ptr %9, align 4 - %12 = getelementptr inbounds %Foo, ptr %literal5, i32 0, i32 1 - store i32 0, ptr %12, align 4 + %7 = load i32, ptr %z, align 4 + store i32 %7, ptr %literal5, align 4 + %ptradd10 = getelementptr inbounds i8, ptr %literal5, i64 4 + store i32 0, ptr %ptradd10, align 4 store ptr %literal5, ptr %w, align 8 store i64 0, ptr %w.f, align 8 - br label %after_assign10 - -after_assign10: ; preds = %after_check9, %assign_optional8 - %optval11 = load i64, ptr %w.f, align 8 - %not_err12 = icmp eq i64 %optval11, 0 - %13 = call i1 @llvm.expect.i1(i1 %not_err12, i1 true) - br i1 %13, label %after_check13, label %voiderr14 - -after_check13: ; preds = %after_assign10 - %14 = load ptr, ptr %w, align 8 - %15 = getelementptr inbounds %Foo, ptr %14, i32 0, i32 0 - %16 = load i32, ptr %15, align 4 - %17 = call i32 (ptr, ...) @printf(ptr @.str.1, i32 %16) - br label %voiderr14 - -voiderr14: ; preds = %after_check13, %after_assign10 + br label %after_assign11 + +after_assign11: ; preds = %after_check9, %assign_optional8 + %optval12 = load i64, ptr %w.f, align 8 + %not_err13 = icmp eq i64 %optval12, 0 + %8 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) + br i1 %8, label %after_check14, label %voiderr15 + +after_check14: ; preds = %after_assign11 + %9 = load ptr, ptr %w, align 8 + %10 = load i32, ptr %9, align 4 + %11 = call i32 (ptr, ...) @printf(ptr @.str.1, i32 %10) + br label %voiderr15 + +voiderr15: ; preds = %after_check14, %after_assign11 ret void } \ No newline at end of file diff --git a/test/test_suite/errors/optional_with_optional.c3t b/test/test_suite/errors/optional_with_optional.c3t index 28354638b..6b116876a 100644 --- a/test/test_suite/errors/optional_with_optional.c3t +++ b/test/test_suite/errors/optional_with_optional.c3t @@ -100,77 +100,74 @@ phi_block5: ; preds = %phi_block, %after_c store i32 %val6, ptr %taddr, align 4 %6 = insertvalue %"any*" undef, ptr %taddr, 0 %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %8 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %7, ptr %8, align 16 - %9 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str, i64 4, ptr %varargslots, i64 1) - %10 = call i64 @test.get_a(ptr %retparam11, i32 2) - %not_err12 = icmp eq i64 %10, 0 - %11 = call i1 @llvm.expect.i1(i1 %not_err12, i1 true) - br i1 %11, label %after_check13, label %else_block14 + store %"any*" %7, ptr %varargslots, align 16 + %8 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str, i64 4, ptr %varargslots, i64 1) + %9 = call i64 @test.get_a(ptr %retparam11, i32 2) + %not_err12 = icmp eq i64 %9, 0 + %10 = call i1 @llvm.expect.i1(i1 %not_err12, i1 true) + br i1 %10, label %after_check13, label %else_block14 after_check13: ; preds = %phi_block5 - %12 = load i32, ptr %retparam11, align 4 + %11 = load i32, ptr %retparam11, align 4 br label %phi_block21 else_block14: ; preds = %phi_block5 - %13 = call i64 @test.get_b(ptr %retparam15, i32 4) - %not_err16 = icmp eq i64 %13, 0 - %14 = call i1 @llvm.expect.i1(i1 %not_err16, i1 true) - br i1 %14, label %after_check17, label %else_block18 + %12 = call i64 @test.get_b(ptr %retparam15, i32 4) + %not_err16 = icmp eq i64 %12, 0 + %13 = call i1 @llvm.expect.i1(i1 %not_err16, i1 true) + br i1 %13, label %after_check17, label %else_block18 after_check17: ; preds = %else_block14 - %15 = load i32, ptr %retparam15, align 4 + %14 = load i32, ptr %retparam15, align 4 br label %phi_block19 else_block18: ; preds = %else_block14 br label %phi_block19 phi_block19: ; preds = %else_block18, %after_check17 - %val20 = phi i32 [ %15, %after_check17 ], [ -1, %else_block18 ] + %val20 = phi i32 [ %14, %after_check17 ], [ -1, %else_block18 ] br label %phi_block21 phi_block21: ; preds = %phi_block19, %after_check13 - %val22 = phi i32 [ %12, %after_check13 ], [ %val20, %phi_block19 ] + %val22 = phi i32 [ %11, %after_check13 ], [ %val20, %phi_block19 ] store i32 %val22, ptr %taddr23, align 4 - %16 = insertvalue %"any*" undef, ptr %taddr23, 0 - %17 = insertvalue %"any*" %16, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %18 = getelementptr inbounds [1 x %"any*"], ptr %varargslots10, i64 0, i64 0 - store %"any*" %17, ptr %18, align 16 - %19 = call i64 @std.io.printfn(ptr %retparam24, ptr @.str.2, i64 4, ptr %varargslots10, i64 1) - %20 = call i64 @test.get_a(ptr %retparam28, i32 1) - %not_err29 = icmp eq i64 %20, 0 - %21 = call i1 @llvm.expect.i1(i1 %not_err29, i1 true) - br i1 %21, label %after_check30, label %else_block31 + %15 = insertvalue %"any*" undef, ptr %taddr23, 0 + %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %16, ptr %varargslots10, align 16 + %17 = call i64 @std.io.printfn(ptr %retparam24, ptr @.str.2, i64 4, ptr %varargslots10, i64 1) + %18 = call i64 @test.get_a(ptr %retparam28, i32 1) + %not_err29 = icmp eq i64 %18, 0 + %19 = call i1 @llvm.expect.i1(i1 %not_err29, i1 true) + br i1 %19, label %after_check30, label %else_block31 after_check30: ; preds = %phi_block21 - %22 = load i32, ptr %retparam28, align 4 + %20 = load i32, ptr %retparam28, align 4 br label %phi_block38 else_block31: ; preds = %phi_block21 - %23 = call i64 @test.get_b(ptr %retparam32, i32 5) - %not_err33 = icmp eq i64 %23, 0 - %24 = call i1 @llvm.expect.i1(i1 %not_err33, i1 true) - br i1 %24, label %after_check34, label %else_block35 + %21 = call i64 @test.get_b(ptr %retparam32, i32 5) + %not_err33 = icmp eq i64 %21, 0 + %22 = call i1 @llvm.expect.i1(i1 %not_err33, i1 true) + br i1 %22, label %after_check34, label %else_block35 after_check34: ; preds = %else_block31 - %25 = load i32, ptr %retparam32, align 4 + %23 = load i32, ptr %retparam32, align 4 br label %phi_block36 else_block35: ; preds = %else_block31 br label %phi_block36 phi_block36: ; preds = %else_block35, %after_check34 - %val37 = phi i32 [ %25, %after_check34 ], [ -1, %else_block35 ] + %val37 = phi i32 [ %23, %after_check34 ], [ -1, %else_block35 ] br label %phi_block38 phi_block38: ; preds = %phi_block36, %after_check30 - %val39 = phi i32 [ %22, %after_check30 ], [ %val37, %phi_block36 ] + %val39 = phi i32 [ %20, %after_check30 ], [ %val37, %phi_block36 ] store i32 %val39, ptr %taddr40, align 4 - %26 = insertvalue %"any*" undef, ptr %taddr40, 0 - %27 = insertvalue %"any*" %26, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %28 = getelementptr inbounds [1 x %"any*"], ptr %varargslots27, i64 0, i64 0 - store %"any*" %27, ptr %28, align 16 - %29 = call i64 @std.io.printfn(ptr %retparam41, ptr @.str.3, i64 4, ptr %varargslots27, i64 1) + %24 = insertvalue %"any*" undef, ptr %taddr40, 0 + %25 = insertvalue %"any*" %24, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %25, ptr %varargslots27, align 16 + %26 = call i64 @std.io.printfn(ptr %retparam41, ptr @.str.3, i64 4, ptr %varargslots27, i64 1) br label %testblock testblock: ; preds = %phi_block38 @@ -178,13 +175,13 @@ testblock: ; preds = %phi_block38 br label %end_block end_block: ; preds = %testblock - %30 = load i64, ptr %f, align 8 - %neq = icmp ne i64 %30, 0 + %27 = load i64, ptr %f, align 8 + %neq = icmp ne i64 %27, 0 br i1 %neq, label %if.then, label %if.exit if.then: ; preds = %end_block - %31 = load i64, ptr %f, align 8 - store i64 %31, ptr %blockret, align 8 + %28 = load i64, ptr %f, align 8 + store i64 %28, ptr %blockret, align 8 br label %expr_block.exit if.exit: ; preds = %end_block @@ -192,17 +189,15 @@ if.exit: ; preds = %end_block br label %expr_block.exit expr_block.exit: ; preds = %if.exit, %if.then - %32 = insertvalue %"any*" undef, ptr %blockret, 0 - %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %34 = getelementptr inbounds [1 x %"any*"], ptr %varargslots44, i64 0, i64 0 - store %"any*" %33, ptr %34, align 16 - %35 = call i64 @std.io.printfn(ptr %retparam45, ptr @.str.4, i64 4, ptr %varargslots44, i64 1) + %29 = insertvalue %"any*" undef, ptr %blockret, 0 + %30 = insertvalue %"any*" %29, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %30, ptr %varargslots44, align 16 + %31 = call i64 @std.io.printfn(ptr %retparam45, ptr @.str.4, i64 4, ptr %varargslots44, i64 1) store i32 3, ptr %taddr49, align 4 - %36 = insertvalue %"any*" undef, ptr %taddr49, 0 - %37 = insertvalue %"any*" %36, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %38 = getelementptr inbounds [1 x %"any*"], ptr %varargslots48, i64 0, i64 0 - store %"any*" %37, ptr %38, align 16 - %39 = call i64 @std.io.printfn(ptr %retparam50, ptr @.str.5, i64 4, ptr %varargslots48, i64 1) + %32 = insertvalue %"any*" undef, ptr %taddr49, 0 + %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %33, ptr %varargslots48, align 16 + %34 = call i64 @std.io.printfn(ptr %retparam50, ptr @.str.5, i64 4, ptr %varargslots48, i64 1) br label %testblock56 testblock56: ; preds = %expr_block.exit @@ -210,13 +205,13 @@ testblock56: ; preds = %expr_block.exit br label %end_block57 end_block57: ; preds = %testblock56 - %40 = load i64, ptr %f55, align 8 - %neq58 = icmp ne i64 %40, 0 + %35 = load i64, ptr %f55, align 8 + %neq58 = icmp ne i64 %35, 0 br i1 %neq58, label %if.then59, label %if.exit60 if.then59: ; preds = %end_block57 - %41 = load i64, ptr %f55, align 8 - store i64 %41, ptr %blockret54, align 8 + %36 = load i64, ptr %f55, align 8 + store i64 %36, ptr %blockret54, align 8 br label %expr_block.exit61 if.exit60: ; preds = %end_block57 @@ -224,11 +219,10 @@ if.exit60: ; preds = %end_block57 br label %expr_block.exit61 expr_block.exit61: ; preds = %if.exit60, %if.then59 - %42 = insertvalue %"any*" undef, ptr %blockret54, 0 - %43 = insertvalue %"any*" %42, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %44 = getelementptr inbounds [1 x %"any*"], ptr %varargslots53, i64 0, i64 0 - store %"any*" %43, ptr %44, align 16 - %45 = call i64 @std.io.printfn(ptr %retparam62, ptr @.str.6, i64 4, ptr %varargslots53, i64 1) + %37 = insertvalue %"any*" undef, ptr %blockret54, 0 + %38 = insertvalue %"any*" %37, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %38, ptr %varargslots53, align 16 + %39 = call i64 @std.io.printfn(ptr %retparam62, ptr @.str.6, i64 4, ptr %varargslots53, i64 1) br label %testblock68 testblock68: ; preds = %expr_block.exit61 @@ -239,13 +233,13 @@ phi_block70: ; preds = %testblock68 br label %end_block71 end_block71: ; preds = %phi_block70 - %46 = load i64, ptr %f67, align 8 - %neq72 = icmp ne i64 %46, 0 + %40 = load i64, ptr %f67, align 8 + %neq72 = icmp ne i64 %40, 0 br i1 %neq72, label %if.then73, label %if.exit74 if.then73: ; preds = %end_block71 - %47 = load i64, ptr %f67, align 8 - store i64 %47, ptr %blockret66, align 8 + %41 = load i64, ptr %f67, align 8 + store i64 %41, ptr %blockret66, align 8 br label %expr_block.exit75 if.exit74: ; preds = %end_block71 @@ -253,22 +247,20 @@ if.exit74: ; preds = %end_block71 br label %expr_block.exit75 expr_block.exit75: ; preds = %if.exit74, %if.then73 - %48 = insertvalue %"any*" undef, ptr %blockret66, 0 - %49 = insertvalue %"any*" %48, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %50 = getelementptr inbounds [1 x %"any*"], ptr %varargslots65, i64 0, i64 0 - store %"any*" %49, ptr %50, align 16 - %51 = call i64 @std.io.printfn(ptr %retparam76, ptr @.str.7, i64 4, ptr %varargslots65, i64 1) + %42 = insertvalue %"any*" undef, ptr %blockret66, 0 + %43 = insertvalue %"any*" %42, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %43, ptr %varargslots65, align 16 + %44 = call i64 @std.io.printfn(ptr %retparam76, ptr @.str.7, i64 4, ptr %varargslots65, i64 1) store i64 3, ptr %x, align 8 - %52 = insertvalue %"any*" undef, ptr %x, 0 - %53 = insertvalue %"any*" %52, i64 ptrtoint (ptr @"$ct.long" to i64), 1 - %54 = getelementptr inbounds [1 x %"any*"], ptr %varargslots79, i64 0, i64 0 - store %"any*" %53, ptr %54, align 16 - %55 = call i64 @std.io.printfn(ptr %retparam80, ptr @.str.8, i64 4, ptr %varargslots79, i64 1) + %45 = insertvalue %"any*" undef, ptr %x, 0 + %46 = insertvalue %"any*" %45, i64 ptrtoint (ptr @"$ct.long" to i64), 1 + store %"any*" %46, ptr %varargslots79, align 16 + %47 = call i64 @std.io.printfn(ptr %retparam80, ptr @.str.8, i64 4, ptr %varargslots79, i64 1) store i64 ptrtoint (ptr @"test.Foo$DEF" to i64), ptr %xy.f, align 8 ret void } - +; Function Attrs: define i64 @test.get_a(ptr %0, i32 %1) #0 { entry: %reterr = alloca i64, align 8 @@ -285,7 +277,7 @@ if.exit: ; preds = %entry ret i64 0 } - +; Function Attrs: define i64 @test.get_b(ptr %0, i32 %1) #0 { entry: %reterr = alloca i64, align 8 diff --git a/test/test_suite/errors/or_and_rethrow.c3t b/test/test_suite/errors/or_and_rethrow.c3t index 04c977a58..23312659b 100644 --- a/test/test_suite/errors/or_and_rethrow.c3t +++ b/test/test_suite/errors/or_and_rethrow.c3t @@ -71,9 +71,8 @@ entry: store i32 %0, ptr %taddr, align 4 %1 = insertvalue %"any*" undef, ptr %taddr, 0 %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %3 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %2, ptr %3, align 16 - %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.1, i64 8, ptr %varargslots, i64 1) + store %"any*" %2, ptr %varargslots, align 16 + %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.1, i64 8, ptr %varargslots, i64 1) %intbool = icmp ne i32 %0, 0 br i1 %intbool, label %or.phi, label %or.rhs @@ -86,21 +85,21 @@ opt_block_cleanup: ; preds = %or.rhs br label %guard_block guard_block: ; preds = %opt_block_cleanup - %5 = load i64, ptr %error_var, align 8 - ret i64 %5 + %4 = load i64, ptr %error_var, align 8 + ret i64 %4 or.phi: ; preds = %entry br label %if.then if.then: ; preds = %or.phi - %6 = call ptr @std.io.stdout() - %7 = call i64 @std.io.File.write(ptr %retparam4, ptr %6, ptr @.str.2, i64 3) - %not_err = icmp eq i64 %7, 0 - %8 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %8, label %after_check, label %assign_optional + %5 = call ptr @std.io.stdout() + %6 = call i64 @std.io.File.write(ptr %retparam4, ptr %5, ptr @.str.2, i64 3) + %not_err = icmp eq i64 %6, 0 + %7 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %7, label %after_check, label %assign_optional assign_optional: ; preds = %if.then - store i64 %7, ptr %error_var2, align 8 + store i64 %6, ptr %error_var2, align 8 br label %guard_block5 after_check: ; preds = %if.then @@ -110,15 +109,15 @@ guard_block5: ; preds = %assign_optional br label %voiderr noerr_block: ; preds = %after_check - %9 = load i64, ptr %retparam4, align 8 - store i64 %9, ptr %len, align 8 - %10 = call i64 @std.io.File.write_byte(ptr %6, i8 zeroext 10) - %not_err7 = icmp eq i64 %10, 0 - %11 = call i1 @llvm.expect.i1(i1 %not_err7, i1 true) - br i1 %11, label %after_check9, label %assign_optional8 + %8 = load i64, ptr %retparam4, align 8 + store i64 %8, ptr %len, align 8 + %9 = call i64 @std.io.File.write_byte(ptr %5, i8 zeroext 10) + %not_err7 = icmp eq i64 %9, 0 + %10 = call i1 @llvm.expect.i1(i1 %not_err7, i1 true) + br i1 %10, label %after_check9, label %assign_optional8 assign_optional8: ; preds = %noerr_block - store i64 %10, ptr %error_var6, align 8 + store i64 %9, ptr %error_var6, align 8 br label %guard_block10 after_check9: ; preds = %noerr_block @@ -128,13 +127,13 @@ guard_block10: ; preds = %assign_optional8 br label %voiderr noerr_block11: ; preds = %after_check9 - %12 = call i64 @std.io.File.flush(ptr %6) - %not_err13 = icmp eq i64 %12, 0 - %13 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) - br i1 %13, label %after_check15, label %assign_optional14 + %11 = call i64 @std.io.File.flush(ptr %5) + %not_err13 = icmp eq i64 %11, 0 + %12 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) + br i1 %12, label %after_check15, label %assign_optional14 assign_optional14: ; preds = %noerr_block11 - store i64 %12, ptr %error_var12, align 8 + store i64 %11, ptr %error_var12, align 8 br label %guard_block16 after_check15: ; preds = %noerr_block11 @@ -144,22 +143,22 @@ guard_block16: ; preds = %assign_optional14 br label %voiderr noerr_block17: ; preds = %after_check15 - %14 = load i64, ptr %len, align 8 - %add = add i64 %14, 1 + %13 = load i64, ptr %len, align 8 + %add = add i64 %13, 1 br label %voiderr voiderr: ; preds = %noerr_block17, %guard_block16, %guard_block10, %guard_block5 br label %if.exit if.exit: ; preds = %voiderr - %15 = call ptr @std.io.stdout() - %16 = call i64 @std.io.File.write(ptr %retparam22, ptr %15, ptr @.str.3, i64 9) - %not_err23 = icmp eq i64 %16, 0 - %17 = call i1 @llvm.expect.i1(i1 %not_err23, i1 true) - br i1 %17, label %after_check25, label %assign_optional24 + %14 = call ptr @std.io.stdout() + %15 = call i64 @std.io.File.write(ptr %retparam22, ptr %14, ptr @.str.3, i64 9) + %not_err23 = icmp eq i64 %15, 0 + %16 = call i1 @llvm.expect.i1(i1 %not_err23, i1 true) + br i1 %16, label %after_check25, label %assign_optional24 assign_optional24: ; preds = %if.exit - store i64 %16, ptr %error_var20, align 8 + store i64 %15, ptr %error_var20, align 8 br label %guard_block26 after_check25: ; preds = %if.exit @@ -169,15 +168,15 @@ guard_block26: ; preds = %assign_optional24 br label %voiderr41 noerr_block27: ; preds = %after_check25 - %18 = load i64, ptr %retparam22, align 8 - store i64 %18, ptr %len19, align 8 - %19 = call i64 @std.io.File.write_byte(ptr %15, i8 zeroext 10) - %not_err29 = icmp eq i64 %19, 0 - %20 = call i1 @llvm.expect.i1(i1 %not_err29, i1 true) - br i1 %20, label %after_check31, label %assign_optional30 + %17 = load i64, ptr %retparam22, align 8 + store i64 %17, ptr %len19, align 8 + %18 = call i64 @std.io.File.write_byte(ptr %14, i8 zeroext 10) + %not_err29 = icmp eq i64 %18, 0 + %19 = call i1 @llvm.expect.i1(i1 %not_err29, i1 true) + br i1 %19, label %after_check31, label %assign_optional30 assign_optional30: ; preds = %noerr_block27 - store i64 %19, ptr %error_var28, align 8 + store i64 %18, ptr %error_var28, align 8 br label %guard_block32 after_check31: ; preds = %noerr_block27 @@ -187,13 +186,13 @@ guard_block32: ; preds = %assign_optional30 br label %voiderr41 noerr_block33: ; preds = %after_check31 - %21 = call i64 @std.io.File.flush(ptr %15) - %not_err35 = icmp eq i64 %21, 0 - %22 = call i1 @llvm.expect.i1(i1 %not_err35, i1 true) - br i1 %22, label %after_check37, label %assign_optional36 + %20 = call i64 @std.io.File.flush(ptr %14) + %not_err35 = icmp eq i64 %20, 0 + %21 = call i1 @llvm.expect.i1(i1 %not_err35, i1 true) + br i1 %21, label %after_check37, label %assign_optional36 assign_optional36: ; preds = %noerr_block33 - store i64 %21, ptr %error_var34, align 8 + store i64 %20, ptr %error_var34, align 8 br label %guard_block38 after_check37: ; preds = %noerr_block33 @@ -203,8 +202,8 @@ guard_block38: ; preds = %assign_optional36 br label %voiderr41 noerr_block39: ; preds = %after_check37 - %23 = load i64, ptr %len19, align 8 - %add40 = add i64 %23, 1 + %22 = load i64, ptr %len19, align 8 + %add40 = add i64 %22, 1 br label %voiderr41 voiderr41: ; preds = %noerr_block39, %guard_block38, %guard_block32, %guard_block26 @@ -216,18 +215,18 @@ opt_block_cleanup44: ; preds = %voiderr41 br label %guard_block45 guard_block45: ; preds = %opt_block_cleanup44 - %24 = load i64, ptr %error_var42, align 8 - ret i64 %24 + %23 = load i64, ptr %error_var42, align 8 + ret i64 %23 if.then47: ; No predecessors! - %25 = call ptr @std.io.stdout() - %26 = call i64 @std.io.File.write(ptr %retparam52, ptr %25, ptr @.str.4, i64 3) - %not_err53 = icmp eq i64 %26, 0 - %27 = call i1 @llvm.expect.i1(i1 %not_err53, i1 true) - br i1 %27, label %after_check55, label %assign_optional54 + %24 = call ptr @std.io.stdout() + %25 = call i64 @std.io.File.write(ptr %retparam52, ptr %24, ptr @.str.4, i64 3) + %not_err53 = icmp eq i64 %25, 0 + %26 = call i1 @llvm.expect.i1(i1 %not_err53, i1 true) + br i1 %26, label %after_check55, label %assign_optional54 assign_optional54: ; preds = %if.then47 - store i64 %26, ptr %error_var50, align 8 + store i64 %25, ptr %error_var50, align 8 br label %guard_block56 after_check55: ; preds = %if.then47 @@ -237,15 +236,15 @@ guard_block56: ; preds = %assign_optional54 br label %voiderr71 noerr_block57: ; preds = %after_check55 - %28 = load i64, ptr %retparam52, align 8 - store i64 %28, ptr %len49, align 8 - %29 = call i64 @std.io.File.write_byte(ptr %25, i8 zeroext 10) - %not_err59 = icmp eq i64 %29, 0 - %30 = call i1 @llvm.expect.i1(i1 %not_err59, i1 true) - br i1 %30, label %after_check61, label %assign_optional60 + %27 = load i64, ptr %retparam52, align 8 + store i64 %27, ptr %len49, align 8 + %28 = call i64 @std.io.File.write_byte(ptr %24, i8 zeroext 10) + %not_err59 = icmp eq i64 %28, 0 + %29 = call i1 @llvm.expect.i1(i1 %not_err59, i1 true) + br i1 %29, label %after_check61, label %assign_optional60 assign_optional60: ; preds = %noerr_block57 - store i64 %29, ptr %error_var58, align 8 + store i64 %28, ptr %error_var58, align 8 br label %guard_block62 after_check61: ; preds = %noerr_block57 @@ -255,13 +254,13 @@ guard_block62: ; preds = %assign_optional60 br label %voiderr71 noerr_block63: ; preds = %after_check61 - %31 = call i64 @std.io.File.flush(ptr %25) - %not_err65 = icmp eq i64 %31, 0 - %32 = call i1 @llvm.expect.i1(i1 %not_err65, i1 true) - br i1 %32, label %after_check67, label %assign_optional66 + %30 = call i64 @std.io.File.flush(ptr %24) + %not_err65 = icmp eq i64 %30, 0 + %31 = call i1 @llvm.expect.i1(i1 %not_err65, i1 true) + br i1 %31, label %after_check67, label %assign_optional66 assign_optional66: ; preds = %noerr_block63 - store i64 %31, ptr %error_var64, align 8 + store i64 %30, ptr %error_var64, align 8 br label %guard_block68 after_check67: ; preds = %noerr_block63 @@ -271,22 +270,22 @@ guard_block68: ; preds = %assign_optional66 br label %voiderr71 noerr_block69: ; preds = %after_check67 - %33 = load i64, ptr %len49, align 8 - %add70 = add i64 %33, 1 + %32 = load i64, ptr %len49, align 8 + %add70 = add i64 %32, 1 br label %voiderr71 voiderr71: ; preds = %noerr_block69, %guard_block68, %guard_block62, %guard_block56 br label %if.exit72 if.exit72: ; preds = %voiderr71 - %34 = call ptr @std.io.stdout() - %35 = call i64 @std.io.File.write(ptr %retparam77, ptr %34, ptr @.str.5, i64 7) - %not_err78 = icmp eq i64 %35, 0 - %36 = call i1 @llvm.expect.i1(i1 %not_err78, i1 true) - br i1 %36, label %after_check80, label %assign_optional79 + %33 = call ptr @std.io.stdout() + %34 = call i64 @std.io.File.write(ptr %retparam77, ptr %33, ptr @.str.5, i64 7) + %not_err78 = icmp eq i64 %34, 0 + %35 = call i1 @llvm.expect.i1(i1 %not_err78, i1 true) + br i1 %35, label %after_check80, label %assign_optional79 assign_optional79: ; preds = %if.exit72 - store i64 %35, ptr %error_var75, align 8 + store i64 %34, ptr %error_var75, align 8 br label %guard_block81 after_check80: ; preds = %if.exit72 @@ -296,15 +295,15 @@ guard_block81: ; preds = %assign_optional79 br label %voiderr96 noerr_block82: ; preds = %after_check80 - %37 = load i64, ptr %retparam77, align 8 - store i64 %37, ptr %len74, align 8 - %38 = call i64 @std.io.File.write_byte(ptr %34, i8 zeroext 10) - %not_err84 = icmp eq i64 %38, 0 - %39 = call i1 @llvm.expect.i1(i1 %not_err84, i1 true) - br i1 %39, label %after_check86, label %assign_optional85 + %36 = load i64, ptr %retparam77, align 8 + store i64 %36, ptr %len74, align 8 + %37 = call i64 @std.io.File.write_byte(ptr %33, i8 zeroext 10) + %not_err84 = icmp eq i64 %37, 0 + %38 = call i1 @llvm.expect.i1(i1 %not_err84, i1 true) + br i1 %38, label %after_check86, label %assign_optional85 assign_optional85: ; preds = %noerr_block82 - store i64 %38, ptr %error_var83, align 8 + store i64 %37, ptr %error_var83, align 8 br label %guard_block87 after_check86: ; preds = %noerr_block82 @@ -314,13 +313,13 @@ guard_block87: ; preds = %assign_optional85 br label %voiderr96 noerr_block88: ; preds = %after_check86 - %40 = call i64 @std.io.File.flush(ptr %34) - %not_err90 = icmp eq i64 %40, 0 - %41 = call i1 @llvm.expect.i1(i1 %not_err90, i1 true) - br i1 %41, label %after_check92, label %assign_optional91 + %39 = call i64 @std.io.File.flush(ptr %33) + %not_err90 = icmp eq i64 %39, 0 + %40 = call i1 @llvm.expect.i1(i1 %not_err90, i1 true) + br i1 %40, label %after_check92, label %assign_optional91 assign_optional91: ; preds = %noerr_block88 - store i64 %40, ptr %error_var89, align 8 + store i64 %39, ptr %error_var89, align 8 br label %guard_block93 after_check92: ; preds = %noerr_block88 @@ -330,15 +329,15 @@ guard_block93: ; preds = %assign_optional91 br label %voiderr96 noerr_block94: ; preds = %after_check92 - %42 = load i64, ptr %len74, align 8 - %add95 = add i64 %42, 1 + %41 = load i64, ptr %len74, align 8 + %add95 = add i64 %41, 1 br label %voiderr96 voiderr96: ; preds = %noerr_block94, %guard_block93, %guard_block87, %guard_block81 ret i64 0 } - +; Function Attrs: define i64 @foo.test2(i32 %0) #0 { entry: %varargslots = alloca [1 x %"any*"], align 16 @@ -361,9 +360,8 @@ entry: store i32 %0, ptr %taddr, align 4 %1 = insertvalue %"any*" undef, ptr %taddr, 0 %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %3 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %2, ptr %3, align 16 - %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.6, i64 9, ptr %varargslots, i64 1) + store %"any*" %2, ptr %varargslots, align 16 + %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.6, i64 9, ptr %varargslots, i64 1) %intbool = icmp ne i32 %0, 0 br i1 %intbool, label %and.rhs, label %and.phi @@ -376,21 +374,21 @@ opt_block_cleanup: ; preds = %and.rhs br label %guard_block guard_block: ; preds = %opt_block_cleanup - %5 = load i64, ptr %error_var, align 8 - ret i64 %5 + %4 = load i64, ptr %error_var, align 8 + ret i64 %4 and.phi: ; preds = %entry br label %if.exit if.exit: ; preds = %and.phi - %6 = call ptr @std.io.stdout() - %7 = call i64 @std.io.File.write(ptr %retparam4, ptr %6, ptr @.str.7, i64 9) - %not_err = icmp eq i64 %7, 0 - %8 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %8, label %after_check, label %assign_optional + %5 = call ptr @std.io.stdout() + %6 = call i64 @std.io.File.write(ptr %retparam4, ptr %5, ptr @.str.7, i64 9) + %not_err = icmp eq i64 %6, 0 + %7 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %7, label %after_check, label %assign_optional assign_optional: ; preds = %if.exit - store i64 %7, ptr %error_var2, align 8 + store i64 %6, ptr %error_var2, align 8 br label %guard_block5 after_check: ; preds = %if.exit @@ -400,15 +398,15 @@ guard_block5: ; preds = %assign_optional br label %voiderr noerr_block: ; preds = %after_check - %9 = load i64, ptr %retparam4, align 8 - store i64 %9, ptr %len, align 8 - %10 = call i64 @std.io.File.write_byte(ptr %6, i8 zeroext 10) - %not_err7 = icmp eq i64 %10, 0 - %11 = call i1 @llvm.expect.i1(i1 %not_err7, i1 true) - br i1 %11, label %after_check9, label %assign_optional8 + %8 = load i64, ptr %retparam4, align 8 + store i64 %8, ptr %len, align 8 + %9 = call i64 @std.io.File.write_byte(ptr %5, i8 zeroext 10) + %not_err7 = icmp eq i64 %9, 0 + %10 = call i1 @llvm.expect.i1(i1 %not_err7, i1 true) + br i1 %10, label %after_check9, label %assign_optional8 assign_optional8: ; preds = %noerr_block - store i64 %10, ptr %error_var6, align 8 + store i64 %9, ptr %error_var6, align 8 br label %guard_block10 after_check9: ; preds = %noerr_block @@ -418,13 +416,13 @@ guard_block10: ; preds = %assign_optional8 br label %voiderr noerr_block11: ; preds = %after_check9 - %12 = call i64 @std.io.File.flush(ptr %6) - %not_err13 = icmp eq i64 %12, 0 - %13 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) - br i1 %13, label %after_check15, label %assign_optional14 + %11 = call i64 @std.io.File.flush(ptr %5) + %not_err13 = icmp eq i64 %11, 0 + %12 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) + br i1 %12, label %after_check15, label %assign_optional14 assign_optional14: ; preds = %noerr_block11 - store i64 %12, ptr %error_var12, align 8 + store i64 %11, ptr %error_var12, align 8 br label %guard_block16 after_check15: ; preds = %noerr_block11 @@ -434,8 +432,8 @@ guard_block16: ; preds = %assign_optional14 br label %voiderr noerr_block17: ; preds = %after_check15 - %14 = load i64, ptr %len, align 8 - %add = add i64 %14, 1 + %13 = load i64, ptr %len, align 8 + %add = add i64 %13, 1 br label %voiderr voiderr: ; preds = %noerr_block17, %guard_block16, %guard_block10, %guard_block5 @@ -447,18 +445,18 @@ opt_block_cleanup20: ; preds = %voiderr br label %guard_block21 guard_block21: ; preds = %opt_block_cleanup20 - %15 = load i64, ptr %error_var18, align 8 - ret i64 %15 + %14 = load i64, ptr %error_var18, align 8 + ret i64 %14 if.exit23: ; No predecessors! - %16 = call ptr @std.io.stdout() - %17 = call i64 @std.io.File.write(ptr %retparam28, ptr %16, ptr @.str.8, i64 7) - %not_err29 = icmp eq i64 %17, 0 - %18 = call i1 @llvm.expect.i1(i1 %not_err29, i1 true) - br i1 %18, label %after_check31, label %assign_optional30 + %15 = call ptr @std.io.stdout() + %16 = call i64 @std.io.File.write(ptr %retparam28, ptr %15, ptr @.str.8, i64 7) + %not_err29 = icmp eq i64 %16, 0 + %17 = call i1 @llvm.expect.i1(i1 %not_err29, i1 true) + br i1 %17, label %after_check31, label %assign_optional30 assign_optional30: ; preds = %if.exit23 - store i64 %17, ptr %error_var26, align 8 + store i64 %16, ptr %error_var26, align 8 br label %guard_block32 after_check31: ; preds = %if.exit23 @@ -468,15 +466,15 @@ guard_block32: ; preds = %assign_optional30 br label %voiderr47 noerr_block33: ; preds = %after_check31 - %19 = load i64, ptr %retparam28, align 8 - store i64 %19, ptr %len25, align 8 - %20 = call i64 @std.io.File.write_byte(ptr %16, i8 zeroext 10) - %not_err35 = icmp eq i64 %20, 0 - %21 = call i1 @llvm.expect.i1(i1 %not_err35, i1 true) - br i1 %21, label %after_check37, label %assign_optional36 + %18 = load i64, ptr %retparam28, align 8 + store i64 %18, ptr %len25, align 8 + %19 = call i64 @std.io.File.write_byte(ptr %15, i8 zeroext 10) + %not_err35 = icmp eq i64 %19, 0 + %20 = call i1 @llvm.expect.i1(i1 %not_err35, i1 true) + br i1 %20, label %after_check37, label %assign_optional36 assign_optional36: ; preds = %noerr_block33 - store i64 %20, ptr %error_var34, align 8 + store i64 %19, ptr %error_var34, align 8 br label %guard_block38 after_check37: ; preds = %noerr_block33 @@ -486,13 +484,13 @@ guard_block38: ; preds = %assign_optional36 br label %voiderr47 noerr_block39: ; preds = %after_check37 - %22 = call i64 @std.io.File.flush(ptr %16) - %not_err41 = icmp eq i64 %22, 0 - %23 = call i1 @llvm.expect.i1(i1 %not_err41, i1 true) - br i1 %23, label %after_check43, label %assign_optional42 + %21 = call i64 @std.io.File.flush(ptr %15) + %not_err41 = icmp eq i64 %21, 0 + %22 = call i1 @llvm.expect.i1(i1 %not_err41, i1 true) + br i1 %22, label %after_check43, label %assign_optional42 assign_optional42: ; preds = %noerr_block39 - store i64 %22, ptr %error_var40, align 8 + store i64 %21, ptr %error_var40, align 8 br label %guard_block44 after_check43: ; preds = %noerr_block39 @@ -502,15 +500,15 @@ guard_block44: ; preds = %assign_optional42 br label %voiderr47 noerr_block45: ; preds = %after_check43 - %24 = load i64, ptr %len25, align 8 - %add46 = add i64 %24, 1 + %23 = load i64, ptr %len25, align 8 + %add46 = add i64 %23, 1 br label %voiderr47 voiderr47: ; preds = %noerr_block45, %guard_block44, %guard_block38, %guard_block32 ret i64 0 } - +; Function Attrs: define void @foo.main() #0 { entry: %a = alloca i64, align 8 @@ -660,7 +658,7 @@ expr_block.exit33: ; preds = %if.exit32, %if.then ret void } - +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 { entry: call void @foo.main() diff --git a/test/test_suite/errors/printing_errors.c3t b/test/test_suite/errors/printing_errors.c3t index 64800697a..251e06da1 100644 --- a/test/test_suite/errors/printing_errors.c3t +++ b/test/test_suite/errors/printing_errors.c3t @@ -15,46 +15,45 @@ fn void main() /* #expect: test.ll - define void @test.main() #0 { - entry: - %x = alloca i64, align 8 - %varargslots = alloca [2 x %"any*"], align 16 - %taddr = alloca %"char[]", align 8 - %faultname_zero = alloca %"char[]", align 8 - %retparam = alloca i64, align 8 - store i64 ptrtoint (ptr @"test.Cde$WORLD" to i64), ptr %x, align 8 - store %"char[]" { ptr @.str.2, i64 5 }, ptr %taddr, align 8 - %0 = insertvalue %"any*" undef, ptr %taddr, 0 - %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %2 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %1, ptr %2, align 16 - %3 = load i64, ptr %x, align 8 - %eq = icmp eq i64 %3, 0 - br i1 %eq, label %faultname_no, label %faultname_ok - - faultname_no: ; preds = %entry - call void @llvm.memset.p0.i64(ptr align 8 %faultname_zero, i8 0, i64 16, i1 false) - br label %faultname_exit - - faultname_ok: ; preds = %entry - %4 = inttoptr i64 %3 to ptr - %5 = getelementptr inbounds %.fault, ptr %4, i32 0, i32 1 - br label %faultname_exit - - faultname_exit: ; preds = %faultname_ok, %faultname_no - %faultname = phi ptr [ %faultname_zero, %faultname_no ], [ %5, %faultname_ok ] - %6 = insertvalue %"any*" undef, ptr %faultname, 0 - %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %8 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %7, ptr %8, align 16 - %9 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 6, ptr %varargslots, i64 2) - ret void - } - - - define i32 @main(i32 %0, ptr %1) #0 { - entry: - call void @test.main() - ret i32 0 - } +define void @test.main() #0 { +entry: + %x = alloca i64, align 8 + %varargslots = alloca [2 x %"any*"], align 16 + %taddr = alloca %"char[]", align 8 + %faultname_zero = alloca %"char[]", align 8 + %retparam = alloca i64, align 8 + store i64 ptrtoint (ptr @"test.Cde$WORLD" to i64), ptr %x, align 8 + store %"char[]" { ptr @.str.2, i64 5 }, ptr %taddr, align 8 + %0 = insertvalue %"any*" undef, ptr %taddr, 0 + %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %1, ptr %varargslots, align 16 + %2 = load i64, ptr %x, align 8 + %eq = icmp eq i64 %2, 0 + br i1 %eq, label %faultname_no, label %faultname_ok + +faultname_no: ; preds = %entry + call void @llvm.memset.p0.i64(ptr align 8 %faultname_zero, i8 0, i64 16, i1 false) + br label %faultname_exit + +faultname_ok: ; preds = %entry + %3 = inttoptr i64 %2 to ptr + %4 = getelementptr inbounds %.fault, ptr %3, i32 0, i32 1 + br label %faultname_exit + +faultname_exit: ; preds = %faultname_ok, %faultname_no + %faultname = phi ptr [ %faultname_zero, %faultname_no ], [ %4, %faultname_ok ] + %5 = insertvalue %"any*" undef, ptr %faultname, 0 + %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %6, ptr %ptradd, align 16 + %7 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 6, ptr %varargslots, i64 2) + ret void +} + +; Function Attrs: +define i32 @main(i32 %0, ptr %1) #0 { +entry: + call void @test.main() + ret i32 0 +} diff --git a/test/test_suite/expressions/addr_compiles.c3t b/test/test_suite/expressions/addr_compiles.c3t index 29f228d01..db8049d92 100644 --- a/test/test_suite/expressions/addr_compiles.c3t +++ b/test/test_suite/expressions/addr_compiles.c3t @@ -57,7 +57,7 @@ entry: ret void } - +; Function Attrs: define void @test.test() #0 { entry: %f = alloca i32, align 4 @@ -79,7 +79,7 @@ entry: ret void } - +; Function Attrs: define void @test.test2() #0 { entry: %w = alloca ptr, align 8 @@ -90,7 +90,7 @@ entry: ret void } - +; Function Attrs: define void @test.test3() #0 { entry: %h = alloca %Foo, align 4 @@ -101,42 +101,38 @@ entry: %e = alloca ptr, align 8 %taddr = alloca %"int[]", align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %h, ptr align 4 @.__const, i32 8, i1 false) - %0 = getelementptr inbounds %Foo, ptr %h, i32 0, i32 0 - store ptr %0, ptr %zx, align 8 - %1 = getelementptr inbounds %Foo, ptr %h, i32 0, i32 1 - store ptr %1, ptr %zy, align 8 + store ptr %h, ptr %zx, align 8 + %ptradd = getelementptr inbounds i8, ptr %h, i64 4 + store ptr %ptradd, ptr %zy, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %arr, ptr align 4 @.__const.2, i32 12, i1 false) - %2 = load ptr, ptr %zx, align 8 - %3 = load ptr, ptr %zy, align 8 - %4 = load i32, ptr %2, align 4 - %5 = load i32, ptr %3, align 4 - call void (ptr, ...) @printf(ptr @.str.3, i32 %4, i32 %5) - %6 = getelementptr inbounds [3 x i32], ptr %arr, i64 0, i64 0 - %7 = load i32, ptr %6, align 4 - %sub = sub i32 %7, 1 - store i32 %sub, ptr %6, align 4 - %8 = getelementptr inbounds [3 x i32], ptr %arr, i64 0, i64 1 - %9 = load i32, ptr %8, align 4 - %sub1 = sub i32 %9, 1 - store i32 %sub1, ptr %8, align 4 - %10 = getelementptr inbounds [3 x i32], ptr %arr, i64 0, i64 2 - %11 = load i32, ptr %10, align 4 - %sub2 = sub i32 %11, 1 - store i32 %sub2, ptr %10, align 4 - %12 = getelementptr inbounds [3 x i32], ptr %arr, i64 0, i64 2 - store ptr %12, ptr %d, align 8 - %13 = getelementptr inbounds [3 x i32], ptr %arr, i64 0, i64 1 - %14 = insertvalue %"int[]" undef, ptr %13, 0 - %15 = insertvalue %"int[]" %14, i64 2, 1 - store %"int[]" %15, ptr %taddr, align 8 + %0 = load ptr, ptr %zx, align 8 + %1 = load ptr, ptr %zy, align 8 + %2 = load i32, ptr %0, align 4 + %3 = load i32, ptr %1, align 4 + call void (ptr, ...) @printf(ptr @.str.3, i32 %2, i32 %3) + %4 = load i32, ptr %arr, align 4 + %sub = sub i32 %4, 1 + store i32 %sub, ptr %arr, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %arr, i64 4 + %5 = load i32, ptr %ptradd1, align 4 + %sub2 = sub i32 %5, 1 + store i32 %sub2, ptr %ptradd1, align 4 + %ptradd3 = getelementptr inbounds i8, ptr %arr, i64 8 + %6 = load i32, ptr %ptradd3, align 4 + %sub4 = sub i32 %6, 1 + store i32 %sub4, ptr %ptradd3, align 4 + %ptradd5 = getelementptr inbounds i8, ptr %arr, i64 8 + store ptr %ptradd5, ptr %d, align 8 + %ptradd6 = getelementptr inbounds i8, ptr %arr, i64 4 + %7 = insertvalue %"int[]" undef, ptr %ptradd6, 0 + %8 = insertvalue %"int[]" %7, i64 2, 1 + store %"int[]" %8, ptr %taddr, align 8 store ptr %taddr, ptr %e, align 8 - %16 = load ptr, ptr %d, align 8 - %17 = load ptr, ptr %e, align 8 - %18 = getelementptr inbounds %"int[]", ptr %17, i32 0, i32 0 - %19 = load ptr, ptr %18, align 8 - %ptroffset = getelementptr inbounds i32, ptr %19, i64 0 - %20 = load i32, ptr %16, align 4 - %21 = load i32, ptr %ptroffset, align 4 - call void (ptr, ...) @printf(ptr @.str.4, i32 %20, i32 %21) + %9 = load ptr, ptr %d, align 8 + %10 = load ptr, ptr %e, align 8 + %11 = load ptr, ptr %10, align 8 + %12 = load i32, ptr %9, align 4 + %13 = load i32, ptr %11, align 4 + call void (ptr, ...) @printf(ptr @.str.4, i32 %12, i32 %13) ret void } \ No newline at end of file diff --git a/test/test_suite/expressions/folding_ptr.c3t b/test/test_suite/expressions/folding_ptr.c3t index 17320f785..53eea9f62 100644 --- a/test/test_suite/expressions/folding_ptr.c3t +++ b/test/test_suite/expressions/folding_ptr.c3t @@ -19,8 +19,7 @@ fn int f() define i32 @test.f() #0 { entry: %0 = load ptr, ptr @cfun, align 8 - %ptroffset = getelementptr %Test, ptr %0, i64 0 - %not = icmp eq ptr %ptroffset, null + %not = icmp eq ptr %0, null br i1 %not, label %if.then, label %if.exit if.then: ; preds = %entry @@ -28,7 +27,6 @@ if.then: ; preds = %entry if.exit: ; preds = %entry %1 = load ptr, ptr @cfun, align 8 - %2 = getelementptr inbounds %Test, ptr %1, i32 0, i32 0 - %3 = load i32, ptr %2, align 4 - ret i32 %3 + %2 = load i32, ptr %1, align 4 + ret i32 %2 } diff --git a/test/test_suite/expressions/incdec.c3t b/test/test_suite/expressions/incdec.c3t index cb4404e02..95f908337 100644 --- a/test/test_suite/expressions/incdec.c3t +++ b/test/test_suite/expressions/incdec.c3t @@ -19,11 +19,11 @@ fn void test(int* foo) %z = alloca float, align 4 store ptr %0, ptr %foo, align 8 %1 = load ptr, ptr %foo, align 8 - %ptroffset = getelementptr i32, ptr %1, i8 1 - store ptr %ptroffset, ptr %foo, align 8 + %ptradd_any = getelementptr i8, ptr %1, i8 4 + store ptr %ptradd_any, ptr %foo, align 8 %2 = load ptr, ptr %foo, align 8 - %ptroffset1 = getelementptr i32, ptr %2, i8 -1 - store ptr %ptroffset1, ptr %foo, align 8 + %ptradd_any1 = getelementptr i8, ptr %2, i8 -4 + store ptr %ptradd_any1, ptr %foo, align 8 store i32 10, ptr %y, align 4 %3 = load i32, ptr %y, align 4 %add = add i32 %3, 1 diff --git a/test/test_suite/expressions/pointer_access.c3t b/test/test_suite/expressions/pointer_access.c3t index 08b3975a8..9827e40f6 100644 --- a/test/test_suite/expressions/pointer_access.c3t +++ b/test/test_suite/expressions/pointer_access.c3t @@ -51,54 +51,48 @@ fn void testSimple() define void @pointer_access.testSimple() #0 { entry: %a = alloca %ExtraSimple, align 8 - %0 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 0 - store i32 0, ptr %0, align 8 - %1 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 1 - store i32 0, ptr %1, align 4 - %2 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 2 - %3 = getelementptr inbounds %c, ptr %2, i32 0, i32 0 - store double 0.000000e+00, ptr %3, align 8 - %4 = getelementptr inbounds %c, ptr %2, i32 0, i32 1 - store double 0.000000e+00, ptr %4, align 8 - %5 = getelementptr inbounds %c, ptr %2, i32 0, i32 2 - store double 0.000000e+00, ptr %5, align 8 - %6 = getelementptr inbounds %c, ptr %2, i32 0, i32 3 - store double 0.000000e+00, ptr %6, align 8 - %7 = getelementptr inbounds %c, ptr %2, i32 0, i32 4 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %7, ptr align 8 @.__const, i32 8, i1 false) - %8 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 3 - %9 = getelementptr inbounds %.anon, ptr %8, i32 0, i32 0 - store i32 0, ptr %9, align 8 - %10 = getelementptr inbounds %.anon, ptr %8, i32 0, i32 1 - store i32 0, ptr %10, align 4 - %11 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 4 - call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 8, i1 false) - %12 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 5 - store i32 0, ptr %12, align 8 - %13 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 2 - %14 = getelementptr inbounds %c, ptr %13, i32 0, i32 4 - store double 3.400000e+00, ptr %14, align 8 - %15 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 0 - %16 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 2 - %17 = getelementptr inbounds %c, ptr %16, i32 0, i32 0 - %18 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 2 - %19 = getelementptr inbounds %c, ptr %18, i32 0, i32 3 - %20 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 2 - %21 = getelementptr inbounds %c, ptr %20, i32 0, i32 4 - %22 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 5 - %23 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 4 - %24 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 3 - %25 = getelementptr inbounds %.anon, ptr %24, i32 0, i32 0 - %26 = getelementptr inbounds %ExtraSimple, ptr %a, i32 0, i32 3 - %27 = getelementptr inbounds %.anon, ptr %26, i32 0, i32 1 - %28 = load i32, ptr %15, align 8 - %29 = load double, ptr %17, align 8 - %30 = load double, ptr %19, align 8 - %31 = load double, ptr %21, align 8 - %32 = load i32, ptr %22, align 8 - %33 = load double, ptr %23, align 8 - %34 = load i32, ptr %25, align 8 - %35 = load i32, ptr %27, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %28, double %29, double %30, double %31, i32 %32, double %33, i32 %34, i32 %35) + store i32 0, ptr %a, align 8 + %ptradd = getelementptr inbounds i8, ptr %a, i64 4 + store i32 0, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %a, i64 8 + store double 0.000000e+00, ptr %ptradd1, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %ptradd1, i64 8 + store double 0.000000e+00, ptr %ptradd2, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %ptradd1, i64 16 + store double 0.000000e+00, ptr %ptradd3, align 8 + %ptradd4 = getelementptr inbounds i8, ptr %ptradd1, i64 24 + store double 0.000000e+00, ptr %ptradd4, align 8 + %ptradd5 = getelementptr inbounds i8, ptr %ptradd1, i64 32 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %ptradd5, ptr align 8 @.__const, i32 8, i1 false) + %ptradd6 = getelementptr inbounds i8, ptr %a, i64 48 + store i32 0, ptr %ptradd6, align 8 + %ptradd7 = getelementptr inbounds i8, ptr %ptradd6, i64 4 + store i32 0, ptr %ptradd7, align 4 + %ptradd8 = getelementptr inbounds i8, ptr %a, i64 56 + call void @llvm.memset.p0.i64(ptr align 8 %ptradd8, i8 0, i64 8, i1 false) + %ptradd9 = getelementptr inbounds i8, ptr %a, i64 64 + store i32 0, ptr %ptradd9, align 8 + %ptradd10 = getelementptr inbounds i8, ptr %a, i64 8 + %ptradd11 = getelementptr inbounds i8, ptr %ptradd10, i64 32 + store double 3.400000e+00, ptr %ptradd11, align 8 + %ptradd12 = getelementptr inbounds i8, ptr %a, i64 8 + %ptradd13 = getelementptr inbounds i8, ptr %a, i64 8 + %ptradd14 = getelementptr inbounds i8, ptr %ptradd13, i64 24 + %ptradd15 = getelementptr inbounds i8, ptr %a, i64 8 + %ptradd16 = getelementptr inbounds i8, ptr %ptradd15, i64 32 + %ptradd17 = getelementptr inbounds i8, ptr %a, i64 64 + %ptradd18 = getelementptr inbounds i8, ptr %a, i64 56 + %ptradd19 = getelementptr inbounds i8, ptr %a, i64 48 + %ptradd20 = getelementptr inbounds i8, ptr %a, i64 48 + %ptradd21 = getelementptr inbounds i8, ptr %ptradd20, i64 4 + %0 = load i32, ptr %a, align 8 + %1 = load double, ptr %ptradd12, align 8 + %2 = load double, ptr %ptradd14, align 8 + %3 = load double, ptr %ptradd16, align 8 + %4 = load i32, ptr %ptradd17, align 8 + %5 = load double, ptr %ptradd18, align 8 + %6 = load i32, ptr %ptradd19, align 8 + %7 = load i32, ptr %ptradd21, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %0, double %1, double %2, double %3, i32 %4, double %5, i32 %6, i32 %7) ret void } diff --git a/test/test_suite/functions/assorted_tests.c3t b/test/test_suite/functions/assorted_tests.c3t index 3f155d75e..f78c89c99 100644 --- a/test/test_suite/functions/assorted_tests.c3t +++ b/test/test_suite/functions/assorted_tests.c3t @@ -66,6 +66,7 @@ entry: ret i32 %3 } +; Function Attrs: define void @test.foo2(i32 %0) #0 { entry: %intbool = icmp ne i32 %0, 0 @@ -74,6 +75,7 @@ entry: ret void } +; Function Attrs: define i32 @test.trys(ptr %0, i32 %1) #0 { entry: %asa = alloca i32, align 4 @@ -99,11 +101,11 @@ if.exit: ; preds = %if.then, %entry define void @test.setInternalFPFZero(ptr %0) #1 { entry: - %1 = getelementptr inbounds %InternalFPF, ptr %0, i32 0, i32 0 - store i8 0, ptr %1, align 1 + store i8 0, ptr %0, align 1 ret void } +; Function Attrs: define void @test.denormalize(ptr %0) #0 { entry: call void @test.setInternalFPFZero(ptr %0) diff --git a/test/test_suite/functions/func_ptr_conversions_and_names.c3t b/test/test_suite/functions/func_ptr_conversions_and_names.c3t index 1d83dfad9..6f8fc2d46 100644 --- a/test/test_suite/functions/func_ptr_conversions_and_names.c3t +++ b/test/test_suite/functions/func_ptr_conversions_and_names.c3t @@ -89,55 +89,47 @@ entry: store i32 %1, ptr %taddr, align 4 %2 = insertvalue %"any*" undef, ptr %taddr, 0 %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %4 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %3, ptr %4, align 16 - %5 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) - %6 = call i32 @test.test2(i32 3) - store i32 %6, ptr %taddr2, align 4 - %7 = insertvalue %"any*" undef, ptr %taddr2, 0 - %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %9 = getelementptr inbounds [1 x %"any*"], ptr %varargslots1, i64 0, i64 0 - store %"any*" %8, ptr %9, align 16 - %10 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.1, i64 2, ptr %varargslots1, i64 1) + store %"any*" %3, ptr %varargslots, align 16 + %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) + %5 = call i32 @test.test2(i32 3) + store i32 %5, ptr %taddr2, align 4 + %6 = insertvalue %"any*" undef, ptr %taddr2, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %7, ptr %varargslots1, align 16 + %8 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.1, i64 2, ptr %varargslots1, i64 1) store ptr @test.test2, ptr %z, align 8 - %11 = load ptr, ptr %z, align 8 - %12 = call i32 %11(i32 444) - store i32 %12, ptr %taddr5, align 4 - %13 = insertvalue %"any*" undef, ptr %taddr5, 0 - %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %15 = getelementptr inbounds [1 x %"any*"], ptr %varargslots4, i64 0, i64 0 - store %"any*" %14, ptr %15, align 16 - %16 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.2, i64 2, ptr %varargslots4, i64 1) + %9 = load ptr, ptr %z, align 8 + %10 = call i32 %9(i32 444) + store i32 %10, ptr %taddr5, align 4 + %11 = insertvalue %"any*" undef, ptr %taddr5, 0 + %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %12, ptr %varargslots4, align 16 + %13 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.2, i64 2, ptr %varargslots4, i64 1) store %"char[]" { ptr @.str.4, i64 12 }, ptr %taddr8, align 8 - %17 = insertvalue %"any*" undef, ptr %taddr8, 0 - %18 = insertvalue %"any*" %17, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %19 = getelementptr inbounds [1 x %"any*"], ptr %varargslots7, i64 0, i64 0 - store %"any*" %18, ptr %19, align 16 - %20 = call i64 @std.io.printfn(ptr %retparam9, ptr @.str.3, i64 2, ptr %varargslots7, i64 1) + %14 = insertvalue %"any*" undef, ptr %taddr8, 0 + %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %15, ptr %varargslots7, align 16 + %16 = call i64 @std.io.printfn(ptr %retparam9, ptr @.str.3, i64 2, ptr %varargslots7, i64 1) store %"char[]" { ptr @.str.6, i64 12 }, ptr %taddr11, align 8 - %21 = insertvalue %"any*" undef, ptr %taddr11, 0 - %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %23 = getelementptr inbounds [1 x %"any*"], ptr %varargslots10, i64 0, i64 0 - store %"any*" %22, ptr %23, align 16 - %24 = call i64 @std.io.printfn(ptr %retparam12, ptr @.str.5, i64 2, ptr %varargslots10, i64 1) + %17 = insertvalue %"any*" undef, ptr %taddr11, 0 + %18 = insertvalue %"any*" %17, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %18, ptr %varargslots10, align 16 + %19 = call i64 @std.io.printfn(ptr %retparam12, ptr @.str.5, i64 2, ptr %varargslots10, i64 1) store %"char[]" { ptr @.str.8, i64 12 }, ptr %taddr14, align 8 - %25 = insertvalue %"any*" undef, ptr %taddr14, 0 - %26 = insertvalue %"any*" %25, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %27 = getelementptr inbounds [1 x %"any*"], ptr %varargslots13, i64 0, i64 0 - store %"any*" %26, ptr %27, align 16 - %28 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.7, i64 2, ptr %varargslots13, i64 1) + %20 = insertvalue %"any*" undef, ptr %taddr14, 0 + %21 = insertvalue %"any*" %20, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %21, ptr %varargslots13, align 16 + %22 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.7, i64 2, ptr %varargslots13, i64 1) store %"char[]" { ptr @.str.10, i64 6 }, ptr %taddr17, align 8 - %29 = insertvalue %"any*" undef, ptr %taddr17, 0 - %30 = insertvalue %"any*" %29, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %31 = getelementptr inbounds [1 x %"any*"], ptr %varargslots16, i64 0, i64 0 - store %"any*" %30, ptr %31, align 16 - %32 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.9, i64 2, ptr %varargslots16, i64 1) + %23 = insertvalue %"any*" undef, ptr %taddr17, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %24, ptr %varargslots16, align 16 + %25 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.9, i64 2, ptr %varargslots16, i64 1) store %"char[]" { ptr @.str.12, i64 13 }, ptr %taddr20, align 8 - %33 = insertvalue %"any*" undef, ptr %taddr20, 0 - %34 = insertvalue %"any*" %33, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %35 = getelementptr inbounds [1 x %"any*"], ptr %varargslots19, i64 0, i64 0 - store %"any*" %34, ptr %35, align 16 - %36 = call i64 @std.io.printfn(ptr %retparam21, ptr @.str.11, i64 2, ptr %varargslots19, i64 1) + %26 = insertvalue %"any*" undef, ptr %taddr20, 0 + %27 = insertvalue %"any*" %26, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %27, ptr %varargslots19, align 16 + %28 = call i64 @std.io.printfn(ptr %retparam21, ptr @.str.11, i64 2, ptr %varargslots19, i64 1) store ptr @test.test2, ptr %y, align 8 store i64 ptrtoint (ptr @"$ct.p$fn$int$int$" to i64), ptr %zfoke, align 8 ret void diff --git a/test/test_suite/functions/splat.c3t b/test/test_suite/functions/splat.c3t index a55252650..dbd9710ab 100644 --- a/test/test_suite/functions/splat.c3t +++ b/test/test_suite/functions/splat.c3t @@ -21,25 +21,23 @@ declare i32 @sum_us(ptr, i64) #0 %varargslots = alloca [3 x i32], align 4 %x = alloca [3 x i32], align 4 %z = alloca %"int[]", align 8 - %0 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 0 - store i32 1, ptr %0, align 4 - %1 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 1 - store i32 2, ptr %1, align 4 - %2 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 2 - store i32 3, ptr %2, align 4 - %3 = call i32 @sum_us(ptr %varargslots, i64 3) + store i32 1, ptr %varargslots, align 4 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 4 + store i32 2, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %varargslots, i64 8 + store i32 3, ptr %ptradd1, align 4 + %0 = call i32 @sum_us(ptr %varargslots, i64 3) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 12, i1 false) - %4 = insertvalue %"int[]" undef, ptr %x, 0 - %5 = insertvalue %"int[]" %4, i64 3, 1 - store %"int[]" %5, ptr %z, align 8 - %6 = insertvalue %"int[]" undef, ptr %x, 0 - %7 = insertvalue %"int[]" %6, i64 3, 1 - %8 = call i32 @sum_us(ptr %x, i64 3) - %9 = getelementptr inbounds %"int[]", ptr %z, i32 0, i32 0 - %lo = load ptr, ptr %9, align 8 - %10 = getelementptr inbounds %"int[]", ptr %z, i32 0, i32 1 - %hi = load i64, ptr %10, align 8 - %11 = call i32 @sum_us(ptr %lo, i64 %hi) - %12 = call i32 @sum_us(ptr null, i64 0) + %1 = insertvalue %"int[]" undef, ptr %x, 0 + %2 = insertvalue %"int[]" %1, i64 3, 1 + store %"int[]" %2, ptr %z, align 8 + %3 = insertvalue %"int[]" undef, ptr %x, 0 + %4 = insertvalue %"int[]" %3, i64 3, 1 + %5 = call i32 @sum_us(ptr %x, i64 3) + %lo = load ptr, ptr %z, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %z, i64 8 + %hi = load i64, ptr %ptradd2, align 8 + %6 = call i32 @sum_us(ptr %lo, i64 %hi) + %7 = call i32 @sum_us(ptr null, i64 0) ret void } \ No newline at end of file diff --git a/test/test_suite/functions/splat_aarch64.c3t b/test/test_suite/functions/splat_aarch64.c3t index cf1d39262..70bd6e039 100644 --- a/test/test_suite/functions/splat_aarch64.c3t +++ b/test/test_suite/functions/splat_aarch64.c3t @@ -20,38 +20,38 @@ fn void test() declare i32 @sum_us([2 x i64]) #0 +; Function Attrs: define void @splat.test() #0 { entry: %varargslots = alloca [3 x i32], align 4 %taddr = alloca %"int[]", align 8 %x = alloca [3 x i32], align 4 %z = alloca %"int[]", align 8 - %taddr1 = alloca %"int[]", align 8 %taddr2 = alloca %"int[]", align 8 - %0 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 0 - store i32 1, ptr %0, align 4 - %1 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 1 - store i32 2, ptr %1, align 4 - %2 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 2 - store i32 3, ptr %2, align 4 - %3 = insertvalue %"int[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"int[]" %3, i64 3, 1 + %taddr3 = alloca %"int[]", align 8 + store i32 1, ptr %varargslots, align 4 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 4 + store i32 2, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %varargslots, i64 8 + store i32 3, ptr %ptradd1, align 4 + %0 = insertvalue %"int[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"int[]" %0, i64 3, 1 store %"int[]" %"$$temp", ptr %taddr, align 8 - %4 = load [2 x i64], ptr %taddr, align 8 - %5 = call i32 @sum_us([2 x i64] %4) + %1 = load [2 x i64], ptr %taddr, align 8 + %2 = call i32 @sum_us([2 x i64] %1) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 12, i1 false) - %6 = insertvalue %"int[]" undef, ptr %x, 0 - %7 = insertvalue %"int[]" %6, i64 3, 1 - store %"int[]" %7, ptr %z, align 8 - %8 = insertvalue %"int[]" undef, ptr %x, 0 - %9 = insertvalue %"int[]" %8, i64 3, 1 - store %"int[]" %9, ptr %taddr1, align 8 - %10 = load [2 x i64], ptr %taddr1, align 8 - %11 = call i32 @sum_us([2 x i64] %10) - %12 = load [2 x i64], ptr %z, align 8 - %13 = call i32 @sum_us([2 x i64] %12) - store %"int[]" zeroinitializer, ptr %taddr2, align 8 - %14 = load [2 x i64], ptr %taddr2, align 8 - %15 = call i32 @sum_us([2 x i64] %14) + %3 = insertvalue %"int[]" undef, ptr %x, 0 + %4 = insertvalue %"int[]" %3, i64 3, 1 + store %"int[]" %4, ptr %z, align 8 + %5 = insertvalue %"int[]" undef, ptr %x, 0 + %6 = insertvalue %"int[]" %5, i64 3, 1 + store %"int[]" %6, ptr %taddr2, align 8 + %7 = load [2 x i64], ptr %taddr2, align 8 + %8 = call i32 @sum_us([2 x i64] %7) + %9 = load [2 x i64], ptr %z, align 8 + %10 = call i32 @sum_us([2 x i64] %9) + store %"int[]" zeroinitializer, ptr %taddr3, align 8 + %11 = load [2 x i64], ptr %taddr3, align 8 + %12 = call i32 @sum_us([2 x i64] %11) ret void } diff --git a/test/test_suite/functions/splat_mingw.c3t b/test/test_suite/functions/splat_mingw.c3t index 867ebd699..4b49c2f44 100644 --- a/test/test_suite/functions/splat_mingw.c3t +++ b/test/test_suite/functions/splat_mingw.c3t @@ -17,35 +17,35 @@ fn void test() declare i32 @sum_us(ptr align 8) #0 +; Function Attrs: define void @splat.test() #0 { entry: %varargslots = alloca [3 x i32], align 4 %indirectarg = alloca %"int[]", align 8 %x = alloca [3 x i32], align 4 %z = alloca %"int[]", align 8 - %indirectarg1 = alloca %"int[]", align 8 %indirectarg2 = alloca %"int[]", align 8 %indirectarg3 = alloca %"int[]", align 8 - %0 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 0 - store i32 1, ptr %0, align 4 - %1 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 1 - store i32 2, ptr %1, align 4 - %2 = getelementptr inbounds [3 x i32], ptr %varargslots, i64 0, i64 2 - store i32 3, ptr %2, align 4 - %3 = insertvalue %"int[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"int[]" %3, i64 3, 1 + %indirectarg4 = alloca %"int[]", align 8 + store i32 1, ptr %varargslots, align 4 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 4 + store i32 2, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %varargslots, i64 8 + store i32 3, ptr %ptradd1, align 4 + %0 = insertvalue %"int[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"int[]" %0, i64 3, 1 store %"int[]" %"$$temp", ptr %indirectarg, align 8 - %4 = call i32 @sum_us(ptr align 8 %indirectarg) + %1 = call i32 @sum_us(ptr align 8 %indirectarg) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 12, i1 false) - %5 = insertvalue %"int[]" undef, ptr %x, 0 - %6 = insertvalue %"int[]" %5, i64 3, 1 - store %"int[]" %6, ptr %z, align 8 - %7 = insertvalue %"int[]" undef, ptr %x, 0 - %8 = insertvalue %"int[]" %7, i64 3, 1 - store %"int[]" %8, ptr %indirectarg1, align 8 - %9 = call i32 @sum_us(ptr align 8 %indirectarg1) - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg2, ptr align 8 %z, i32 16, i1 false) - %10 = call i32 @sum_us(ptr align 8 %indirectarg2) - store %"int[]" zeroinitializer, ptr %indirectarg3, align 8 - %11 = call i32 @sum_us(ptr align 8 %indirectarg3) + %2 = insertvalue %"int[]" undef, ptr %x, 0 + %3 = insertvalue %"int[]" %2, i64 3, 1 + store %"int[]" %3, ptr %z, align 8 + %4 = insertvalue %"int[]" undef, ptr %x, 0 + %5 = insertvalue %"int[]" %4, i64 3, 1 + store %"int[]" %5, ptr %indirectarg2, align 8 + %6 = call i32 @sum_us(ptr align 8 %indirectarg2) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg3, ptr align 8 %z, i32 16, i1 false) + %7 = call i32 @sum_us(ptr align 8 %indirectarg3) + store %"int[]" zeroinitializer, ptr %indirectarg4, align 8 + %8 = call i32 @sum_us(ptr align 8 %indirectarg4) ret void diff --git a/test/test_suite/functions/test_regression.c3t b/test/test_suite/functions/test_regression.c3t index bdf9fd223..d42b6c3c6 100644 --- a/test/test_suite/functions/test_regression.c3t +++ b/test/test_suite/functions/test_regression.c3t @@ -236,7 +236,6 @@ fn Type getValue(Blob blob) %Blob = type { i32 } %Blob.0 = type { double } -%Foo2 = type { i32 } %Bobo = type { i16, float, i16, i16, float, i16 } %"int[]" = type { ptr, i64 } %LinkedList = type { %"any*", i64, ptr, ptr } @@ -255,34 +254,32 @@ fn Type getValue(Blob blob) define void @test.Foo2.printme(ptr %0) #0 { entry: - %1 = getelementptr inbounds %Foo2, ptr %0, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - %3 = call i32 (ptr, ...) @printf(ptr @.str.21, i32 %2) + %1 = load i32, ptr %0, align 4 + %2 = call i32 (ptr, ...) @printf(ptr @.str.21, i32 %1) ret void } - +; Function Attrs: define i32 @test.Foo2.mutate(ptr %0) #0 { entry: %1 = call i32 (ptr, ...) @printf(ptr @.str.22) - %2 = getelementptr inbounds %Foo2, ptr %0, i32 0, i32 0 - %3 = load i32, ptr %2, align 4 - %add = add i32 %3, 1 - store i32 %add, ptr %2, align 4 + %2 = load i32, ptr %0, align 4 + %add = add i32 %2, 1 + store i32 %add, ptr %0, align 4 ret i32 %add } - +; Function Attrs: declare i32 @printf(ptr, ...) #0 - +; Function Attrs: define void @test.helloWorld() #0 { entry: %0 = call i32 (ptr, ...) @printf(ptr @.str) ret void } - +; Function Attrs: define i32 @test.test_static() #0 { entry: %0 = load i32, ptr @test_static.x, align 4 @@ -294,7 +291,7 @@ entry: ret i32 %3 } - +; Function Attrs: define i32 @test.helo(double %0, ptr byval(%Bobo) align 8 %1) #0 { entry: %de = alloca [3 x i32], align 4 @@ -307,7 +304,7 @@ entry: ret i32 1 } - +; Function Attrs: define i32 @test.test1(i32 %0, i32 %1) #0 { entry: %a = alloca i32, align 4 @@ -327,55 +324,53 @@ if.exit: ; preds = %entry ret i32 %4 } - +; Function Attrs: define i32 @test.sum_us(ptr %0, i64 %1) #0 { entry: %x = alloca %"int[]", align 8 %sum = alloca i32, align 4 store ptr %0, ptr %x, align 8 - %ptroffset = getelementptr inbounds i64, ptr %x, i64 1 - store i64 %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + store i64 %1, ptr %ptradd, align 8 store i32 0, ptr %sum, align 4 - %2 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - %eq = icmp eq i64 0, %3 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + %2 = load i64, ptr %ptradd1, align 8 + %eq = icmp eq i64 0, %2 br i1 %eq, label %if.then, label %if.exit if.then: ; preds = %entry ret i32 0 if.exit: ; preds = %entry - %4 = load i32, ptr %sum, align 4 - %5 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 0 - %6 = load ptr, ptr %5, align 8 - %ptroffset1 = getelementptr inbounds i32, ptr %6, i64 0 - %7 = load i32, ptr %ptroffset1, align 4 - %8 = load %"int[]", ptr %x, align 8 - %9 = extractvalue %"int[]" %8, 0 - %10 = extractvalue %"int[]" %8, 1 - %sub = sub i64 %10, 1 - %11 = add i64 %sub, 1 - %size = sub i64 %11, 1 - %ptroffset2 = getelementptr inbounds i32, ptr %9, i64 1 - %12 = insertvalue %"int[]" undef, ptr %ptroffset2, 0 - %13 = insertvalue %"int[]" %12, i64 %size, 1 - %14 = call i32 @test.sum_us(ptr %ptroffset2, i64 %size) - %add = add i32 %7, %14 - %add3 = add i32 %4, %add + %3 = load i32, ptr %sum, align 4 + %4 = load ptr, ptr %x, align 8 + %5 = load i32, ptr %4, align 4 + %6 = load %"int[]", ptr %x, align 8 + %7 = extractvalue %"int[]" %6, 0 + %8 = extractvalue %"int[]" %6, 1 + %sub = sub i64 %8, 1 + %9 = add i64 %sub, 1 + %size = sub i64 %9, 1 + %ptradd2 = getelementptr inbounds i8, ptr %7, i64 4 + %10 = insertvalue %"int[]" undef, ptr %ptradd2, 0 + %11 = insertvalue %"int[]" %10, i64 %size, 1 + %12 = call i32 @test.sum_us(ptr %ptradd2, i64 %size) + %add = add i32 %5, %12 + %add3 = add i32 %3, %add store i32 %add3, ptr %sum, align 4 - %15 = load i32, ptr %sum, align 4 - ret i32 %15 + %13 = load i32, ptr %sum, align 4 + ret i32 %13 } - +; Function Attrs: define i32 @test.sumd(ptr %0, i64 %1) #0 { entry: %x = alloca %"int[]", align 8 %sum = alloca i32, align 4 %i = alloca i32, align 4 store ptr %0, ptr %x, align 8 - %ptroffset = getelementptr inbounds i64, ptr %x, i64 1 - store i64 %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + store i64 %1, ptr %ptradd, align 8 store i32 0, ptr %sum, align 4 store i32 0, ptr %i, align 4 br label %loop.cond @@ -383,34 +378,33 @@ entry: loop.cond: ; preds = %loop.body, %entry %2 = load i32, ptr %i, align 4 %sext = sext i32 %2 to i64 - %3 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 1 - %4 = load i64, ptr %3, align 8 - %lt = icmp slt i64 %sext, %4 - %check = icmp slt i64 %4, 0 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + %3 = load i64, ptr %ptradd1, align 8 + %lt = icmp slt i64 %sext, %3 + %check = icmp slt i64 %3, 0 %siui-lt = or i1 %check, %lt br i1 %siui-lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %5 = load i32, ptr %sum, align 4 - %6 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 0 - %7 = load ptr, ptr %6, align 8 - %8 = load i32, ptr %i, align 4 - %sext1 = sext i32 %8 to i64 - %ptroffset2 = getelementptr inbounds i32, ptr %7, i64 %sext1 - %9 = load i32, ptr %ptroffset2, align 4 - %add = add i32 %5, %9 + %4 = load i32, ptr %sum, align 4 + %5 = load ptr, ptr %x, align 8 + %6 = load i32, ptr %i, align 4 + %sext2 = sext i32 %6 to i64 + %ptroffset = getelementptr inbounds [4 x i8], ptr %5, i64 %sext2 + %7 = load i32, ptr %ptroffset, align 4 + %add = add i32 %4, %7 store i32 %add, ptr %sum, align 4 - %10 = load i32, ptr %i, align 4 - %add3 = add i32 %10, 1 + %8 = load i32, ptr %i, align 4 + %add3 = add i32 %8, 1 store i32 %add3, ptr %i, align 4 br label %loop.cond loop.exit: ; preds = %loop.cond - %11 = load i32, ptr %sum, align 4 - ret i32 %11 + %9 = load i32, ptr %sum, align 4 + ret i32 %9 } - +; Function Attrs: define void @test.main() #0 { entry: %list = alloca %LinkedList, align 8 @@ -426,7 +420,7 @@ entry: %z = alloca %"int[]", align 8 %de = alloca [3 x i32], align 4 %varargslots = alloca [4 x i32], align 16 - %varargslots10 = alloca [1 x i32], align 4 + %varargslots14 = alloca [1 x i32], align 4 %a1 = alloca ptr, align 8 %b2 = alloca ptr, align 8 %0 = call i32 @test.test_static() @@ -505,51 +499,47 @@ loop.exit8: ; preds = %loop.cond2 %27 = call double @"test2$double$.getMult"(double 3.300000e+00) %28 = call i32 (ptr, ...) @printf(ptr @.str.11, double %27) call void @test.helloWorld() - %29 = getelementptr inbounds %Foo, ptr %ddx, i32 0, i32 0 - store i32 0, ptr %29, align 4 - %30 = getelementptr inbounds %Foo, ptr %ddx, i32 0, i32 1 - store i32 0, ptr %30, align 4 + store i32 0, ptr %ddx, align 4 + %ptradd = getelementptr inbounds i8, ptr %ddx, i64 4 + store i32 0, ptr %ptradd, align 4 store i32 3, ptr %fro, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %x, ptr align 16 @.__const.12, i32 16, i1 false) - %31 = load i32, ptr %fro, align 4 - %32 = insertvalue %"int[]" undef, ptr %x, 0 - %33 = insertvalue %"int[]" %32, i64 4, 1 - %34 = call i32 @test.sum_us(ptr %x, i64 4) - %35 = call i32 (ptr, ...) @printf(ptr @.str.13, i32 %34) - %add9 = add i32 %31, %35 + %29 = load i32, ptr %fro, align 4 + %30 = insertvalue %"int[]" undef, ptr %x, 0 + %31 = insertvalue %"int[]" %30, i64 4, 1 + %32 = call i32 @test.sum_us(ptr %x, i64 4) + %33 = call i32 (ptr, ...) @printf(ptr @.str.13, i32 %32) + %add9 = add i32 %29, %33 store i32 %add9, ptr %fro, align 4 - %36 = load i32, ptr %fro, align 4 - %37 = call i32 (ptr, ...) @printf(ptr @.str.14, i32 %36) + %34 = load i32, ptr %fro, align 4 + %35 = call i32 (ptr, ...) @printf(ptr @.str.14, i32 %34) + %36 = insertvalue %"int[]" undef, ptr %x, 0 + %37 = insertvalue %"int[]" %36, i64 4, 1 + store %"int[]" %37, ptr %z, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %de, ptr align 4 @.__const.15, i32 12, i1 false) %38 = insertvalue %"int[]" undef, ptr %x, 0 %39 = insertvalue %"int[]" %38, i64 4, 1 - store %"int[]" %39, ptr %z, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %de, ptr align 4 @.__const.15, i32 12, i1 false) - %40 = insertvalue %"int[]" undef, ptr %x, 0 - %41 = insertvalue %"int[]" %40, i64 4, 1 - %42 = call i32 @test.sum_us(ptr %x, i64 4) - %43 = call i32 (ptr, ...) @printf(ptr @.str.16, i32 %42) - %44 = getelementptr inbounds %"int[]", ptr %z, i32 0, i32 0 - %lo = load ptr, ptr %44, align 8 - %45 = getelementptr inbounds %"int[]", ptr %z, i32 0, i32 1 - %hi = load i64, ptr %45, align 8 - %46 = call i32 @test.sum_us(ptr %lo, i64 %hi) - %47 = call i32 (ptr, ...) @printf(ptr @.str.17, i32 %46) - %48 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 0 - store i32 1, ptr %48, align 4 - %49 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 1 - store i32 2, ptr %49, align 4 - %50 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 2 - store i32 4, ptr %50, align 4 - %51 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 3 - store i32 5, ptr %51, align 4 - %52 = call i32 @test.sum_us(ptr %varargslots, i64 4) - %53 = call i32 (ptr, ...) @printf(ptr @.str.18, i32 %52) - %54 = getelementptr inbounds [1 x i32], ptr %varargslots10, i64 0, i64 0 - store i32 1, ptr %54, align 4 - %55 = call i32 @test.sum_us(ptr %varargslots10, i64 1) - %56 = call i32 (ptr, ...) @printf(ptr @.str.19, i32 %55) - %57 = call i32 @test.sum_us(ptr null, i64 0) - %58 = call i32 (ptr, ...) @printf(ptr @.str.20, i32 %57) + %40 = call i32 @test.sum_us(ptr %x, i64 4) + %41 = call i32 (ptr, ...) @printf(ptr @.str.16, i32 %40) + %lo = load ptr, ptr %z, align 8 + %ptradd10 = getelementptr inbounds i8, ptr %z, i64 8 + %hi = load i64, ptr %ptradd10, align 8 + %42 = call i32 @test.sum_us(ptr %lo, i64 %hi) + %43 = call i32 (ptr, ...) @printf(ptr @.str.17, i32 %42) + store i32 1, ptr %varargslots, align 4 + %ptradd11 = getelementptr inbounds i8, ptr %varargslots, i64 4 + store i32 2, ptr %ptradd11, align 4 + %ptradd12 = getelementptr inbounds i8, ptr %varargslots, i64 8 + store i32 4, ptr %ptradd12, align 4 + %ptradd13 = getelementptr inbounds i8, ptr %varargslots, i64 12 + store i32 5, ptr %ptradd13, align 4 + %44 = call i32 @test.sum_us(ptr %varargslots, i64 4) + %45 = call i32 (ptr, ...) @printf(ptr @.str.18, i32 %44) + store i32 1, ptr %varargslots14, align 4 + %46 = call i32 @test.sum_us(ptr %varargslots14, i64 1) + %47 = call i32 (ptr, ...) @printf(ptr @.str.19, i32 %46) + %48 = call i32 @test.sum_us(ptr null, i64 0) + %49 = call i32 (ptr, ...) @printf(ptr @.str.20, i32 %48) store ptr null, ptr %a1, align 8 store ptr null, ptr %b2, align 8 ret void @@ -591,9 +581,8 @@ define i32 @"test2$int$.getValue"(i32 %0) #0 { entry: %blob = alloca %Blob, align 4 store i32 %0, ptr %blob, align 4 - %1 = getelementptr inbounds %Blob, ptr %blob, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - ret i32 %2 + %1 = load i32, ptr %blob, align 4 + ret i32 %1 } // #expect: test2.double.ll @@ -614,6 +603,5 @@ define double @"test2$double$.getValue"(double %0) entry: %blob = alloca %Blob, align 8 store double %0, ptr %blob, align 8 - %1 = getelementptr inbounds %Blob, ptr %blob, i32 0, i32 0 - %2 = load double, ptr %1, align 8 - ret double %2 + %1 = load double, ptr %blob, align 8 + ret double %1 diff --git a/test/test_suite/functions/test_regression_mingw.c3t b/test/test_suite/functions/test_regression_mingw.c3t index 492ae8325..cbf7aafab 100644 --- a/test/test_suite/functions/test_regression_mingw.c3t +++ b/test/test_suite/functions/test_regression_mingw.c3t @@ -238,7 +238,6 @@ fn Type getValue(Blob blob) %Blob = type { i32 } %Blob.0 = type { double } -%Foo2 = type { i32 } %Bobo = type { i16, float, i16, i16, float, i16 } %"int[]" = type { ptr, i64 } %LinkedList = type { %"any*", i64, ptr, ptr } @@ -296,37 +295,35 @@ $"$ct.test.MyEnum" = comdat any @.str.21 = private unnamed_addr constant [12 x i8] c"Foo is: %d\0A\00", align 1 @.str.22 = private unnamed_addr constant [9 x i8] c"Mutating\00", align 1 - +; Function Attrs: define void @test.Foo2.printme(ptr %0) #0 { entry: - %1 = getelementptr inbounds %Foo2, ptr %0, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - %3 = call i32 (ptr, ...) @printf(ptr @.str.21, i32 %2) + %1 = load i32, ptr %0, align 4 + %2 = call i32 (ptr, ...) @printf(ptr @.str.21, i32 %1) ret void } - +; Function Attrs: define i32 @test.Foo2.mutate(ptr %0) #0 { entry: %1 = call i32 (ptr, ...) @printf(ptr @.str.22) - %2 = getelementptr inbounds %Foo2, ptr %0, i32 0, i32 0 - %3 = load i32, ptr %2, align 4 - %add = add i32 %3, 1 - store i32 %add, ptr %2, align 4 + %2 = load i32, ptr %0, align 4 + %add = add i32 %2, 1 + store i32 %add, ptr %0, align 4 ret i32 %add } - +; Function Attrs: declare i32 @printf(ptr, ...) #0 - +; Function Attrs: define void @test.helloWorld() #0 { entry: %0 = call i32 (ptr, ...) @printf(ptr @.str) ret void } - +; Function Attrs: define i32 @test.test_static() #0 { entry: %0 = load i32, ptr @test_static.x, align 4 @@ -338,7 +335,7 @@ entry: ret i32 %3 } - +; Function Attrs: define i32 @test.helo(double %0, ptr align 4 %1) #0 { entry: %de = alloca [3 x i32], align 4 @@ -351,7 +348,7 @@ entry: ret i32 1 } - +; Function Attrs: define i32 @test.test1(i32 %0, i32 %1) #0 { entry: %a = alloca i32, align 4 @@ -371,45 +368,43 @@ if.exit: ; preds = %entry ret i32 %4 } - +; Function Attrs: define i32 @test.sum_us(ptr align 8 %0) #0 { entry: %sum = alloca i32, align 4 %indirectarg = alloca %"int[]", align 8 store i32 0, ptr %sum, align 4 - %1 = getelementptr inbounds %"int[]", ptr %0, i32 0, i32 1 - %2 = load i64, ptr %1, align 8 - %eq = icmp eq i64 0, %2 + %ptradd = getelementptr inbounds i8, ptr %0, i64 8 + %1 = load i64, ptr %ptradd, align 8 + %eq = icmp eq i64 0, %1 br i1 %eq, label %if.then, label %if.exit if.then: ; preds = %entry ret i32 0 if.exit: ; preds = %entry - %3 = load i32, ptr %sum, align 4 - %4 = getelementptr inbounds %"int[]", ptr %0, i32 0, i32 0 - %5 = load ptr, ptr %4, align 8 - %ptroffset = getelementptr inbounds i32, ptr %5, i64 0 - %6 = load i32, ptr %ptroffset, align 4 - %7 = load %"int[]", ptr %0, align 8 - %8 = extractvalue %"int[]" %7, 0 - %9 = extractvalue %"int[]" %7, 1 - %sub = sub i64 %9, 1 - %10 = add i64 %sub, 1 - %size = sub i64 %10, 1 - %ptroffset1 = getelementptr inbounds i32, ptr %8, i64 1 - %11 = insertvalue %"int[]" undef, ptr %ptroffset1, 0 - %12 = insertvalue %"int[]" %11, i64 %size, 1 - store %"int[]" %12, ptr %indirectarg, align 8 - %13 = call i32 @test.sum_us(ptr align 8 %indirectarg) - %add = add i32 %6, %13 - %add2 = add i32 %3, %add + %2 = load i32, ptr %sum, align 4 + %3 = load ptr, ptr %0, align 8 + %4 = load i32, ptr %3, align 4 + %5 = load %"int[]", ptr %0, align 8 + %6 = extractvalue %"int[]" %5, 0 + %7 = extractvalue %"int[]" %5, 1 + %sub = sub i64 %7, 1 + %8 = add i64 %sub, 1 + %size = sub i64 %8, 1 + %ptradd1 = getelementptr inbounds i8, ptr %6, i64 4 + %9 = insertvalue %"int[]" undef, ptr %ptradd1, 0 + %10 = insertvalue %"int[]" %9, i64 %size, 1 + store %"int[]" %10, ptr %indirectarg, align 8 + %11 = call i32 @test.sum_us(ptr align 8 %indirectarg) + %add = add i32 %4, %11 + %add2 = add i32 %2, %add store i32 %add2, ptr %sum, align 4 - %14 = load i32, ptr %sum, align 4 - ret i32 %14 + %12 = load i32, ptr %sum, align 4 + ret i32 %12 } - +; Function Attrs: define i32 @test.sumd(ptr align 8 %0) #0 { entry: %sum = alloca i32, align 4 @@ -421,34 +416,33 @@ entry: loop.cond: ; preds = %loop.body, %entry %1 = load i32, ptr %i, align 4 %sext = sext i32 %1 to i64 - %2 = getelementptr inbounds %"int[]", ptr %0, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - %lt = icmp slt i64 %sext, %3 - %check = icmp slt i64 %3, 0 + %ptradd = getelementptr inbounds i8, ptr %0, i64 8 + %2 = load i64, ptr %ptradd, align 8 + %lt = icmp slt i64 %sext, %2 + %check = icmp slt i64 %2, 0 %siui-lt = or i1 %check, %lt br i1 %siui-lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %4 = load i32, ptr %sum, align 4 - %5 = getelementptr inbounds %"int[]", ptr %0, i32 0, i32 0 - %6 = load ptr, ptr %5, align 8 - %7 = load i32, ptr %i, align 4 - %sext1 = sext i32 %7 to i64 - %ptroffset = getelementptr inbounds i32, ptr %6, i64 %sext1 - %8 = load i32, ptr %ptroffset, align 4 - %add = add i32 %4, %8 + %3 = load i32, ptr %sum, align 4 + %4 = load ptr, ptr %0, align 8 + %5 = load i32, ptr %i, align 4 + %sext1 = sext i32 %5 to i64 + %ptroffset = getelementptr inbounds [4 x i8], ptr %4, i64 %sext1 + %6 = load i32, ptr %ptroffset, align 4 + %add = add i32 %3, %6 store i32 %add, ptr %sum, align 4 - %9 = load i32, ptr %i, align 4 - %add2 = add i32 %9, 1 + %7 = load i32, ptr %i, align 4 + %add2 = add i32 %7, 1 store i32 %add2, ptr %i, align 4 br label %loop.cond loop.exit: ; preds = %loop.cond - %10 = load i32, ptr %sum, align 4 - ret i32 %10 + %8 = load i32, ptr %sum, align 4 + ret i32 %8 } - +; Function Attrs: define void @test.main() #0 { entry: %list = alloca %LinkedList, align 8 @@ -467,10 +461,10 @@ entry: %indirectarg10 = alloca %"int[]", align 8 %indirectarg11 = alloca %"int[]", align 8 %varargslots = alloca [4 x i32], align 16 - %indirectarg12 = alloca %"int[]", align 8 - %varargslots13 = alloca [1 x i32], align 4 %indirectarg15 = alloca %"int[]", align 8 - %indirectarg16 = alloca %"int[]", align 8 + %varargslots16 = alloca [1 x i32], align 4 + %indirectarg18 = alloca %"int[]", align 8 + %indirectarg19 = alloca %"int[]", align 8 %a1 = alloca ptr, align 8 %b2 = alloca ptr, align 8 %0 = call i32 @test.test_static() @@ -549,57 +543,54 @@ loop.exit8: ; preds = %loop.cond2 %27 = call double @"test2$double$.getMult"(double 3.300000e+00) %28 = call i32 (ptr, ...) @printf(ptr @.str.11, double %27) call void @test.helloWorld() - %29 = getelementptr inbounds %Foo, ptr %ddx, i32 0, i32 0 - store i32 0, ptr %29, align 4 - %30 = getelementptr inbounds %Foo, ptr %ddx, i32 0, i32 1 - store i32 0, ptr %30, align 4 + store i32 0, ptr %ddx, align 4 + %ptradd = getelementptr inbounds i8, ptr %ddx, i64 4 + store i32 0, ptr %ptradd, align 4 store i32 3, ptr %fro, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %x, ptr align 16 @.__const.12, i32 16, i1 false) - %31 = load i32, ptr %fro, align 4 - %32 = insertvalue %"int[]" undef, ptr %x, 0 - %33 = insertvalue %"int[]" %32, i64 4, 1 - store %"int[]" %33, ptr %indirectarg, align 8 - %34 = call i32 @test.sum_us(ptr align 8 %indirectarg) - %35 = call i32 (ptr, ...) @printf(ptr @.str.13, i32 %34) - %add9 = add i32 %31, %35 + %29 = load i32, ptr %fro, align 4 + %30 = insertvalue %"int[]" undef, ptr %x, 0 + %31 = insertvalue %"int[]" %30, i64 4, 1 + store %"int[]" %31, ptr %indirectarg, align 8 + %32 = call i32 @test.sum_us(ptr align 8 %indirectarg) + %33 = call i32 (ptr, ...) @printf(ptr @.str.13, i32 %32) + %add9 = add i32 %29, %33 store i32 %add9, ptr %fro, align 4 - %36 = load i32, ptr %fro, align 4 - %37 = call i32 (ptr, ...) @printf(ptr @.str.14, i32 %36) + %34 = load i32, ptr %fro, align 4 + %35 = call i32 (ptr, ...) @printf(ptr @.str.14, i32 %34) + %36 = insertvalue %"int[]" undef, ptr %x, 0 + %37 = insertvalue %"int[]" %36, i64 4, 1 + store %"int[]" %37, ptr %z, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %de, ptr align 4 @.__const.15, i32 12, i1 false) %38 = insertvalue %"int[]" undef, ptr %x, 0 %39 = insertvalue %"int[]" %38, i64 4, 1 - store %"int[]" %39, ptr %z, align 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %de, ptr align 4 @.__const.15, i32 12, i1 false) - %40 = insertvalue %"int[]" undef, ptr %x, 0 - %41 = insertvalue %"int[]" %40, i64 4, 1 - store %"int[]" %41, ptr %indirectarg10, align 8 - %42 = call i32 @test.sum_us(ptr align 8 %indirectarg10) - %43 = call i32 (ptr, ...) @printf(ptr @.str.16, i32 %42) + store %"int[]" %39, ptr %indirectarg10, align 8 + %40 = call i32 @test.sum_us(ptr align 8 %indirectarg10) + %41 = call i32 (ptr, ...) @printf(ptr @.str.16, i32 %40) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %indirectarg11, ptr align 8 %z, i32 16, i1 false) - %44 = call i32 @test.sum_us(ptr align 8 %indirectarg11) - %45 = call i32 (ptr, ...) @printf(ptr @.str.17, i32 %44) - %46 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 0 - store i32 1, ptr %46, align 4 - %47 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 1 - store i32 2, ptr %47, align 4 - %48 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 2 - store i32 4, ptr %48, align 4 - %49 = getelementptr inbounds [4 x i32], ptr %varargslots, i64 0, i64 3 - store i32 5, ptr %49, align 4 - %50 = insertvalue %"int[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"int[]" %50, i64 4, 1 - store %"int[]" %"$$temp", ptr %indirectarg12, align 8 - %51 = call i32 @test.sum_us(ptr align 8 %indirectarg12) - %52 = call i32 (ptr, ...) @printf(ptr @.str.18, i32 %51) - %53 = getelementptr inbounds [1 x i32], ptr %varargslots13, i64 0, i64 0 - store i32 1, ptr %53, align 4 - %54 = insertvalue %"int[]" undef, ptr %varargslots13, 0 - %"$$temp14" = insertvalue %"int[]" %54, i64 1, 1 - store %"int[]" %"$$temp14", ptr %indirectarg15, align 8 - %55 = call i32 @test.sum_us(ptr align 8 %indirectarg15) - %56 = call i32 (ptr, ...) @printf(ptr @.str.19, i32 %55) - store %"int[]" zeroinitializer, ptr %indirectarg16, align 8 - %57 = call i32 @test.sum_us(ptr align 8 %indirectarg16) - %58 = call i32 (ptr, ...) @printf(ptr @.str.20, i32 %57) + %42 = call i32 @test.sum_us(ptr align 8 %indirectarg11) + %43 = call i32 (ptr, ...) @printf(ptr @.str.17, i32 %42) + store i32 1, ptr %varargslots, align 4 + %ptradd12 = getelementptr inbounds i8, ptr %varargslots, i64 4 + store i32 2, ptr %ptradd12, align 4 + %ptradd13 = getelementptr inbounds i8, ptr %varargslots, i64 8 + store i32 4, ptr %ptradd13, align 4 + %ptradd14 = getelementptr inbounds i8, ptr %varargslots, i64 12 + store i32 5, ptr %ptradd14, align 4 + %44 = insertvalue %"int[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"int[]" %44, i64 4, 1 + store %"int[]" %"$$temp", ptr %indirectarg15, align 8 + %45 = call i32 @test.sum_us(ptr align 8 %indirectarg15) + %46 = call i32 (ptr, ...) @printf(ptr @.str.18, i32 %45) + store i32 1, ptr %varargslots16, align 4 + %47 = insertvalue %"int[]" undef, ptr %varargslots16, 0 + %"$$temp17" = insertvalue %"int[]" %47, i64 1, 1 + store %"int[]" %"$$temp17", ptr %indirectarg18, align 8 + %48 = call i32 @test.sum_us(ptr align 8 %indirectarg18) + %49 = call i32 (ptr, ...) @printf(ptr @.str.19, i32 %48) + store %"int[]" zeroinitializer, ptr %indirectarg19, align 8 + %50 = call i32 @test.sum_us(ptr align 8 %indirectarg19) + %51 = call i32 (ptr, ...) @printf(ptr @.str.20, i32 %50) store ptr null, ptr %a1, align 8 store ptr null, ptr %b2, align 8 ret void @@ -660,9 +651,8 @@ define i32 @"test2$int$.getValue"(i32 %0) entry: %blob = alloca %Blob, align 4 store i32 %0, ptr %blob, align 4 - %1 = getelementptr inbounds %Blob, ptr %blob, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - ret i32 %2 + %1 = load i32, ptr %blob, align 4 + ret i32 %1 // #expect: test2.double.ll @@ -684,7 +674,6 @@ define double @"test2$double$.getValue"(i64 %0) entry: %blob = alloca %Blob, align 8 store i64 %0, ptr %blob, align 8 - %1 = getelementptr inbounds %Blob, ptr %blob, i32 0, i32 0 - %2 = load double, ptr %1, align 8 - ret double %2 + %1 = load double, ptr %blob, align 8 + ret double %1 diff --git a/test/test_suite/functions/typeless_varargs.c3t b/test/test_suite/functions/typeless_varargs.c3t index 8f2f9eb96..43336607e 100644 --- a/test/test_suite/functions/typeless_varargs.c3t +++ b/test/test_suite/functions/typeless_varargs.c3t @@ -28,32 +28,30 @@ define void @test.retest(ptr %0, i64 %1) #0 { entry: %foo = alloca %"any*[]", align 8 store ptr %0, ptr %foo, align 8 - %ptroffset = getelementptr inbounds i64, ptr %foo, i64 1 - store i64 %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"any*[]", ptr %foo, i32 0, i32 0 - %lo = load ptr, ptr %2, align 8 - %3 = getelementptr inbounds %"any*[]", ptr %foo, i32 0, i32 1 - %hi = load i64, ptr %3, align 8 + %ptradd = getelementptr inbounds i8, ptr %foo, i64 8 + store i64 %1, ptr %ptradd, align 8 + %lo = load ptr, ptr %foo, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %foo, i64 8 + %hi = load i64, ptr %ptradd1, align 8 call void @test.test(ptr %lo, i64 %hi) ret void } +; Function Attrs: define void @test.test(ptr %0, i64 %1) #0 { entry: %foo = alloca %"any*[]", align 8 store ptr %0, ptr %foo, align 8 - %ptroffset = getelementptr inbounds i64, ptr %foo, i64 1 - store i64 %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"any*[]", ptr %foo, i32 0, i32 0 + %ptradd = getelementptr inbounds i8, ptr %foo, i64 8 + store i64 %1, ptr %ptradd, align 8 + %2 = load ptr, ptr %foo, align 8 %3 = load ptr, ptr %2, align 8 - %ptroffset1 = getelementptr inbounds %"any*", ptr %3, i64 0 - %4 = getelementptr inbounds %"any*", ptr %ptroffset1, i32 0, i32 0 - %5 = load ptr, ptr %4, align 8 - %6 = load i32, ptr %5, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %6) + %4 = load i32, ptr %3, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %4) ret void } +; Function Attrs: define i32 @main() #0 { entry: %i = alloca i32, align 4 @@ -65,14 +63,12 @@ entry: store i32 1, ptr %taddr, align 4 %0 = insertvalue %"any*" undef, ptr %taddr, 0 %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %2 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %1, ptr %2, align 16 + store %"any*" %1, ptr %varargslots, align 16 call void @test.test(ptr %varargslots, i64 1) store i32 1, ptr %taddr2, align 4 - %3 = insertvalue %"any*" undef, ptr %taddr2, 0 - %4 = insertvalue %"any*" %3, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %5 = getelementptr inbounds [1 x %"any*"], ptr %varargslots1, i64 0, i64 0 - store %"any*" %4, ptr %5, align 16 + %2 = insertvalue %"any*" undef, ptr %taddr2, 0 + %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %3, ptr %varargslots1, align 16 call void @test.retest(ptr %varargslots1, i64 1) ret i32 1 } \ No newline at end of file diff --git a/test/test_suite/functions/varargs_followed_by_named.c3t b/test/test_suite/functions/varargs_followed_by_named.c3t index 5c0a08456..7f3bc86aa 100644 --- a/test/test_suite/functions/varargs_followed_by_named.c3t +++ b/test/test_suite/functions/varargs_followed_by_named.c3t @@ -26,75 +26,69 @@ define void @foo.test(i32 %0, ptr %1, i64 %2, i32 %3) #0 { entry: %y = alloca %"int[]", align 8 store ptr %1, ptr %y, align 8 - %ptroffset = getelementptr inbounds i64, ptr %y, i64 1 - store i64 %2, ptr %ptroffset, align 8 - %4 = getelementptr inbounds %"int[]", ptr %y, i32 0, i32 1 - %5 = load i64, ptr %4, align 8 - %trunc = trunc i64 %5 to i32 - %6 = getelementptr inbounds %"int[]", ptr %y, i32 0, i32 0 - %7 = load ptr, ptr %6, align 8 - %ptroffset1 = getelementptr inbounds i32, ptr %7, i64 0 - %8 = load i32, ptr %ptroffset1, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %0, i32 %trunc, i32 %3, i32 %8) + %ptradd = getelementptr inbounds i8, ptr %y, i64 8 + store i64 %2, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 8 + %4 = load i64, ptr %ptradd1, align 8 + %trunc = trunc i64 %4 to i32 + %5 = load ptr, ptr %y, align 8 + %6 = load i32, ptr %5, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %0, i32 %trunc, i32 %3, i32 %6) ret void } - +; Function Attrs: define void @foo.test2(i32 %0, ptr %1, i64 %2, i32 %3) #0 { entry: %y = alloca %"any*[]", align 8 store ptr %1, ptr %y, align 8 - %ptroffset = getelementptr inbounds i64, ptr %y, i64 1 - store i64 %2, ptr %ptroffset, align 8 - %4 = getelementptr inbounds %"any*[]", ptr %y, i32 0, i32 1 - %5 = load i64, ptr %4, align 8 - %trunc = trunc i64 %5 to i32 + %ptradd = getelementptr inbounds i8, ptr %y, i64 8 + store i64 %2, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 8 + %4 = load i64, ptr %ptradd1, align 8 + %trunc = trunc i64 %4 to i32 call void (ptr, ...) @printf(ptr @.str.1, i32 %0, i32 %trunc, i32 %3) ret void } - +; Function Attrs: define void @foo.main() #0 { entry: %varargslots = alloca [2 x i32], align 4 %varargslots1 = alloca [2 x %"any*"], align 16 %taddr = alloca i32, align 4 %taddr2 = alloca i32, align 4 - %varargslots3 = alloca [2 x i32], align 4 - %varargslots4 = alloca [2 x %"any*"], align 16 - %taddr5 = alloca i32, align 4 - %taddr6 = alloca i32, align 4 - %0 = getelementptr inbounds [2 x i32], ptr %varargslots, i64 0, i64 0 - store i32 4, ptr %0, align 4 - %1 = getelementptr inbounds [2 x i32], ptr %varargslots, i64 0, i64 1 - store i32 5, ptr %1, align 4 + %varargslots4 = alloca [2 x i32], align 4 + %varargslots6 = alloca [2 x %"any*"], align 16 + %taddr7 = alloca i32, align 4 + %taddr8 = alloca i32, align 4 + store i32 4, ptr %varargslots, align 4 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 4 + store i32 5, ptr %ptradd, align 4 call void @foo.test(i32 3, ptr %varargslots, i64 2, i32 123) store i32 4, ptr %taddr, align 4 - %2 = insertvalue %"any*" undef, ptr %taddr, 0 - %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %4 = getelementptr inbounds [2 x %"any*"], ptr %varargslots1, i64 0, i64 0 - store %"any*" %3, ptr %4, align 16 + %0 = insertvalue %"any*" undef, ptr %taddr, 0 + %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %1, ptr %varargslots1, align 16 store i32 5, ptr %taddr2, align 4 - %5 = insertvalue %"any*" undef, ptr %taddr2, 0 - %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %7 = getelementptr inbounds [2 x %"any*"], ptr %varargslots1, i64 0, i64 1 - store %"any*" %6, ptr %7, align 16 + %2 = insertvalue %"any*" undef, ptr %taddr2, 0 + %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd3 = getelementptr inbounds i8, ptr %varargslots1, i64 16 + store %"any*" %3, ptr %ptradd3, align 16 call void @foo.test2(i32 3, ptr %varargslots1, i64 2, i32 123) - %8 = getelementptr inbounds [2 x i32], ptr %varargslots3, i64 0, i64 0 - store i32 4, ptr %8, align 4 - %9 = getelementptr inbounds [2 x i32], ptr %varargslots3, i64 0, i64 1 - store i32 5, ptr %9, align 4 - call void @foo.test(i32 3, ptr %varargslots3, i64 2, i32 2) - store i32 4, ptr %taddr5, align 4 - %10 = insertvalue %"any*" undef, ptr %taddr5, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %12 = getelementptr inbounds [2 x %"any*"], ptr %varargslots4, i64 0, i64 0 - store %"any*" %11, ptr %12, align 16 - store i32 5, ptr %taddr6, align 4 - %13 = insertvalue %"any*" undef, ptr %taddr6, 0 - %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %15 = getelementptr inbounds [2 x %"any*"], ptr %varargslots4, i64 0, i64 1 - store %"any*" %14, ptr %15, align 16 - call void @foo.test2(i32 3, ptr %varargslots4, i64 2, i32 2) + store i32 4, ptr %varargslots4, align 4 + %ptradd5 = getelementptr inbounds i8, ptr %varargslots4, i64 4 + store i32 5, ptr %ptradd5, align 4 + call void @foo.test(i32 3, ptr %varargslots4, i64 2, i32 2) + store i32 4, ptr %taddr7, align 4 + %4 = insertvalue %"any*" undef, ptr %taddr7, 0 + %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %5, ptr %varargslots6, align 16 + store i32 5, ptr %taddr8, align 4 + %6 = insertvalue %"any*" undef, ptr %taddr8, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd9 = getelementptr inbounds i8, ptr %varargslots6, i64 16 + store %"any*" %7, ptr %ptradd9, align 16 + call void @foo.test2(i32 3, ptr %varargslots6, i64 2, i32 2) ret void } \ No newline at end of file diff --git a/test/test_suite/generic/enum_set_test.c3t b/test/test_suite/generic/enum_set_test.c3t index 634f7a299..826446eef 100644 --- a/test/test_suite/generic/enum_set_test.c3t +++ b/test/test_suite/generic/enum_set_test.c3t @@ -51,43 +51,38 @@ entry: store i8 %0, ptr %taddr, align 1 %1 = insertvalue %"any*" undef, ptr %taddr, 0 %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %3 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %2, ptr %3, align 16 - %4 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 14, ptr %varargslots, i64 1) + store %"any*" %2, ptr %varargslots, align 16 + %3 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 14, ptr %varargslots, i64 1) call void @"std.collections.enumset$test.Abc$.EnumSet.add"(ptr %set, i32 0) - %5 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1) - store i8 %5, ptr %taddr2, align 1 - %6 = insertvalue %"any*" undef, ptr %taddr2, 0 - %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %8 = getelementptr inbounds [1 x %"any*"], ptr %varargslots1, i64 0, i64 0 - store %"any*" %7, ptr %8, align 16 - %9 = call i64 @std.io.printf(ptr %retparam3, ptr @.str.1, i64 14, ptr %varargslots1, i64 1) + %4 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1) + store i8 %4, ptr %taddr2, align 1 + %5 = insertvalue %"any*" undef, ptr %taddr2, 0 + %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %6, ptr %varargslots1, align 16 + %7 = call i64 @std.io.printf(ptr %retparam3, ptr @.str.1, i64 14, ptr %varargslots1, i64 1) call void @"std.collections.enumset$test.Abc$.EnumSet.add"(ptr %set, i32 1) - %10 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1) - store i8 %10, ptr %taddr5, align 1 - %11 = insertvalue %"any*" undef, ptr %taddr5, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %13 = getelementptr inbounds [1 x %"any*"], ptr %varargslots4, i64 0, i64 0 - store %"any*" %12, ptr %13, align 16 - %14 = call i64 @std.io.printf(ptr %retparam6, ptr @.str.2, i64 14, ptr %varargslots4, i64 1) + %8 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1) + store i8 %8, ptr %taddr5, align 1 + %9 = insertvalue %"any*" undef, ptr %taddr5, 0 + %10 = insertvalue %"any*" %9, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %10, ptr %varargslots4, align 16 + %11 = call i64 @std.io.printf(ptr %retparam6, ptr @.str.2, i64 14, ptr %varargslots4, i64 1) store i32 0, ptr %set2, align 4 - %15 = load i32, ptr %set, align 4 - call void @"std.collections.enumset$test.Abc$.EnumSet.add_all"(ptr %set2, i32 %15) - %16 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set2, i32 1) - store i8 %16, ptr %taddr8, align 1 - %17 = insertvalue %"any*" undef, ptr %taddr8, 0 - %18 = insertvalue %"any*" %17, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %19 = getelementptr inbounds [1 x %"any*"], ptr %varargslots7, i64 0, i64 0 - store %"any*" %18, ptr %19, align 16 - %20 = call i64 @std.io.printf(ptr %retparam9, ptr @.str.3, i64 14, ptr %varargslots7, i64 1) - %21 = load i32, ptr %set2, align 4 - call void @"std.collections.enumset$test.Abc$.EnumSet.remove_all"(ptr %set, i32 %21) - %22 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1) - store i8 %22, ptr %taddr11, align 1 - %23 = insertvalue %"any*" undef, ptr %taddr11, 0 - %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %25 = getelementptr inbounds [1 x %"any*"], ptr %varargslots10, i64 0, i64 0 - store %"any*" %24, ptr %25, align 16 - %26 = call i64 @std.io.printf(ptr %retparam12, ptr @.str.4, i64 14, ptr %varargslots10, i64 1) + %12 = load i32, ptr %set, align 4 + call void @"std.collections.enumset$test.Abc$.EnumSet.add_all"(ptr %set2, i32 %12) + %13 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set2, i32 1) + store i8 %13, ptr %taddr8, align 1 + %14 = insertvalue %"any*" undef, ptr %taddr8, 0 + %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %15, ptr %varargslots7, align 16 + %16 = call i64 @std.io.printf(ptr %retparam9, ptr @.str.3, i64 14, ptr %varargslots7, i64 1) + %17 = load i32, ptr %set2, align 4 + call void @"std.collections.enumset$test.Abc$.EnumSet.remove_all"(ptr %set, i32 %17) + %18 = call i8 @"std.collections.enumset$test.Abc$.EnumSet.has"(ptr %set, i32 1) + store i8 %18, ptr %taddr11, align 1 + %19 = insertvalue %"any*" undef, ptr %taddr11, 0 + %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %20, ptr %varargslots10, align 16 + %21 = call i64 @std.io.printf(ptr %retparam12, ptr @.str.4, i64 14, ptr %varargslots10, i64 1) ret void } diff --git a/test/test_suite/generic/generic_lambda_complex.c3t b/test/test_suite/generic/generic_lambda_complex.c3t index f01c54aa1..781f4363c 100644 --- a/test/test_suite/generic/generic_lambda_complex.c3t +++ b/test/test_suite/generic/generic_lambda_complex.c3t @@ -195,48 +195,46 @@ if.exit: ; preds = %if.then, %entry %1 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 %2 = insertvalue %"any*" undef, ptr %1, 0 %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.std.core.mem.allocator.TempAllocator" to i64), 1 - %4 = getelementptr inbounds %"char[]", ptr %foo_tmpl, i32 0, i32 0 - %lo = load ptr, ptr %4, align 8 - %5 = getelementptr inbounds %"char[]", ptr %foo_tmpl, i32 0, i32 1 - %hi = load i64, ptr %5, align 8 + %lo = load ptr, ptr %foo_tmpl, align 8 + %ptradd = getelementptr inbounds i8, ptr %foo_tmpl, i64 8 + %hi = load i64, ptr %ptradd, align 8 store %"char[]" { ptr @.str.2, i64 2 }, ptr %indirectarg, align 8 store %"any*" %3, ptr %indirectarg1, align 8 - %6 = call i64 @"abc$text_test.Foo$.TextTemplate.init"(ptr %ft, ptr %lo, i64 %hi, ptr @.str.1, i64 2, ptr byval(%"char[]") align 8 %indirectarg, ptr byval(%"any*") align 8 %indirectarg1) - %not_err = icmp eq i64 %6, 0 - %7 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %7, label %after_check, label %assign_optional + %4 = call i64 @"abc$text_test.Foo$.TextTemplate.init"(ptr %ft, ptr %lo, i64 %hi, ptr @.str.1, i64 2, ptr byval(%"char[]") align 8 %indirectarg, ptr byval(%"any*") align 8 %indirectarg1) + %not_err = icmp eq i64 %4, 0 + %5 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %5, label %after_check, label %assign_optional assign_optional: ; preds = %if.exit - store i64 %6, ptr %error_var, align 8 + store i64 %4, ptr %error_var, align 8 br label %guard_block after_check: ; preds = %if.exit br label %noerr_block guard_block: ; preds = %assign_optional - %8 = load i64, ptr %error_var, align 8 - ret i64 %8 + %6 = load i64, ptr %error_var, align 8 + ret i64 %6 noerr_block: ; preds = %after_check - %9 = call i64 @"abc$text_test.Foo$.TextTemplate.free"(ptr %ft) - %not_err3 = icmp eq i64 %9, 0 - %10 = call i1 @llvm.expect.i1(i1 %not_err3, i1 true) - br i1 %10, label %after_check5, label %assign_optional4 + %7 = call i64 @"abc$text_test.Foo$.TextTemplate.free"(ptr %ft) + %not_err3 = icmp eq i64 %7, 0 + %8 = call i1 @llvm.expect.i1(i1 %not_err3, i1 true) + br i1 %8, label %after_check5, label %assign_optional4 assign_optional4: ; preds = %noerr_block - store i64 %9, ptr %error_var2, align 8 + store i64 %7, ptr %error_var2, align 8 br label %panic_block after_check5: ; preds = %noerr_block br label %noerr_block7 panic_block: ; preds = %assign_optional4 - %11 = insertvalue %"any*" undef, ptr %error_var2, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %13 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %12, ptr %13, align 16 - %14 = insertvalue %"any*[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"any*[]" %14, i64 1, 1 + %9 = insertvalue %"any*" undef, ptr %error_var2, 0 + %10 = insertvalue %"any*" %9, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 + store %"any*" %10, ptr %varargslots, align 16 + %11 = insertvalue %"any*[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"any*[]" %11, i64 1, 1 store %"any*[]" %"$$temp", ptr %indirectarg6, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 36, ptr @.file, i64 25 unreachable diff --git a/test/test_suite/generic/generic_num.c3t b/test/test_suite/generic/generic_num.c3t index b9cf2c45e..c4e436130 100644 --- a/test/test_suite/generic/generic_num.c3t +++ b/test/test_suite/generic/generic_num.c3t @@ -28,9 +28,8 @@ entry: store i32 %0, ptr %taddr, align 4 %1 = insertvalue %"any*" undef, ptr %taddr, 0 %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %3 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %2, ptr %3, align 16 - %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) + store %"any*" %2, ptr %varargslots, align 16 + %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) ret void } diff --git a/test/test_suite/generic/generic_over_fn.c3t b/test/test_suite/generic/generic_over_fn.c3t index ce110b7c6..e4a86c5b9 100644 --- a/test/test_suite/generic/generic_over_fn.c3t +++ b/test/test_suite/generic/generic_over_fn.c3t @@ -63,148 +63,142 @@ entry: %tcases = alloca %"int[][]", align 8 %literal = alloca [5 x %"int[]"], align 16 %literal1 = alloca [2 x i32], align 4 - %literal2 = alloca [3 x i32], align 4 %literal3 = alloca [3 x i32], align 4 - %literal4 = alloca [3 x i32], align 4 + %literal5 = alloca [3 x i32], align 4 + %literal7 = alloca [3 x i32], align 4 %.anon = alloca i64, align 8 - %.anon5 = alloca i64, align 8 + %.anon9 = alloca i64, align 8 %tc = alloca %"int[]", align 8 %list = alloca %"int[]", align 8 %len = alloca i64, align 8 - %0 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 0 - store %"int[]" zeroinitializer, ptr %0, align 8 - %1 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 1 + store %"int[]" zeroinitializer, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 16 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const, i32 8, i1 false) - %2 = insertvalue %"int[]" undef, ptr %literal1, 0 - %3 = insertvalue %"int[]" %2, i64 2, 1 - store %"int[]" %3, ptr %1, align 8 - %4 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 2 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal2, ptr align 4 @.__const.1, i32 12, i1 false) - %5 = insertvalue %"int[]" undef, ptr %literal2, 0 - %6 = insertvalue %"int[]" %5, i64 3, 1 - store %"int[]" %6, ptr %4, align 8 - %7 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 3 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.2, i32 12, i1 false) - %8 = insertvalue %"int[]" undef, ptr %literal3, 0 - %9 = insertvalue %"int[]" %8, i64 3, 1 - store %"int[]" %9, ptr %7, align 8 - %10 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 4 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const.3, i32 12, i1 false) - %11 = insertvalue %"int[]" undef, ptr %literal4, 0 - %12 = insertvalue %"int[]" %11, i64 3, 1 - store %"int[]" %12, ptr %10, align 8 - %13 = insertvalue %"int[][]" undef, ptr %literal, 0 - %14 = insertvalue %"int[][]" %13, i64 5, 1 - store %"int[][]" %14, ptr %tcases, align 8 - %15 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 1 - %16 = load i64, ptr %15, align 8 - store i64 %16, ptr %.anon, align 8 - store i64 0, ptr %.anon5, align 8 + %0 = insertvalue %"int[]" undef, ptr %literal1, 0 + %1 = insertvalue %"int[]" %0, i64 2, 1 + store %"int[]" %1, ptr %ptradd, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i64 32 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.1, i32 12, i1 false) + %2 = insertvalue %"int[]" undef, ptr %literal3, 0 + %3 = insertvalue %"int[]" %2, i64 3, 1 + store %"int[]" %3, ptr %ptradd2, align 8 + %ptradd4 = getelementptr inbounds i8, ptr %literal, i64 48 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal5, ptr align 4 @.__const.2, i32 12, i1 false) + %4 = insertvalue %"int[]" undef, ptr %literal5, 0 + %5 = insertvalue %"int[]" %4, i64 3, 1 + store %"int[]" %5, ptr %ptradd4, align 8 + %ptradd6 = getelementptr inbounds i8, ptr %literal, i64 64 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal7, ptr align 4 @.__const.3, i32 12, i1 false) + %6 = insertvalue %"int[]" undef, ptr %literal7, 0 + %7 = insertvalue %"int[]" %6, i64 3, 1 + store %"int[]" %7, ptr %ptradd6, align 8 + %8 = insertvalue %"int[][]" undef, ptr %literal, 0 + %9 = insertvalue %"int[][]" %8, i64 5, 1 + store %"int[][]" %9, ptr %tcases, align 8 + %ptradd8 = getelementptr inbounds i8, ptr %tcases, i64 8 + %10 = load i64, ptr %ptradd8, align 8 + store i64 %10, ptr %.anon, align 8 + store i64 0, ptr %.anon9, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %17 = load i64, ptr %.anon5, align 8 - %18 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %17, %18 + %11 = load i64, ptr %.anon9, align 8 + %12 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %11, %12 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %19 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 0 - %20 = load ptr, ptr %19, align 8 - %21 = load i64, ptr %.anon5, align 8 - %ptroffset = getelementptr inbounds %"int[]", ptr %20, i64 %21 + %13 = load ptr, ptr %tcases, align 8 + %14 = load i64, ptr %.anon9, align 8 + %ptroffset = getelementptr inbounds [16 x i8], ptr %13, i64 %14 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tc, ptr align 8 %ptroffset, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %list, ptr align 8 %tc, i32 16, i1 false) - %22 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 - %23 = load i64, ptr %22, align 8 - store i64 %23, ptr %len, align 8 - %24 = load i64, ptr %len, align 8 - %sub = sub i64 %24, 1 - %25 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 0 - %lo = load ptr, ptr %25, align 8 - %26 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 - %hi = load i64, ptr %26, align 8 + %ptradd10 = getelementptr inbounds i8, ptr %list, i64 8 + %15 = load i64, ptr %ptradd10, align 8 + store i64 %15, ptr %len, align 8 + %16 = load i64, ptr %len, align 8 + %sub = sub i64 %16, 1 + %lo = load ptr, ptr %list, align 8 + %ptradd11 = getelementptr inbounds i8, ptr %list, i64 8 + %hi = load i64, ptr %ptradd11, align 8 call void @"test_generic$sa$int$p$fn$int$int$$int$$.sort"(ptr %lo, i64 %hi, i64 0, i64 %sub, ptr @sort_test.cmp_int_value) - %27 = load i64, ptr %.anon5, align 8 - %add = add i64 %27, 1 - store i64 %add, ptr %.anon5, align 8 + %17 = load i64, ptr %.anon9, align 8 + %add = add i64 %17, 1 + store i64 %add, ptr %.anon9, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond ret void } - +; Function Attrs: define void @sort_test.quicksort_with_value2() #0 { entry: %tcases = alloca %"int[][]", align 8 %literal = alloca [5 x %"int[]"], align 16 %literal1 = alloca [2 x i32], align 4 - %literal2 = alloca [3 x i32], align 4 %literal3 = alloca [3 x i32], align 4 - %literal4 = alloca [3 x i32], align 4 + %literal5 = alloca [3 x i32], align 4 + %literal7 = alloca [3 x i32], align 4 %.anon = alloca i64, align 8 - %.anon5 = alloca i64, align 8 + %.anon9 = alloca i64, align 8 %tc = alloca %"int[]", align 8 %list = alloca %"int[]", align 8 %len = alloca i64, align 8 - %0 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 0 - store %"int[]" zeroinitializer, ptr %0, align 8 - %1 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 1 + store %"int[]" zeroinitializer, ptr %literal, align 8 + %ptradd = getelementptr inbounds i8, ptr %literal, i64 16 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal1, ptr align 4 @.__const.4, i32 8, i1 false) - %2 = insertvalue %"int[]" undef, ptr %literal1, 0 - %3 = insertvalue %"int[]" %2, i64 2, 1 - store %"int[]" %3, ptr %1, align 8 - %4 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 2 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal2, ptr align 4 @.__const.5, i32 12, i1 false) - %5 = insertvalue %"int[]" undef, ptr %literal2, 0 - %6 = insertvalue %"int[]" %5, i64 3, 1 - store %"int[]" %6, ptr %4, align 8 - %7 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 3 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.6, i32 12, i1 false) - %8 = insertvalue %"int[]" undef, ptr %literal3, 0 - %9 = insertvalue %"int[]" %8, i64 3, 1 - store %"int[]" %9, ptr %7, align 8 - %10 = getelementptr inbounds [5 x %"int[]"], ptr %literal, i64 0, i64 4 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const.7, i32 12, i1 false) - %11 = insertvalue %"int[]" undef, ptr %literal4, 0 - %12 = insertvalue %"int[]" %11, i64 3, 1 - store %"int[]" %12, ptr %10, align 8 - %13 = insertvalue %"int[][]" undef, ptr %literal, 0 - %14 = insertvalue %"int[][]" %13, i64 5, 1 - store %"int[][]" %14, ptr %tcases, align 8 - %15 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 1 - %16 = load i64, ptr %15, align 8 - store i64 %16, ptr %.anon, align 8 - store i64 0, ptr %.anon5, align 8 + %0 = insertvalue %"int[]" undef, ptr %literal1, 0 + %1 = insertvalue %"int[]" %0, i64 2, 1 + store %"int[]" %1, ptr %ptradd, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i64 32 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal3, ptr align 4 @.__const.5, i32 12, i1 false) + %2 = insertvalue %"int[]" undef, ptr %literal3, 0 + %3 = insertvalue %"int[]" %2, i64 3, 1 + store %"int[]" %3, ptr %ptradd2, align 8 + %ptradd4 = getelementptr inbounds i8, ptr %literal, i64 48 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal5, ptr align 4 @.__const.6, i32 12, i1 false) + %4 = insertvalue %"int[]" undef, ptr %literal5, 0 + %5 = insertvalue %"int[]" %4, i64 3, 1 + store %"int[]" %5, ptr %ptradd4, align 8 + %ptradd6 = getelementptr inbounds i8, ptr %literal, i64 64 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal7, ptr align 4 @.__const.7, i32 12, i1 false) + %6 = insertvalue %"int[]" undef, ptr %literal7, 0 + %7 = insertvalue %"int[]" %6, i64 3, 1 + store %"int[]" %7, ptr %ptradd6, align 8 + %8 = insertvalue %"int[][]" undef, ptr %literal, 0 + %9 = insertvalue %"int[][]" %8, i64 5, 1 + store %"int[][]" %9, ptr %tcases, align 8 + %ptradd8 = getelementptr inbounds i8, ptr %tcases, i64 8 + %10 = load i64, ptr %ptradd8, align 8 + store i64 %10, ptr %.anon, align 8 + store i64 0, ptr %.anon9, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %17 = load i64, ptr %.anon5, align 8 - %18 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %17, %18 + %11 = load i64, ptr %.anon9, align 8 + %12 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %11, %12 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %19 = getelementptr inbounds %"int[][]", ptr %tcases, i32 0, i32 0 - %20 = load ptr, ptr %19, align 8 - %21 = load i64, ptr %.anon5, align 8 - %ptroffset = getelementptr inbounds %"int[]", ptr %20, i64 %21 + %13 = load ptr, ptr %tcases, align 8 + %14 = load i64, ptr %.anon9, align 8 + %ptroffset = getelementptr inbounds [16 x i8], ptr %13, i64 %14 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tc, ptr align 8 %ptroffset, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %list, ptr align 8 %tc, i32 16, i1 false) - %22 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 - %23 = load i64, ptr %22, align 8 - store i64 %23, ptr %len, align 8 - %24 = load i64, ptr %len, align 8 - %sub = sub i64 %24, 1 - %25 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 0 - %lo = load ptr, ptr %25, align 8 - %26 = getelementptr inbounds %"int[]", ptr %list, i32 0, i32 1 - %hi = load i64, ptr %26, align 8 + %ptradd10 = getelementptr inbounds i8, ptr %list, i64 8 + %15 = load i64, ptr %ptradd10, align 8 + store i64 %15, ptr %len, align 8 + %16 = load i64, ptr %len, align 8 + %sub = sub i64 %16, 1 + %lo = load ptr, ptr %list, align 8 + %ptradd11 = getelementptr inbounds i8, ptr %list, i64 8 + %hi = load i64, ptr %ptradd11, align 8 call void @"test_generic$sa$int$p$fn$int$int$$int$$.sort"(ptr %lo, i64 %hi, i64 0, i64 %sub, ptr @sort_test.cmp_int_value2) - %27 = load i64, ptr %.anon5, align 8 - %add = add i64 %27, 1 - store i64 %add, ptr %.anon5, align 8 + %17 = load i64, ptr %.anon9, align 8 + %add = add i64 %17, 1 + store i64 %add, ptr %.anon9, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond diff --git a/test/test_suite/generic/implicit_import_of_generic.c3 b/test/test_suite/generic/implicit_import_of_generic.c3 new file mode 100644 index 000000000..d87cc2342 --- /dev/null +++ b/test/test_suite/generic/implicit_import_of_generic.c3 @@ -0,0 +1,18 @@ +module test; +import std::io; + +import abc; +def Def2 = Def; +def Test = abc::cde::Abc(); + +module abc; + +fn void test() {} + +module abc::foo; + +struct Def { int x; } + +module abc::cde(); + +struct Abc { Type a, b; } \ No newline at end of file diff --git a/test/test_suite/globals/ext_global_init.c3 b/test/test_suite/globals/ext_global_init.c3 new file mode 100644 index 000000000..446fe0050 --- /dev/null +++ b/test/test_suite/globals/ext_global_init.c3 @@ -0,0 +1 @@ +extern int a = 1; // #error: Extern globals may not have initializers \ No newline at end of file diff --git a/test/test_suite/globals/extern_const.c3t b/test/test_suite/globals/extern_const.c3t new file mode 100644 index 000000000..be086957a --- /dev/null +++ b/test/test_suite/globals/extern_const.c3t @@ -0,0 +1,16 @@ +module test; + +extern const int FOO @extern("foo1"); +fn int main() +{ + return FOO; +} + +module bar; +const int FOO @export("foo1") = 123; + + + +/* #expect: bar.ll + +@foo1 = local_unnamed_addr constant i32 123, align 4 \ No newline at end of file diff --git a/test/test_suite/globals/external_global.c3t b/test/test_suite/globals/external_global.c3t index 358c132e1..ba3a6a060 100644 --- a/test/test_suite/globals/external_global.c3t +++ b/test/test_suite/globals/external_global.c3t @@ -30,6 +30,6 @@ fn int extract_or_test_files() @g = external global %UzGlobs, align 8 entry: - store ptr getelementptr inbounds (%UzGlobs, ptr @g, i32 0, i32 1), ptr getelementptr inbounds (%UzGlobs, ptr @g, i32 0, i32 2), align 8 + store ptr getelementptr inbounds (i8, ptr @g, i64 8), ptr getelementptr inbounds (i8, ptr @g, i64 24), align 8 ret i32 0 } diff --git a/test/test_suite/initializer_lists/fasta.c3t b/test/test_suite/initializer_lists/fasta.c3t index b866bceb6..e5985deff 100644 --- a/test/test_suite/initializer_lists/fasta.c3t +++ b/test/test_suite/initializer_lists/fasta.c3t @@ -131,7 +131,7 @@ fn int main(int argc, char **argv) @.str.15 = private unnamed_addr constant [26 x i8] c">TWO IUB ambiguity codes\0A\00", align 1 @.str.16 = private unnamed_addr constant [31 x i8] c">THREE Homo sapiens frequency\0A\00", align 1 - +; Function Attrs: define float @fasta.fasta_rand(float %0) #0 { entry: %1 = load i32, ptr @fasta.seed, align 4 @@ -146,49 +146,48 @@ entry: ret float %fdiv } - +; Function Attrs: declare i32 @atoi(ptr) #0 - +; Function Attrs: declare i32 @printf(ptr, ...) #0 - +; Function Attrs: declare void @putchar(i32) #0 - +; Function Attrs: define void @fasta.repeat_fasta(ptr %0, i64 %1, i32 %2) #0 { entry: %seq = alloca %"char[]", align 8 %len = alloca i64, align 8 %i = alloca i32, align 4 store ptr %0, ptr %seq, align 8 - %ptroffset = getelementptr inbounds i64, ptr %seq, i64 1 - store i64 %1, ptr %ptroffset, align 8 - %3 = getelementptr inbounds %"char[]", ptr %seq, i32 0, i32 1 - %4 = load i64, ptr %3, align 8 - store i64 %4, ptr %len, align 8 + %ptradd = getelementptr inbounds i8, ptr %seq, i64 8 + store i64 %1, ptr %ptradd, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %seq, i64 8 + %3 = load i64, ptr %ptradd1, align 8 + store i64 %3, ptr %len, align 8 store i32 0, ptr %i, align 4 br label %loop.cond loop.cond: ; preds = %if.exit, %entry - %5 = load i32, ptr %i, align 4 - %lt = icmp slt i32 %5, %2 + %4 = load i32, ptr %i, align 4 + %lt = icmp slt i32 %4, %2 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %6 = getelementptr inbounds %"char[]", ptr %seq, i32 0, i32 0 - %7 = load ptr, ptr %6, align 8 - %8 = load i32, ptr %i, align 4 - %sext = sext i32 %8 to i64 - %9 = load i64, ptr %len, align 8 - %smod = srem i64 %sext, %9 - %ptroffset1 = getelementptr inbounds i8, ptr %7, i64 %smod - %10 = load i8, ptr %ptroffset1, align 1 - %zext = zext i8 %10 to i32 + %5 = load ptr, ptr %seq, align 8 + %6 = load i32, ptr %i, align 4 + %sext = sext i32 %6 to i64 + %7 = load i64, ptr %len, align 8 + %smod = srem i64 %sext, %7 + %ptradd2 = getelementptr inbounds i8, ptr %5, i64 %smod + %8 = load i8, ptr %ptradd2, align 1 + %zext = zext i8 %8 to i32 call void @putchar(i32 %zext) - %11 = load i32, ptr %i, align 4 - %smod2 = srem i32 %11, 60 - %eq = icmp eq i32 %smod2, 59 + %9 = load i32, ptr %i, align 4 + %smod3 = srem i32 %9, 60 + %eq = icmp eq i32 %smod3, 59 br i1 %eq, label %if.then, label %if.exit if.then: ; preds = %loop.body @@ -196,26 +195,26 @@ if.then: ; preds = %loop.body br label %if.exit if.exit: ; preds = %if.then, %loop.body - %12 = load i32, ptr %i, align 4 - %add = add i32 %12, 1 + %10 = load i32, ptr %i, align 4 + %add = add i32 %10, 1 store i32 %add, ptr %i, align 4 br label %loop.cond loop.exit: ; preds = %loop.cond - %13 = load i32, ptr %i, align 4 - %smod3 = srem i32 %13, 60 - %neq = icmp ne i32 %smod3, 0 - br i1 %neq, label %if.then4, label %if.exit5 + %11 = load i32, ptr %i, align 4 + %smod4 = srem i32 %11, 60 + %neq = icmp ne i32 %smod4, 0 + br i1 %neq, label %if.then5, label %if.exit6 -if.then4: ; preds = %loop.exit +if.then5: ; preds = %loop.exit call void @putchar(i32 10) - br label %if.exit5 + br label %if.exit6 -if.exit5: ; preds = %if.then4, %loop.exit +if.exit6: ; preds = %if.then5, %loop.exit ret void } - +; Function Attrs: define void @fasta.random_fasta(ptr %0, i64 %1, ptr %2, i64 %3, i32 %4) #0 { entry: %symb = alloca %"char[]", align 8 @@ -225,105 +224,103 @@ entry: %v = alloca double, align 8 %j = alloca i32, align 4 store ptr %0, ptr %symb, align 8 - %ptroffset = getelementptr inbounds i64, ptr %symb, i64 1 - store i64 %1, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %symb, i64 8 + store i64 %1, ptr %ptradd, align 8 store ptr %2, ptr %probability, align 8 - %ptroffset1 = getelementptr inbounds i64, ptr %probability, i64 1 - store i64 %3, ptr %ptroffset1, align 8 - %5 = getelementptr inbounds %"char[]", ptr %symb, i32 0, i32 1 - %6 = load i64, ptr %5, align 8 - %7 = getelementptr inbounds %"double[]", ptr %probability, i32 0, i32 1 - %8 = load i64, ptr %7, align 8 - %eq = icmp eq i64 %6, %8 + %ptradd1 = getelementptr inbounds i8, ptr %probability, i64 8 + store i64 %3, ptr %ptradd1, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %symb, i64 8 + %5 = load i64, ptr %ptradd2, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %probability, i64 8 + %6 = load i64, ptr %ptradd3, align 8 + %eq = icmp eq i64 %5, %6 call void @llvm.assume(i1 %eq) - %9 = getelementptr inbounds %"double[]", ptr %probability, i32 0, i32 1 - %10 = load i64, ptr %9, align 8 - %trunc = trunc i64 %10 to i32 + %ptradd4 = getelementptr inbounds i8, ptr %probability, i64 8 + %7 = load i64, ptr %ptradd4, align 8 + %trunc = trunc i64 %7 to i32 store i32 %trunc, ptr %len, align 4 store i32 0, ptr %i, align 4 br label %loop.cond -loop.cond: ; preds = %if.exit11, %entry - %11 = load i32, ptr %i, align 4 - %lt = icmp slt i32 %11, %4 - br i1 %lt, label %loop.body, label %loop.exit13 +loop.cond: ; preds = %if.exit13, %entry + %8 = load i32, ptr %i, align 4 + %lt = icmp slt i32 %8, %4 + br i1 %lt, label %loop.body, label %loop.exit15 loop.body: ; preds = %loop.cond - %12 = call float @fasta.fasta_rand(float 1.000000e+00) - %fpfpext = fpext float %12 to double + %9 = call float @fasta.fasta_rand(float 1.000000e+00) + %fpfpext = fpext float %9 to double store double %fpfpext, ptr %v, align 8 store i32 0, ptr %j, align 4 - br label %loop.cond2 - -loop.cond2: ; preds = %if.exit, %loop.body - %13 = load i32, ptr %j, align 4 - %14 = load i32, ptr %len, align 4 - %sub = sub i32 %14, 1 - %lt3 = icmp slt i32 %13, %sub - br i1 %lt3, label %loop.body4, label %loop.exit - -loop.body4: ; preds = %loop.cond2 - %15 = load double, ptr %v, align 8 - %16 = getelementptr inbounds %"double[]", ptr %probability, i32 0, i32 0 - %17 = load ptr, ptr %16, align 8 - %18 = load i32, ptr %j, align 4 - %sext = sext i32 %18 to i64 - %ptroffset5 = getelementptr inbounds double, ptr %17, i64 %sext - %19 = load double, ptr %ptroffset5, align 8 - %fsub = fsub double %15, %19 + br label %loop.cond5 + +loop.cond5: ; preds = %if.exit, %loop.body + %10 = load i32, ptr %j, align 4 + %11 = load i32, ptr %len, align 4 + %sub = sub i32 %11, 1 + %lt6 = icmp slt i32 %10, %sub + br i1 %lt6, label %loop.body7, label %loop.exit + +loop.body7: ; preds = %loop.cond5 + %12 = load double, ptr %v, align 8 + %13 = load ptr, ptr %probability, align 8 + %14 = load i32, ptr %j, align 4 + %sext = sext i32 %14 to i64 + %ptroffset = getelementptr inbounds [8 x i8], ptr %13, i64 %sext + %15 = load double, ptr %ptroffset, align 8 + %fsub = fsub double %12, %15 store double %fsub, ptr %v, align 8 - %20 = load double, ptr %v, align 8 - %lt6 = fcmp olt double %20, 0.000000e+00 - br i1 %lt6, label %if.then, label %if.exit + %16 = load double, ptr %v, align 8 + %lt8 = fcmp olt double %16, 0.000000e+00 + br i1 %lt8, label %if.then, label %if.exit -if.then: ; preds = %loop.body4 +if.then: ; preds = %loop.body7 br label %loop.exit -if.exit: ; preds = %loop.body4 - %21 = load i32, ptr %j, align 4 - %add = add i32 %21, 1 +if.exit: ; preds = %loop.body7 + %17 = load i32, ptr %j, align 4 + %add = add i32 %17, 1 store i32 %add, ptr %j, align 4 - br label %loop.cond2 - -loop.exit: ; preds = %if.then, %loop.cond2 - %22 = getelementptr inbounds %"char[]", ptr %symb, i32 0, i32 0 - %23 = load ptr, ptr %22, align 8 - %24 = load i32, ptr %j, align 4 - %sext7 = sext i32 %24 to i64 - %ptroffset8 = getelementptr inbounds i8, ptr %23, i64 %sext7 - %25 = load i8, ptr %ptroffset8, align 1 - %zext = zext i8 %25 to i32 + br label %loop.cond5 + +loop.exit: ; preds = %if.then, %loop.cond5 + %18 = load ptr, ptr %symb, align 8 + %19 = load i32, ptr %j, align 4 + %sext9 = sext i32 %19 to i64 + %ptradd10 = getelementptr inbounds i8, ptr %18, i64 %sext9 + %20 = load i8, ptr %ptradd10, align 1 + %zext = zext i8 %20 to i32 call void @putchar(i32 %zext) - %26 = load i32, ptr %i, align 4 - %smod = srem i32 %26, 60 - %eq9 = icmp eq i32 %smod, 59 - br i1 %eq9, label %if.then10, label %if.exit11 + %21 = load i32, ptr %i, align 4 + %smod = srem i32 %21, 60 + %eq11 = icmp eq i32 %smod, 59 + br i1 %eq11, label %if.then12, label %if.exit13 -if.then10: ; preds = %loop.exit +if.then12: ; preds = %loop.exit call void @putchar(i32 10) - br label %if.exit11 + br label %if.exit13 -if.exit11: ; preds = %if.then10, %loop.exit - %27 = load i32, ptr %i, align 4 - %add12 = add i32 %27, 1 - store i32 %add12, ptr %i, align 4 +if.exit13: ; preds = %if.then12, %loop.exit + %22 = load i32, ptr %i, align 4 + %add14 = add i32 %22, 1 + store i32 %add14, ptr %i, align 4 br label %loop.cond -loop.exit13: ; preds = %loop.cond - %28 = load i32, ptr %i, align 4 - %smod14 = srem i32 %28, 60 - %neq = icmp ne i32 %smod14, 0 - br i1 %neq, label %if.then15, label %if.exit16 +loop.exit15: ; preds = %loop.cond + %23 = load i32, ptr %i, align 4 + %smod16 = srem i32 %23, 60 + %neq = icmp ne i32 %smod16, 0 + br i1 %neq, label %if.then17, label %if.exit18 -if.then15: ; preds = %loop.exit13 +if.then17: ; preds = %loop.exit15 call void @putchar(i32 10) - br label %if.exit16 + br label %if.exit18 -if.exit16: ; preds = %if.then15, %loop.exit13 +if.exit18: ; preds = %if.then17, %loop.exit15 ret void } - +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 { entry: %n = alloca i32, align 4 @@ -332,8 +329,8 @@ entry: br i1 %gt, label %if.then, label %if.exit if.then: ; preds = %entry - %ptroffset = getelementptr inbounds ptr, ptr %1, i64 1 - %2 = load ptr, ptr %ptroffset, align 8 + %ptradd = getelementptr inbounds i8, ptr %1, i64 8 + %2 = load ptr, ptr %ptradd, align 8 %3 = call i32 @atoi(ptr %2) store i32 %3, ptr %n, align 4 br label %if.exit @@ -343,23 +340,23 @@ if.exit: ; preds = %if.then, %entry %5 = load i32, ptr %n, align 4 %mul = mul i32 %5, 2 %lo = load ptr, ptr @fasta.alu, align 8 - %hi = load i64, ptr getelementptr inbounds (%"char[]", ptr @fasta.alu, i32 0, i32 1), align 8 + %hi = load i64, ptr getelementptr inbounds (i8, ptr @fasta.alu, i64 8), align 8 call void @fasta.repeat_fasta(ptr %lo, i64 %hi, i32 %mul) %6 = call i32 (ptr, ...) @printf(ptr @.str.15) %7 = load i32, ptr %n, align 4 %mul1 = mul i32 %7, 3 %lo2 = load ptr, ptr @fasta.iub, align 8 - %hi3 = load i64, ptr getelementptr inbounds (%"char[]", ptr @fasta.iub, i32 0, i32 1), align 8 + %hi3 = load i64, ptr getelementptr inbounds (i8, ptr @fasta.iub, i64 8), align 8 %lo4 = load ptr, ptr @fasta.iub_p, align 8 - %hi5 = load i64, ptr getelementptr inbounds (%"double[]", ptr @fasta.iub_p, i32 0, i32 1), align 8 + %hi5 = load i64, ptr getelementptr inbounds (i8, ptr @fasta.iub_p, i64 8), align 8 call void @fasta.random_fasta(ptr %lo2, i64 %hi3, ptr %lo4, i64 %hi5, i32 %mul1) %8 = call i32 (ptr, ...) @printf(ptr @.str.16) %9 = load i32, ptr %n, align 4 %mul6 = mul i32 %9, 5 %lo7 = load ptr, ptr @fasta.homosapiens, align 8 - %hi8 = load i64, ptr getelementptr inbounds (%"char[]", ptr @fasta.homosapiens, i32 0, i32 1), align 8 + %hi8 = load i64, ptr getelementptr inbounds (i8, ptr @fasta.homosapiens, i64 8), align 8 %lo9 = load ptr, ptr @fasta.homosapiens_p, align 8 - %hi10 = load i64, ptr getelementptr inbounds (%"double[]", ptr @fasta.homosapiens_p, i32 0, i32 1), align 8 + %hi10 = load i64, ptr getelementptr inbounds (i8, ptr @fasta.homosapiens_p, i64 8), align 8 call void @fasta.random_fasta(ptr %lo7, i64 %hi8, ptr %lo9, i64 %hi10, i32 %mul6) ret i32 0 } \ No newline at end of file diff --git a/test/test_suite/initializer_lists/general_tests.c3t b/test/test_suite/initializer_lists/general_tests.c3t index 1973abe0f..30a07efb2 100644 --- a/test/test_suite/initializer_lists/general_tests.c3t +++ b/test/test_suite/initializer_lists/general_tests.c3t @@ -43,7 +43,7 @@ fn int test() @test.foo1 = internal unnamed_addr global i32 22, align 4 @.str = private unnamed_addr constant [7 x i8] c"Hello!\00", align 1 - +; Function Attrs: define i32 @general_tests.test() #0 { entry: %ffe = alloca %Baz, align 8 @@ -58,21 +58,19 @@ entry: %foo = alloca %"Bar[]", align 8 %baz = alloca [3 x %Baz], align 16 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %ffe, ptr align 8 @.__const, i32 8, i1 false) - %0 = getelementptr inbounds [1 x i32], ptr %azz, i64 0, i64 0 - store i32 0, ptr %0, align 4 + store i32 0, ptr %azz, align 4 store i32 33, ptr %foo2, align 4 store ptr @.str, ptr %str, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const.1, i32 12, i1 false) - %1 = insertvalue %"int[]" undef, ptr %literal, 0 - %2 = insertvalue %"int[]" %1, i64 3, 1 - %3 = extractvalue %"int[]" %2, 1 - %not = icmp eq i64 %3, 0 - %4 = zext i1 %not to i8 - store i8 %4, ptr %x, align 1 - %5 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 0 - store i32 0, ptr %5, align 4 - %6 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 1 - store i32 0, ptr %6, align 4 + %0 = insertvalue %"int[]" undef, ptr %literal, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + %2 = extractvalue %"int[]" %1, 1 + %not = icmp eq i64 %2, 0 + %3 = zext i1 %not to i8 + store i8 %3, ptr %x, align 1 + store i32 0, ptr %b, align 4 + %ptradd = getelementptr inbounds i8, ptr %b, i64 4 + store i32 0, ptr %ptradd, align 4 call void @llvm.memset.p0.i64(ptr align 8 %z, i8 0, i64 8, i1 false) store %"int[]" zeroinitializer, ptr %sub, align 8 store %"Bar[]" zeroinitializer, ptr %foo, align 8 diff --git a/test/test_suite/initializer_lists/ranges_to_dynamic.c3t b/test/test_suite/initializer_lists/ranges_to_dynamic.c3t index 8459bdc80..934b1f29a 100644 --- a/test/test_suite/initializer_lists/ranges_to_dynamic.c3t +++ b/test/test_suite/initializer_lists/ranges_to_dynamic.c3t @@ -25,37 +25,36 @@ entry: %.anon = alloca i64, align 8 %v = alloca i32, align 4 call void @llvm.memset.p0.i64(ptr align 16 %y, i8 0, i64 40, i1 false) - %1 = getelementptr inbounds [10 x i32], ptr %y, i64 0, i64 0 - store i32 4, ptr %1, align 4 - %2 = getelementptr inbounds [10 x i32], ptr %y, i64 0, i64 1 - store i32 4, ptr %2, align 4 - %3 = getelementptr inbounds [10 x i32], ptr %y, i64 0, i64 2 - store i32 4, ptr %3, align 4 - %4 = getelementptr inbounds [10 x i32], ptr %y, i64 0, i64 3 - store i32 4, ptr %4, align 4 - %5 = getelementptr inbounds [10 x i32], ptr %y, i64 0, i64 6 - store i32 %0, ptr %5, align 4 - %6 = getelementptr inbounds [10 x i32], ptr %y, i64 0, i64 7 - store i32 %0, ptr %6, align 4 - %7 = getelementptr inbounds [10 x i32], ptr %y, i64 0, i64 8 - store i32 %0, ptr %7, align 4 + store i32 4, ptr %y, align 4 + %ptradd = getelementptr inbounds i8, ptr %y, i64 4 + store i32 4, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 8 + store i32 4, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %y, i64 12 + store i32 4, ptr %ptradd2, align 4 + %ptradd3 = getelementptr inbounds i8, ptr %y, i64 24 + store i32 %0, ptr %ptradd3, align 4 + %ptradd4 = getelementptr inbounds i8, ptr %y, i64 28 + store i32 %0, ptr %ptradd4, align 4 + %ptradd5 = getelementptr inbounds i8, ptr %y, i64 32 + store i32 %0, ptr %ptradd5, align 4 store i64 0, ptr %.anon, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %8 = load i64, ptr %.anon, align 8 - %gt = icmp ugt i64 10, %8 + %1 = load i64, ptr %.anon, align 8 + %gt = icmp ugt i64 10, %1 br i1 %gt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %9 = load i64, ptr %.anon, align 8 - %10 = getelementptr inbounds [10 x i32], ptr %y, i64 0, i64 %9 - %11 = load i32, ptr %10, align 4 - store i32 %11, ptr %v, align 4 - %12 = load i32, ptr %v, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %12) - %13 = load i64, ptr %.anon, align 8 - %add = add i64 %13, 1 + %2 = load i64, ptr %.anon, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %y, i64 %2 + %3 = load i32, ptr %ptroffset, align 4 + store i32 %3, ptr %v, align 4 + %4 = load i32, ptr %v, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %4) + %5 = load i64, ptr %.anon, align 8 + %add = add i64 %5, 1 store i64 %add, ptr %.anon, align 8 br label %loop.cond diff --git a/test/test_suite/initializer_lists/statics.c3t b/test/test_suite/initializer_lists/statics.c3t index eba8dc448..479e328db 100644 --- a/test/test_suite/initializer_lists/statics.c3t +++ b/test/test_suite/initializer_lists/statics.c3t @@ -42,6 +42,7 @@ fn int main() @test.c = internal unnamed_addr global %"Bar[]" { ptr @.taddr, i64 1 }, align 8 @.str = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 +; Function Attrs: define void @statics.test() #0 { entry: %b = alloca %"Bar[]", align 8 @@ -50,28 +51,22 @@ entry: %0 = insertvalue %"Bar[]" undef, ptr %literal, 0 %1 = insertvalue %"Bar[]" %0, i64 1, 1 store %"Bar[]" %1, ptr %b, align 8 - %2 = getelementptr inbounds %"Bar[]", ptr %b, i32 0, i32 0 - %3 = load ptr, ptr %2, align 8 - %ptroffset = getelementptr inbounds %Bar, ptr %3, i64 0 - %4 = getelementptr inbounds %Bar, ptr %ptroffset, i32 0, i32 1 - %5 = load ptr, ptr @test.c, align 8 - %ptroffset1 = getelementptr inbounds %Bar, ptr %5, i64 0 - %6 = getelementptr inbounds %Bar, ptr %ptroffset1, i32 0, i32 1 - %7 = load i32, ptr %4, align 4 - %8 = load i32, ptr %6, align 4 - %9 = call i32 (ptr, ...) @printf(ptr @.str, i32 %7, i32 %8) - %10 = getelementptr inbounds %"Bar[]", ptr %b, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - %ptroffset2 = getelementptr inbounds %Bar, ptr %11, i64 0 - %12 = getelementptr inbounds %Bar, ptr %ptroffset2, i32 0, i32 1 - %13 = load i32, ptr %12, align 4 - %add = add i32 %13, 1 - store i32 %add, ptr %12, align 4 - %14 = load ptr, ptr @test.c, align 8 - %ptroffset3 = getelementptr inbounds %Bar, ptr %14, i64 0 - %15 = getelementptr inbounds %Bar, ptr %ptroffset3, i32 0, i32 1 - %16 = load i32, ptr %15, align 4 - %add4 = add i32 %16, 1 - store i32 %add4, ptr %15, align 4 + %2 = load ptr, ptr %b, align 8 + %ptradd = getelementptr inbounds i8, ptr %2, i64 4 + %3 = load ptr, ptr @test.c, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %3, i64 4 + %4 = load i32, ptr %ptradd, align 4 + %5 = load i32, ptr %ptradd1, align 4 + %6 = call i32 (ptr, ...) @printf(ptr @.str, i32 %4, i32 %5) + %7 = load ptr, ptr %b, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %7, i64 4 + %8 = load i32, ptr %ptradd2, align 4 + %add = add i32 %8, 1 + store i32 %add, ptr %ptradd2, align 4 + %9 = load ptr, ptr @test.c, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %9, i64 4 + %10 = load i32, ptr %ptradd3, align 4 + %add4 = add i32 %10, 1 + store i32 %add4, ptr %ptradd3, align 4 ret void } diff --git a/test/test_suite/initializer_lists/subarrays.c3t b/test/test_suite/initializer_lists/subarrays.c3t index 2e23ee010..f102952c3 100644 --- a/test/test_suite/initializer_lists/subarrays.c3t +++ b/test/test_suite/initializer_lists/subarrays.c3t @@ -49,6 +49,7 @@ fn int main() %"Bar[]" = type { ptr, i64 } %"int[]" = type { ptr, i64 } %Baz = type { double } + @"$ct.subarrays.Baz" = linkonce global %.introspect { i8 11, i64 0, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 @"$ct.subarrays.Bar" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 8, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 @.taddr = private global [2 x %Bar] [%Bar { i32 3, i32 4 }, %Bar { i32 8, i32 9 }], align 8 @@ -65,6 +66,7 @@ fn int main() @.__const.10 = private unnamed_addr constant { i32, [4 x i8] } { i32 1, [4 x i8] undef }, align 8 @.str.12 = private unnamed_addr constant [3 x i8] c"Ok\00", align 1 +; Function Attrs: define i32 @main() #0 { entry: %w = alloca %Bar, align 4 @@ -80,154 +82,169 @@ entry: %ffe = alloca %Baz, align 8 %azz = alloca [1 x i32], align 4 %xy = alloca i8, align 1 - %literal19 = alloca [3 x i32], align 4 - %len21 = alloca i64, align 8 - %error_var22 = alloca i64, align 8 - %retparam24 = alloca i64, align 8 - %error_var30 = alloca i64, align 8 - %error_var36 = alloca i64, align 8 + %literal20 = alloca [3 x i32], align 4 + %len22 = alloca i64, align 8 + %error_var23 = alloca i64, align 8 + %retparam25 = alloca i64, align 8 + %error_var31 = alloca i64, align 8 + %error_var37 = alloca i64, align 8 %b = alloca %Bar, align 4 %z = alloca %Baz, align 8 %sub = alloca %"int[]", align 8 %foo = alloca %"Bar[]", align 8 %baz = alloca [3 x %Baz], align 16 %0 = load ptr, ptr @subarrays.arrbar, align 8 - %ptroffset = getelementptr inbounds %Bar, ptr %0, i64 1 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %w, ptr align 4 %ptroffset, i32 8, i1 false) + %ptradd = getelementptr inbounds i8, ptr %0, i64 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %w, ptr align 4 %ptradd, i32 8, i1 false) %1 = load ptr, ptr @subarrays.arrbar, align 8 - %ptroffset1 = getelementptr inbounds %Bar, ptr %1, i64 1 - %2 = getelementptr inbounds %Bar, ptr %ptroffset1, i32 0, i32 0 - %3 = load i32, ptr %2, align 4 - %4 = call i32 (ptr, ...) @printf(ptr @.str, i32 %3) + %ptradd1 = getelementptr inbounds i8, ptr %1, i64 8 + %2 = load i32, ptr %ptradd1, align 4 + %3 = call i32 (ptr, ...) @printf(ptr @.str, i32 %2) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 4 @.__const, i32 12, i1 false) - %5 = insertvalue %"int[]" undef, ptr %literal, 0 - %6 = insertvalue %"int[]" %5, i64 3, 1 - store %"int[]" %6, ptr %x, align 8 + %4 = insertvalue %"int[]" undef, ptr %literal, 0 + %5 = insertvalue %"int[]" %4, i64 3, 1 + store %"int[]" %5, ptr %x, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal2, ptr align 4 @.__const.5, i32 12, i1 false) store ptr %literal2, ptr %y, align 8 - %7 = call ptr @std.io.stdout() - %8 = call i64 @std.io.File.write(ptr %retparam, ptr %7, ptr @.str.6, i64 6) - %not_err = icmp eq i64 %8, 0 - %9 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %9, label %after_check, label %assign_optional + %6 = call ptr @std.io.stdout() + %7 = call i64 @std.io.File.write(ptr %retparam, ptr %6, ptr @.str.6, i64 6) + %not_err = icmp eq i64 %7, 0 + %8 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %8, label %after_check, label %assign_optional + assign_optional: ; preds = %entry - store i64 %8, ptr %error_var, align 8 + store i64 %7, ptr %error_var, align 8 br label %guard_block after_check: ; preds = %entry br label %noerr_block guard_block: ; preds = %assign_optional br label %voiderr noerr_block: ; preds = %after_check - %10 = load i64, ptr %retparam, align 8 - store i64 %10, ptr %len, align 8 - %11 = call i64 @std.io.File.write_byte(ptr %7, i8 zeroext 10) - %not_err5 = icmp eq i64 %11, 0 - %12 = call i1 @llvm.expect.i1(i1 %not_err5, i1 true) - br i1 %12, label %after_check7, label %assign_optional6 + %9 = load i64, ptr %retparam, align 8 + store i64 %9, ptr %len, align 8 + %10 = call i64 @std.io.File.write_byte(ptr %6, i8 zeroext 10) + %not_err5 = icmp eq i64 %10, 0 + %11 = call i1 @llvm.expect.i1(i1 %not_err5, i1 true) + br i1 %11, label %after_check7, label %assign_optional6 + assign_optional6: ; preds = %noerr_block - store i64 %11, ptr %error_var4, align 8 + store i64 %10, ptr %error_var4, align 8 br label %guard_block8 after_check7: ; preds = %noerr_block br label %noerr_block9 guard_block8: ; preds = %assign_optional6 br label %voiderr noerr_block9: ; preds = %after_check7 - %13 = call i64 @std.io.File.flush(ptr %7) - %not_err11 = icmp eq i64 %13, 0 - %14 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) - br i1 %14, label %after_check13, label %assign_optional12 + %12 = call i64 @std.io.File.flush(ptr %6) + %not_err11 = icmp eq i64 %12, 0 + %13 = call i1 @llvm.expect.i1(i1 %not_err11, i1 true) + br i1 %13, label %after_check13, label %assign_optional12 + assign_optional12: ; preds = %noerr_block9 - store i64 %13, ptr %error_var10, align 8 + store i64 %12, ptr %error_var10, align 8 br label %guard_block14 after_check13: ; preds = %noerr_block9 br label %noerr_block15 guard_block14: ; preds = %assign_optional12 br label %voiderr noerr_block15: ; preds = %after_check13 - %15 = load i64, ptr %len, align 8 - %add = add i64 %15, 1 + %14 = load i64, ptr %len, align 8 + %add = add i64 %14, 1 br label %voiderr + voiderr: ; preds = %noerr_block15, %guard_block14, %guard_block8, %guard_block - %16 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 1 - %17 = load i64, ptr %16, align 8 - %trunc = trunc i64 %17 to i32 - %18 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 0 - %19 = load ptr, ptr %18, align 8 - %ptroffset16 = getelementptr inbounds i32, ptr %19, i64 1 - %20 = load i32, ptr %ptroffset16, align 4 - %21 = call i32 (ptr, ...) @printf(ptr @.str.7, i32 %trunc, i32 %20) - %22 = load ptr, ptr %y, align 8 - %ptroffset17 = getelementptr inbounds i32, ptr %22, i64 1 - %23 = load i32, ptr %ptroffset17, align 4 - %24 = call i32 (ptr, ...) @printf(ptr @.str.8, i32 %23) - %25 = load ptr, ptr @subarrays.fofeo, align 8 - %ptroffset18 = getelementptr inbounds i32, ptr %25, i64 1 - %26 = load i32, ptr %ptroffset18, align 4 - %27 = call i32 (ptr, ...) @printf(ptr @.str.9, i32 %26) + %ptradd16 = getelementptr inbounds i8, ptr %x, i64 8 + %15 = load i64, ptr %ptradd16, align 8 + %trunc = trunc i64 %15 to i32 + %16 = load ptr, ptr %x, align 8 + %ptradd17 = getelementptr inbounds i8, ptr %16, i64 4 + %17 = load i32, ptr %ptradd17, align 4 + %18 = call i32 (ptr, ...) @printf(ptr @.str.7, i32 %trunc, i32 %17) + %19 = load ptr, ptr %y, align 8 + %ptradd18 = getelementptr inbounds i8, ptr %19, i64 4 + %20 = load i32, ptr %ptradd18, align 4 + %21 = call i32 (ptr, ...) @printf(ptr @.str.8, i32 %20) + %22 = load ptr, ptr @subarrays.fofeo, align 8 + %ptradd19 = getelementptr inbounds i8, ptr %22, i64 4 + %23 = load i32, ptr %ptradd19, align 4 + %24 = call i32 (ptr, ...) @printf(ptr @.str.9, i32 %23) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %ffe, ptr align 8 @.__const.10, i32 8, i1 false) - %28 = getelementptr inbounds [1 x i32], ptr %azz, i64 0, i64 0 - store i32 0, ptr %28, align 4 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal19, ptr align 4 @.__const.11, i32 12, i1 false) - %29 = insertvalue %"int[]" undef, ptr %literal19, 0 - %30 = insertvalue %"int[]" %29, i64 3, 1 - %31 = extractvalue %"int[]" %30, 1 - %not = icmp eq i64 %31, 0 - %32 = zext i1 %not to i8 - store i8 %32, ptr %xy, align 1 - %33 = load i8, ptr %xy, align 1 - %34 = trunc i8 %33 to i1 - %not20 = xor i1 %34, true - br i1 %not20, label %if.then, label %if.exit + store i32 0, ptr %azz, align 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal20, ptr align 4 @.__const.11, i32 12, i1 false) + %25 = insertvalue %"int[]" undef, ptr %literal20, 0 + %26 = insertvalue %"int[]" %25, i64 3, 1 + %27 = extractvalue %"int[]" %26, 1 + %not = icmp eq i64 %27, 0 + %28 = zext i1 %not to i8 + store i8 %28, ptr %xy, align 1 + %29 = load i8, ptr %xy, align 1 + %30 = trunc i8 %29 to i1 + %not21 = xor i1 %30, true + br i1 %not21, label %if.then, label %if.exit + if.then: ; preds = %voiderr - %35 = call ptr @std.io.stdout() - %36 = call i64 @std.io.File.write(ptr %retparam24, ptr %35, ptr @.str.12, i64 2) - %not_err25 = icmp eq i64 %36, 0 - %37 = call i1 @llvm.expect.i1(i1 %not_err25, i1 true) - br i1 %37, label %after_check27, label %assign_optional26 -assign_optional26: ; preds = %if.then - store i64 %36, ptr %error_var22, align 8 - br label %guard_block28 -after_check27: ; preds = %if.then - br label %noerr_block29 -guard_block28: ; preds = %assign_optional26 - br label %voiderr43 -noerr_block29: ; preds = %after_check27 - %38 = load i64, ptr %retparam24, align 8 - store i64 %38, ptr %len21, align 8 - %39 = call i64 @std.io.File.write_byte(ptr %35, i8 zeroext 10) - %not_err31 = icmp eq i64 %39, 0 - %40 = call i1 @llvm.expect.i1(i1 %not_err31, i1 true) - br i1 %40, label %after_check33, label %assign_optional32 -assign_optional32: ; preds = %noerr_block29 - store i64 %39, ptr %error_var30, align 8 - br label %guard_block34 -after_check33: ; preds = %noerr_block29 - br label %noerr_block35 -guard_block34: ; preds = %assign_optional32 - br label %voiderr43 -noerr_block35: ; preds = %after_check33 - %41 = call i64 @std.io.File.flush(ptr %35) - %not_err37 = icmp eq i64 %41, 0 - %42 = call i1 @llvm.expect.i1(i1 %not_err37, i1 true) - br i1 %42, label %after_check39, label %assign_optional38 -assign_optional38: ; preds = %noerr_block35 - store i64 %41, ptr %error_var36, align 8 - br label %guard_block40 -after_check39: ; preds = %noerr_block35 - br label %noerr_block41 -guard_block40: ; preds = %assign_optional38 - br label %voiderr43 -noerr_block41: ; preds = %after_check39 - %43 = load i64, ptr %len21, align 8 - %add42 = add i64 %43, 1 - br label %voiderr43 -voiderr43: ; preds = %noerr_block41, %guard_block40, %guard_block34, %guard_block28 + %31 = call ptr @std.io.stdout() + %32 = call i64 @std.io.File.write(ptr %retparam25, ptr %31, ptr @.str.12, i64 2) + %not_err26 = icmp eq i64 %32, 0 + %33 = call i1 @llvm.expect.i1(i1 %not_err26, i1 true) + br i1 %33, label %after_check28, label %assign_optional27 + +assign_optional27: ; preds = %if.then + store i64 %32, ptr %error_var23, align 8 + br label %guard_block29 + +after_check28: ; preds = %if.then + br label %noerr_block30 + +guard_block29: ; preds = %assign_optional27 + br label %voiderr44 + +noerr_block30: ; preds = %after_check28 + %34 = load i64, ptr %retparam25, align 8 + store i64 %34, ptr %len22, align 8 + %35 = call i64 @std.io.File.write_byte(ptr %31, i8 zeroext 10) + %not_err32 = icmp eq i64 %35, 0 + %36 = call i1 @llvm.expect.i1(i1 %not_err32, i1 true) + br i1 %36, label %after_check34, label %assign_optional33 + +assign_optional33: ; preds = %noerr_block30 + store i64 %35, ptr %error_var31, align 8 + br label %guard_block35 + +after_check34: ; preds = %noerr_block30 + br label %noerr_block36 + +guard_block35: ; preds = %assign_optional33 + br label %voiderr44 + +noerr_block36: ; preds = %after_check34 + %37 = call i64 @std.io.File.flush(ptr %31) + %not_err38 = icmp eq i64 %37, 0 + %38 = call i1 @llvm.expect.i1(i1 %not_err38, i1 true) + br i1 %38, label %after_check40, label %assign_optional39 + +assign_optional39: ; preds = %noerr_block36 + store i64 %37, ptr %error_var37, align 8 + br label %guard_block41 + +after_check40: ; preds = %noerr_block36 + br label %noerr_block42 + +guard_block41: ; preds = %assign_optional39 + br label %voiderr44 + +noerr_block42: ; preds = %after_check40 + %39 = load i64, ptr %len22, align 8 + %add43 = add i64 %39, 1 + br label %voiderr44 + +voiderr44: ; preds = %noerr_block42, %guard_block41, %guard_block35, %guard_block29 br label %if.exit -if.exit: ; preds = %voiderr43, %voiderr - %44 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 0 - store i32 0, ptr %44, align 4 - %45 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 1 - store i32 0, ptr %45, align 4 + +if.exit: ; preds = %voiderr44, %voiderr + store i32 0, ptr %b, align 4 + %ptradd45 = getelementptr inbounds i8, ptr %b, i64 4 + store i32 0, ptr %ptradd45, align 4 call void @llvm.memset.p0.i64(ptr align 8 %z, i8 0, i64 8, i1 false) store %"int[]" zeroinitializer, ptr %sub, align 8 store %"Bar[]" zeroinitializer, ptr %foo, align 8 diff --git a/test/test_suite/initializer_lists/zero_init.c3t b/test/test_suite/initializer_lists/zero_init.c3t index eeeb31d0a..d0e18dc0f 100644 --- a/test/test_suite/initializer_lists/zero_init.c3t +++ b/test/test_suite/initializer_lists/zero_init.c3t @@ -44,12 +44,10 @@ entry: %foo = alloca %"Bar[]", align 8 %baz = alloca [3 x %Baz], align 16 call void @llvm.memset.p0.i64(ptr align 4 %m, i8 0, i64 40, i1 false) - %0 = getelementptr inbounds [1 x i32], ptr %azz, i64 0, i64 0 - store i32 0, ptr %0, align 4 - %1 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 0 - store i32 0, ptr %1, align 4 - %2 = getelementptr inbounds %Bar, ptr %b, i32 0, i32 1 - store i32 0, ptr %2, align 4 + store i32 0, ptr %azz, align 4 + store i32 0, ptr %b, align 4 + %ptradd = getelementptr inbounds i8, ptr %b, i64 4 + store i32 0, ptr %ptradd, align 4 call void @llvm.memset.p0.i64(ptr align 8 %z, i8 0, i64 8, i1 false) store %"int[]" zeroinitializer, ptr %sub, align 8 store %"Bar[]" zeroinitializer, ptr %foo, align 8 diff --git a/test/test_suite/lambda/ct_lambda.c3t b/test/test_suite/lambda/ct_lambda.c3t index e0647f182..1446fdb1d 100644 --- a/test/test_suite/lambda/ct_lambda.c3t +++ b/test/test_suite/lambda/ct_lambda.c3t @@ -87,22 +87,19 @@ fn int main() @init.foo = internal unnamed_addr global ptr @"test.$global$lambda1", align 8 @init.foo.2 = internal unnamed_addr global ptr @"test.$global$lambda2", align 8 - +; Function Attrs: define void @test.Foo.test(ptr %0, i32 %1) #0 { entry: - %2 = getelementptr inbounds %Foo, ptr %0, i32 0, i32 0 - %3 = load ptr, ptr %2, align 8 - call void %3(ptr %0, i32 %1) + %2 = load ptr, ptr %0, align 8 + call void %2(ptr %0, i32 %1) ret void } - +; Function Attrs: define void @test.FooTest.init(ptr %0) #0 { entry: - %1 = getelementptr inbounds %FooTest, ptr %0, i32 0, i32 0 - %2 = getelementptr inbounds %Foo, ptr %1, i32 0, i32 0 - %3 = load ptr, ptr @init.foo, align 8 - store ptr %3, ptr %2, align 8 + %1 = load ptr, ptr @init.foo, align 8 + store ptr %1, ptr %0, align 8 ret void } @@ -124,7 +121,7 @@ if.exit: ; preds = %entry ret void } - +; Function Attrs: define internal void @"test.$global$lambda2"(ptr %0, i32 %1) #0 { entry: %z = alloca ptr, align 8 diff --git a/test/test_suite/lambda/lambda_in_macro.c3t b/test/test_suite/lambda/lambda_in_macro.c3t index 58f84d875..7b88e2d01 100644 --- a/test/test_suite/lambda/lambda_in_macro.c3t +++ b/test/test_suite/lambda/lambda_in_macro.c3t @@ -32,12 +32,12 @@ fn void main() store ptr @"test.test$lambda1", ptr %z, align 8 %1 = call i32 %0(i32 3) store ptr @"test.test$lambda2", ptr %z2, align 8 - %7 = call double %6(double 3.300000e+00) + %6 = call double %5(double 3.300000e+00) store ptr @"test.test$lambda2", ptr %z6, align 8 - %13 = call double %12(double 3.300000e+00) - %18 = call i32 @"test.test2$lambda3"(i32 3) - %23 = call i32 @"test.test2$lambda3"(i32 3) - %28 = call double @"test.test2$lambda4"(double 3.300000e+00) + %11 = call double %10(double 3.300000e+00) + %15 = call i32 @"test.test2$lambda3"(i32 3) + %19 = call i32 @"test.test2$lambda3"(i32 3) + %23 = call double @"test.test2$lambda4"(double 3.300000e+00) define internal i32 @"test.test$lambda1"(i32 %0) #0 { define internal double @"test.test$lambda2"(double %0) #0 { diff --git a/test/test_suite/lambda/simple_lambda.c3t b/test/test_suite/lambda/simple_lambda.c3t index 0d4da9f9b..b75ee7725 100644 --- a/test/test_suite/lambda/simple_lambda.c3t +++ b/test/test_suite/lambda/simple_lambda.c3t @@ -23,7 +23,7 @@ define void @simple_lambda.main() #0 { entry: %z = alloca i32, align 4 %0 = call i32 @simple_lambda.xy(ptr @"simple_lambda.main$lambda1") - %5 = call i32 @simple_lambda.xy(ptr @"simple_lambda.main$lambda2") + %4 = call i32 @simple_lambda.xy(ptr @"simple_lambda.main$lambda2") define internal i32 @"simple_lambda.main$lambda1"() #0 { diff --git a/test/test_suite/literals/bin_literal.c3t b/test/test_suite/literals/bin_literal.c3t index 0ae8577e0..d07c58da4 100644 --- a/test/test_suite/literals/bin_literal.c3t +++ b/test/test_suite/literals/bin_literal.c3t @@ -27,9 +27,9 @@ entry: %varargslots1 = alloca [3 x %"any*"], align 16 %self = alloca i8, align 1 %taddr = alloca i8, align 1 - %self2 = alloca i8, align 1 - %taddr3 = alloca i8, align 1 - %retparam4 = alloca i64, align 8 + %self3 = alloca i8, align 1 + %taddr4 = alloca i8, align 1 + %retparam6 = alloca i64, align 8 store i32 123, ptr %a, align 4 store i32 -23, ptr %b, align 4 %0 = load i32, ptr %a, align 4 @@ -42,38 +42,36 @@ entry: store i32 %5, ptr %d, align 4 %6 = insertvalue %"any*" undef, ptr %c, 0 %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %8 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %7, ptr %8, align 16 - %9 = insertvalue %"any*" undef, ptr %d, 0 - %10 = insertvalue %"any*" %9, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %11 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %10, ptr %11, align 16 - %12 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 5, ptr %varargslots, i64 2) + store %"any*" %7, ptr %varargslots, align 16 + %8 = insertvalue %"any*" undef, ptr %d, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %9, ptr %ptradd, align 16 + %10 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 5, ptr %varargslots, i64 2) store i8 -35, ptr %z, align 1 - %13 = insertvalue %"any*" undef, ptr %z, 0 - %14 = insertvalue %"any*" %13, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - %15 = getelementptr inbounds [3 x %"any*"], ptr %varargslots1, i64 0, i64 0 - store %"any*" %14, ptr %15, align 16 - %16 = load i8, ptr %z, align 1 - store i8 %16, ptr %self, align 1 - %17 = load i8, ptr %self, align 1 - %18 = load i8, ptr %self, align 1 - %19 = call i8 @llvm.fshr.i8(i8 %17, i8 %18, i8 1) - store i8 %19, ptr %taddr, align 1 - %20 = insertvalue %"any*" undef, ptr %taddr, 0 - %21 = insertvalue %"any*" %20, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - %22 = getelementptr inbounds [3 x %"any*"], ptr %varargslots1, i64 0, i64 1 - store %"any*" %21, ptr %22, align 16 - %23 = load i8, ptr %z, align 1 - store i8 %23, ptr %self2, align 1 - %24 = load i8, ptr %self2, align 1 - %25 = load i8, ptr %self2, align 1 - %26 = call i8 @llvm.fshl.i8(i8 %24, i8 %25, i8 1) - store i8 %26, ptr %taddr3, align 1 - %27 = insertvalue %"any*" undef, ptr %taddr3, 0 - %28 = insertvalue %"any*" %27, i64 ptrtoint (ptr @"$ct.char" to i64), 1 - %29 = getelementptr inbounds [3 x %"any*"], ptr %varargslots1, i64 0, i64 2 - store %"any*" %28, ptr %29, align 16 - %30 = call i64 @std.io.printfn(ptr %retparam4, ptr @.str.1, i64 8, ptr %varargslots1, i64 3) + %11 = insertvalue %"any*" undef, ptr %z, 0 + %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.char" to i64), 1 + store %"any*" %12, ptr %varargslots1, align 16 + %13 = load i8, ptr %z, align 1 + store i8 %13, ptr %self, align 1 + %14 = load i8, ptr %self, align 1 + %15 = load i8, ptr %self, align 1 + %16 = call i8 @llvm.fshr.i8(i8 %14, i8 %15, i8 1) + store i8 %16, ptr %taddr, align 1 + %17 = insertvalue %"any*" undef, ptr %taddr, 0 + %18 = insertvalue %"any*" %17, i64 ptrtoint (ptr @"$ct.char" to i64), 1 + %ptradd2 = getelementptr inbounds i8, ptr %varargslots1, i64 16 + store %"any*" %18, ptr %ptradd2, align 16 + %19 = load i8, ptr %z, align 1 + store i8 %19, ptr %self3, align 1 + %20 = load i8, ptr %self3, align 1 + %21 = load i8, ptr %self3, align 1 + %22 = call i8 @llvm.fshl.i8(i8 %20, i8 %21, i8 1) + store i8 %22, ptr %taddr4, align 1 + %23 = insertvalue %"any*" undef, ptr %taddr4, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.char" to i64), 1 + %ptradd5 = getelementptr inbounds i8, ptr %varargslots1, i64 32 + store %"any*" %24, ptr %ptradd5, align 16 + %25 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.1, i64 8, ptr %varargslots1, i64 3) ret void } diff --git a/test/test_suite/macro_methods/macro_method_different_args.c3t b/test/test_suite/macro_methods/macro_method_different_args.c3t index 5c1ce8f03..d4277fb1c 100644 --- a/test/test_suite/macro_methods/macro_method_different_args.c3t +++ b/test/test_suite/macro_methods/macro_method_different_args.c3t @@ -29,30 +29,21 @@ entry: %a = alloca %Foo, align 4 %this = alloca %Foo, align 4 store i32 0, ptr %a, align 4 - %0 = getelementptr inbounds %Foo, ptr %a, i32 0, i32 0 - store i32 3, ptr %0, align 4 - %1 = getelementptr inbounds %Foo, ptr %a, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %2) - %3 = getelementptr inbounds %Foo, ptr %a, i32 0, i32 0 - %4 = load i32, ptr %3, align 4 - call void (ptr, ...) @printf(ptr @.str.1, i32 %4) - %5 = getelementptr inbounds %Foo, ptr %a, i32 0, i32 0 - store i32 4, ptr %5, align 4 - %6 = getelementptr inbounds %Foo, ptr %a, i32 0, i32 0 - %7 = load i32, ptr %6, align 4 - call void (ptr, ...) @printf(ptr @.str.2, i32 %7) - %8 = getelementptr inbounds %Foo, ptr %a, i32 0, i32 0 - %9 = load i32, ptr %8, align 4 - call void (ptr, ...) @printf(ptr @.str.3, i32 %9) + store i32 3, ptr %a, align 4 + %0 = load i32, ptr %a, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %0) + %1 = load i32, ptr %a, align 4 + call void (ptr, ...) @printf(ptr @.str.1, i32 %1) + store i32 4, ptr %a, align 4 + %2 = load i32, ptr %a, align 4 + call void (ptr, ...) @printf(ptr @.str.2, i32 %2) + %3 = load i32, ptr %a, align 4 + call void (ptr, ...) @printf(ptr @.str.3, i32 %3) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %this, ptr align 4 %a, i32 4, i1 false) - %10 = getelementptr inbounds %Foo, ptr %this, i32 0, i32 0 - store i32 5, ptr %10, align 4 - %11 = getelementptr inbounds %Foo, ptr %this, i32 0, i32 0 - %12 = load i32, ptr %11, align 4 - call void (ptr, ...) @printf(ptr @.str.4, i32 %12) - %13 = getelementptr inbounds %Foo, ptr %a, i32 0, i32 0 - %14 = load i32, ptr %13, align 4 - call void (ptr, ...) @printf(ptr @.str.5, i32 %14) + store i32 5, ptr %this, align 4 + %4 = load i32, ptr %this, align 4 + call void (ptr, ...) @printf(ptr @.str.4, i32 %4) + %5 = load i32, ptr %a, align 4 + call void (ptr, ...) @printf(ptr @.str.5, i32 %5) ret void } \ No newline at end of file diff --git a/test/test_suite/macros/hash_ident_nested.c3t b/test/test_suite/macros/hash_ident_nested.c3t index 9bb473c4a..8404a6d65 100644 --- a/test/test_suite/macros/hash_ident_nested.c3t +++ b/test/test_suite/macros/hash_ident_nested.c3t @@ -24,13 +24,11 @@ define void @test.main() #0 { entry: %pt = alloca %Point, align 4 %z = alloca float, align 4 - %0 = getelementptr inbounds %Point, ptr %pt, i32 0, i32 0 - store float 0.000000e+00, ptr %0, align 4 - %1 = getelementptr inbounds %Point, ptr %pt, i32 0, i32 1 - store float 0.000000e+00, ptr %1, align 4 - %2 = getelementptr inbounds %Point, ptr %pt, i32 0, i32 0 - %3 = load float, ptr %2, align 4 - store float %3, ptr %z, align 4 + store float 0.000000e+00, ptr %pt, align 4 + %ptradd = getelementptr inbounds i8, ptr %pt, i64 4 + store float 0.000000e+00, ptr %ptradd, align 4 + %0 = load float, ptr %pt, align 4 + store float %0, ptr %z, align 4 ret void } diff --git a/test/test_suite/macros/macro_failable_return_rethrow.c3t b/test/test_suite/macros/macro_failable_return_rethrow.c3t index 0b7efd6b8..9db803fb6 100644 --- a/test/test_suite/macros/macro_failable_return_rethrow.c3t +++ b/test/test_suite/macros/macro_failable_return_rethrow.c3t @@ -27,27 +27,32 @@ entry: %not_err = icmp eq i64 %0, 0 %1 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) br i1 %1, label %after_check, label %assign_optional + assign_optional: ; preds = %entry store i64 %0, ptr %error_var1, align 8 br label %guard_block + after_check: ; preds = %entry br label %noerr_block + guard_block: ; preds = %assign_optional %2 = load i64, ptr %error_var1, align 8 store i64 %2, ptr %error_var, align 8 br label %panic_block + noerr_block: ; preds = %after_check br label %noerr_block2 + panic_block: ; preds = %guard_block %3 = insertvalue %"any*" undef, ptr %error_var, 0 %4 = insertvalue %"any*" %3, i64 ptrtoint (ptr @"$ct.anyfault" to i64), 1 - %5 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %4, ptr %5, align 16 - %6 = insertvalue %"any*[]" undef, ptr %varargslots, 0 - %"$$temp" = insertvalue %"any*[]" %6, i64 1, 1 + store %"any*" %4, ptr %varargslots, align 16 + %5 = insertvalue %"any*[]" undef, ptr %varargslots, 0 + %"$$temp" = insertvalue %"any*[]" %5, i64 1, 1 store %"any*[]" %"$$temp", ptr %indirectarg, align 8 call void @std.core.builtin.panicf(ptr @.panic_msg, i64 36, ptr @.file, i64 32, ptr @.func, i64 4, i32 13, ptr byval(%"any*[]") align 8 %indirectarg) unreachable + noerr_block2: ; preds = %noerr_block ret void } \ No newline at end of file diff --git a/test/test_suite/macros/macro_typed_varargs.c3t b/test/test_suite/macros/macro_typed_varargs.c3t index 81a952792..1273ab974 100644 --- a/test/test_suite/macros/macro_typed_varargs.c3t +++ b/test/test_suite/macros/macro_typed_varargs.c3t @@ -39,102 +39,96 @@ entry: %retparam = alloca i64, align 8 %literal2 = alloca [4 x %"any*"], align 16 %taddr = alloca i32, align 4 - %taddr3 = alloca i32, align 4 %taddr4 = alloca i32, align 4 - %taddr5 = alloca i32, align 4 - %x6 = alloca %"any*[]", align 8 - %.anon7 = alloca i64, align 8 - %.anon8 = alloca i64, align 8 - %i12 = alloca %"any*", align 8 - %varargslots14 = alloca [1 x %"any*"], align 16 - %retparam15 = alloca i64, align 8 + %taddr6 = alloca i32, align 4 + %taddr8 = alloca i32, align 4 + %x9 = alloca %"any*[]", align 8 + %.anon10 = alloca i64, align 8 + %.anon12 = alloca i64, align 8 + %i16 = alloca %"any*", align 8 + %varargslots18 = alloca [1 x %"any*"], align 16 + %retparam19 = alloca i64, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal, ptr align 16 @.__const, i32 16, i1 false) %0 = insertvalue %"int[]" undef, ptr %literal, 0 %1 = insertvalue %"int[]" %0, i64 4, 1 store %"int[]" %1, ptr %x, align 8 - %2 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - store i64 %3, ptr %.anon, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + %2 = load i64, ptr %ptradd, align 8 + store i64 %2, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %4 = load i64, ptr %.anon1, align 8 - %5 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %4, %5 + %3 = load i64, ptr %.anon1, align 8 + %4 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %3, %4 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %6 = getelementptr inbounds %"int[]", ptr %x, i32 0, i32 0 - %7 = load ptr, ptr %6, align 8 - %8 = load i64, ptr %.anon1, align 8 - %ptroffset = getelementptr inbounds i32, ptr %7, i64 %8 - %9 = load i32, ptr %ptroffset, align 4 - store i32 %9, ptr %i, align 4 - %10 = insertvalue %"any*" undef, ptr %i, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %12 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %11, ptr %12, align 16 - %13 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) - %14 = load i64, ptr %.anon1, align 8 - %add = add i64 %14, 1 + %5 = load ptr, ptr %x, align 8 + %6 = load i64, ptr %.anon1, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %5, i64 %6 + %7 = load i32, ptr %ptroffset, align 4 + store i32 %7, ptr %i, align 4 + %8 = insertvalue %"any*" undef, ptr %i, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %9, ptr %varargslots, align 16 + %10 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1) + %11 = load i64, ptr %.anon1, align 8 + %add = add i64 %11, 1 store i64 %add, ptr %.anon1, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond - %15 = getelementptr inbounds [4 x %"any*"], ptr %literal2, i64 0, i64 0 store i32 1, ptr %taddr, align 4 - %16 = insertvalue %"any*" undef, ptr %taddr, 0 + %12 = insertvalue %"any*" undef, ptr %taddr, 0 + %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %13, ptr %literal2, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %literal2, i64 16 + store i32 -1, ptr %taddr4, align 4 + %14 = insertvalue %"any*" undef, ptr %taddr4, 0 + %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %15, ptr %ptradd3, align 8 + %ptradd5 = getelementptr inbounds i8, ptr %literal2, i64 32 + store i32 3141, ptr %taddr6, align 4 + %16 = insertvalue %"any*" undef, ptr %taddr6, 0 %17 = insertvalue %"any*" %16, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %17, ptr %15, align 8 - %18 = getelementptr inbounds [4 x %"any*"], ptr %literal2, i64 0, i64 1 - store i32 -1, ptr %taddr3, align 4 - %19 = insertvalue %"any*" undef, ptr %taddr3, 0 - %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %20, ptr %18, align 8 - %21 = getelementptr inbounds [4 x %"any*"], ptr %literal2, i64 0, i64 2 - store i32 3141, ptr %taddr4, align 4 - %22 = insertvalue %"any*" undef, ptr %taddr4, 0 - %23 = insertvalue %"any*" %22, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %23, ptr %21, align 8 - %24 = getelementptr inbounds [4 x %"any*"], ptr %literal2, i64 0, i64 3 - store i32 1000, ptr %taddr5, align 4 - %25 = insertvalue %"any*" undef, ptr %taddr5, 0 - %26 = insertvalue %"any*" %25, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - store %"any*" %26, ptr %24, align 8 - %27 = insertvalue %"any*[]" undef, ptr %literal2, 0 - %28 = insertvalue %"any*[]" %27, i64 4, 1 - store %"any*[]" %28, ptr %x6, align 8 - %29 = getelementptr inbounds %"any*[]", ptr %x6, i32 0, i32 1 - %30 = load i64, ptr %29, align 8 - store i64 %30, ptr %.anon7, align 8 - store i64 0, ptr %.anon8, align 8 - br label %loop.cond9 + store %"any*" %17, ptr %ptradd5, align 8 + %ptradd7 = getelementptr inbounds i8, ptr %literal2, i64 48 + store i32 1000, ptr %taddr8, align 4 + %18 = insertvalue %"any*" undef, ptr %taddr8, 0 + %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %19, ptr %ptradd7, align 8 + %20 = insertvalue %"any*[]" undef, ptr %literal2, 0 + %21 = insertvalue %"any*[]" %20, i64 4, 1 + store %"any*[]" %21, ptr %x9, align 8 + %ptradd11 = getelementptr inbounds i8, ptr %x9, i64 8 + %22 = load i64, ptr %ptradd11, align 8 + store i64 %22, ptr %.anon10, align 8 + store i64 0, ptr %.anon12, align 8 + br label %loop.cond13 -loop.cond9: ; preds = %loop.body11, %loop.exit - %31 = load i64, ptr %.anon8, align 8 - %32 = load i64, ptr %.anon7, align 8 - %lt10 = icmp ult i64 %31, %32 - br i1 %lt10, label %loop.body11, label %loop.exit17 +loop.cond13: ; preds = %loop.body15, %loop.exit + %23 = load i64, ptr %.anon12, align 8 + %24 = load i64, ptr %.anon10, align 8 + %lt14 = icmp ult i64 %23, %24 + br i1 %lt14, label %loop.body15, label %loop.exit21 -loop.body11: ; preds = %loop.cond9 - %33 = getelementptr inbounds %"any*[]", ptr %x6, i32 0, i32 0 - %34 = load ptr, ptr %33, align 8 - %35 = load i64, ptr %.anon8, align 8 - %ptroffset13 = getelementptr inbounds %"any*", ptr %34, i64 %35 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %i12, ptr align 8 %ptroffset13, i32 16, i1 false) - %36 = getelementptr inbounds %"any*", ptr %i12, i32 0, i32 0 - %37 = load ptr, ptr %36, align 8 - %38 = insertvalue %"any*" undef, ptr %37, 0 - %39 = insertvalue %"any*" %38, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %40 = getelementptr inbounds [1 x %"any*"], ptr %varargslots14, i64 0, i64 0 - store %"any*" %39, ptr %40, align 16 - %41 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.1, i64 2, ptr %varargslots14, i64 1) - %42 = load i64, ptr %.anon8, align 8 - %add16 = add i64 %42, 1 - store i64 %add16, ptr %.anon8, align 8 - br label %loop.cond9 +loop.body15: ; preds = %loop.cond13 + %25 = load ptr, ptr %x9, align 8 + %26 = load i64, ptr %.anon12, align 8 + %ptroffset17 = getelementptr inbounds [16 x i8], ptr %25, i64 %26 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %i16, ptr align 8 %ptroffset17, i32 16, i1 false) + %27 = load ptr, ptr %i16, align 8 + %28 = insertvalue %"any*" undef, ptr %27, 0 + %29 = insertvalue %"any*" %28, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %29, ptr %varargslots18, align 16 + %30 = call i64 @std.io.printfn(ptr %retparam19, ptr @.str.1, i64 2, ptr %varargslots18, i64 1) + %31 = load i64, ptr %.anon12, align 8 + %add20 = add i64 %31, 1 + store i64 %add20, ptr %.anon12, align 8 + br label %loop.cond13 -loop.exit17: ; preds = %loop.cond9 +loop.exit21: ; preds = %loop.cond13 ret void } diff --git a/test/test_suite/macros/macro_untyped_varargs_2.c3t b/test/test_suite/macros/macro_untyped_varargs_2.c3t index 944af23e6..1ce71bc64 100644 --- a/test/test_suite/macros/macro_untyped_varargs_2.c3t +++ b/test/test_suite/macros/macro_untyped_varargs_2.c3t @@ -68,12 +68,12 @@ entry: store i32 %0, ptr %taddr, align 4 %1 = insertvalue %"any*" undef, ptr %taddr, 0 %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %3 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %2, ptr %3, align 16 - %4 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 8, ptr %varargslots, i64 1) + store %"any*" %2, ptr %varargslots, align 16 + %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 8, ptr %varargslots, i64 1) ret i32 %0 } +; Function Attrs: define void @test.main() #0 { entry: %i = alloca i32, align 4 @@ -108,7 +108,7 @@ entry: %retparam23 = alloca i64, align 8 %a24 = alloca i32, align 4 %varargslots25 = alloca [2 x %"any*"], align 16 - %retparam26 = alloca i64, align 8 + %retparam27 = alloca i64, align 8 %0 = call i32 @test.ping(i32 -1) %1 = call i32 @test.ping(i32 1) %2 = call i32 @test.ping(i32 3141) @@ -122,78 +122,69 @@ entry: store i32 %1, ptr %taddr, align 4 %6 = insertvalue %"any*" undef, ptr %taddr, 0 %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %8 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %7, ptr %8, align 16 - %9 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.1, i64 2, ptr %varargslots, i64 1) + store %"any*" %7, ptr %varargslots, align 16 + %8 = call i64 @std.io.printfn(ptr %retparam, ptr @.str.1, i64 2, ptr %varargslots, i64 1) store i32 %0, ptr %taddr3, align 4 - %10 = insertvalue %"any*" undef, ptr %taddr3, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %12 = getelementptr inbounds [1 x %"any*"], ptr %varargslots2, i64 0, i64 0 - store %"any*" %11, ptr %12, align 16 - %13 = call i64 @std.io.printfn(ptr %retparam4, ptr @.str.2, i64 2, ptr %varargslots2, i64 1) + %9 = insertvalue %"any*" undef, ptr %taddr3, 0 + %10 = insertvalue %"any*" %9, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %10, ptr %varargslots2, align 16 + %11 = call i64 @std.io.printfn(ptr %retparam4, ptr @.str.2, i64 2, ptr %varargslots2, i64 1) store i32 %2, ptr %taddr6, align 4 - %14 = insertvalue %"any*" undef, ptr %taddr6, 0 - %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %16 = getelementptr inbounds [1 x %"any*"], ptr %varargslots5, i64 0, i64 0 - store %"any*" %15, ptr %16, align 16 - %17 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.3, i64 2, ptr %varargslots5, i64 1) + %12 = insertvalue %"any*" undef, ptr %taddr6, 0 + %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %13, ptr %varargslots5, align 16 + %14 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.3, i64 2, ptr %varargslots5, i64 1) store i32 %3, ptr %taddr9, align 4 - %18 = insertvalue %"any*" undef, ptr %taddr9, 0 - %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %20 = getelementptr inbounds [1 x %"any*"], ptr %varargslots8, i64 0, i64 0 - store %"any*" %19, ptr %20, align 16 - %21 = call i64 @std.io.printfn(ptr %retparam10, ptr @.str.4, i64 2, ptr %varargslots8, i64 1) + %15 = insertvalue %"any*" undef, ptr %taddr9, 0 + %16 = insertvalue %"any*" %15, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %16, ptr %varargslots8, align 16 + %17 = call i64 @std.io.printfn(ptr %retparam10, ptr @.str.4, i64 2, ptr %varargslots8, i64 1) store i32 0, ptr %x, align 4 store %"char[]" { ptr @.str.6, i64 3 }, ptr %taddr12, align 8 - %22 = insertvalue %"any*" undef, ptr %taddr12, 0 - %23 = insertvalue %"any*" %22, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %24 = getelementptr inbounds [1 x %"any*"], ptr %varargslots11, i64 0, i64 0 - store %"any*" %23, ptr %24, align 16 - %25 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.5, i64 2, ptr %varargslots11, i64 1) + %18 = insertvalue %"any*" undef, ptr %taddr12, 0 + %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %19, ptr %varargslots11, align 16 + %20 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.5, i64 2, ptr %varargslots11, i64 1) store double 0.000000e+00, ptr %x14, align 8 store %"char[]" { ptr @.str.8, i64 6 }, ptr %taddr16, align 8 - %26 = insertvalue %"any*" undef, ptr %taddr16, 0 - %27 = insertvalue %"any*" %26, i64 ptrtoint (ptr @"$ct.String" to i64), 1 - %28 = getelementptr inbounds [1 x %"any*"], ptr %varargslots15, i64 0, i64 0 - store %"any*" %27, ptr %28, align 16 - %29 = call i64 @std.io.printfn(ptr %retparam17, ptr @.str.7, i64 2, ptr %varargslots15, i64 1) + %21 = insertvalue %"any*" undef, ptr %taddr16, 0 + %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.String" to i64), 1 + store %"any*" %22, ptr %varargslots15, align 16 + %23 = call i64 @std.io.printfn(ptr %retparam17, ptr @.str.7, i64 2, ptr %varargslots15, i64 1) store i32 105, ptr %taddr19, align 4 - %30 = insertvalue %"any*" undef, ptr %taddr19, 0 - %31 = insertvalue %"any*" %30, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %32 = getelementptr inbounds [1 x %"any*"], ptr %varargslots18, i64 0, i64 0 - store %"any*" %31, ptr %32, align 16 - %33 = call i64 @std.io.printfn(ptr %retparam20, ptr @.str.9, i64 2, ptr %varargslots18, i64 1) + %24 = insertvalue %"any*" undef, ptr %taddr19, 0 + %25 = insertvalue %"any*" %24, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %25, ptr %varargslots18, align 16 + %26 = call i64 @std.io.printfn(ptr %retparam20, ptr @.str.9, i64 2, ptr %varargslots18, i64 1) store i32 123, ptr %x21, align 4 store i32 33, ptr %y, align 4 - %34 = load i32, ptr %x21, align 4 - store i32 %34, ptr %a, align 4 - %35 = load i32, ptr %y, align 4 - store i32 %35, ptr %x21, align 4 - %36 = load i32, ptr %a, align 4 - store i32 %36, ptr %y, align 4 - %37 = insertvalue %"any*" undef, ptr %x21, 0 - %38 = insertvalue %"any*" %37, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %39 = getelementptr inbounds [2 x %"any*"], ptr %varargslots22, i64 0, i64 0 - store %"any*" %38, ptr %39, align 16 + %27 = load i32, ptr %x21, align 4 + store i32 %27, ptr %a, align 4 + %28 = load i32, ptr %y, align 4 + store i32 %28, ptr %x21, align 4 + %29 = load i32, ptr %a, align 4 + store i32 %29, ptr %y, align 4 + %30 = insertvalue %"any*" undef, ptr %x21, 0 + %31 = insertvalue %"any*" %30, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %31, ptr %varargslots22, align 16 + %32 = insertvalue %"any*" undef, ptr %y, 0 + %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots22, i64 16 + store %"any*" %33, ptr %ptradd, align 16 + %34 = call i64 @std.io.printfn(ptr %retparam23, ptr @.str.10, i64 6, ptr %varargslots22, i64 2) + %35 = load i32, ptr %x21, align 4 + store i32 %35, ptr %a24, align 4 + %36 = load i32, ptr %y, align 4 + store i32 %36, ptr %x21, align 4 + %37 = load i32, ptr %a24, align 4 + store i32 %37, ptr %y, align 4 + %38 = insertvalue %"any*" undef, ptr %x21, 0 + %39 = insertvalue %"any*" %38, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %39, ptr %varargslots25, align 16 %40 = insertvalue %"any*" undef, ptr %y, 0 %41 = insertvalue %"any*" %40, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %42 = getelementptr inbounds [2 x %"any*"], ptr %varargslots22, i64 0, i64 1 - store %"any*" %41, ptr %42, align 16 - %43 = call i64 @std.io.printfn(ptr %retparam23, ptr @.str.10, i64 6, ptr %varargslots22, i64 2) - %44 = load i32, ptr %x21, align 4 - store i32 %44, ptr %a24, align 4 - %45 = load i32, ptr %y, align 4 - store i32 %45, ptr %x21, align 4 - %46 = load i32, ptr %a24, align 4 - store i32 %46, ptr %y, align 4 - %47 = insertvalue %"any*" undef, ptr %x21, 0 - %48 = insertvalue %"any*" %47, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %49 = getelementptr inbounds [2 x %"any*"], ptr %varargslots25, i64 0, i64 0 - store %"any*" %48, ptr %49, align 16 - %50 = insertvalue %"any*" undef, ptr %y, 0 - %51 = insertvalue %"any*" %50, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %52 = getelementptr inbounds [2 x %"any*"], ptr %varargslots25, i64 0, i64 1 - store %"any*" %51, ptr %52, align 16 - %53 = call i64 @std.io.printfn(ptr %retparam26, ptr @.str.11, i64 6, ptr %varargslots25, i64 2) + %ptradd26 = getelementptr inbounds i8, ptr %varargslots25, i64 16 + store %"any*" %41, ptr %ptradd26, align 16 + %42 = call i64 @std.io.printfn(ptr %retparam27, ptr @.str.11, i64 6, ptr %varargslots25, i64 2) ret void } \ No newline at end of file diff --git a/test/test_suite/macros/macro_vasplat.c3t b/test/test_suite/macros/macro_vasplat.c3t index 34927625e..60c5ef61e 100644 --- a/test/test_suite/macros/macro_vasplat.c3t +++ b/test/test_suite/macros/macro_vasplat.c3t @@ -72,70 +72,70 @@ entry: %retparam = alloca i64, align 8 %a1 = alloca [1 x i32], align 4 %.anon2 = alloca i64, align 8 - %i6 = alloca i64, align 8 - %x7 = alloca i32, align 4 - %varargslots8 = alloca [2 x %"any*"], align 16 - %retparam9 = alloca i64, align 8 - %a12 = alloca [4 x i32], align 16 - %.anon13 = alloca i64, align 8 - %i17 = alloca i64, align 8 - %x18 = alloca i32, align 4 - %varargslots19 = alloca [2 x %"any*"], align 16 - %retparam20 = alloca i64, align 8 - %a23 = alloca [2 x i32], align 4 - %.anon24 = alloca i64, align 8 - %i28 = alloca i64, align 8 - %x29 = alloca i32, align 4 - %varargslots30 = alloca [2 x %"any*"], align 16 + %i3 = alloca i64, align 8 + %x4 = alloca i32, align 4 + %varargslots5 = alloca [2 x %"any*"], align 16 + %retparam7 = alloca i64, align 8 + %a8 = alloca [4 x i32], align 16 + %.anon9 = alloca i64, align 8 + %i13 = alloca i64, align 8 + %x14 = alloca i32, align 4 + %varargslots16 = alloca [2 x %"any*"], align 16 + %retparam18 = alloca i64, align 8 + %a21 = alloca [2 x i32], align 4 + %.anon22 = alloca i64, align 8 + %i26 = alloca i64, align 8 + %x27 = alloca i32, align 4 + %varargslots29 = alloca [2 x %"any*"], align 16 %retparam31 = alloca i64, align 8 %a34 = alloca [3 x i32], align 4 %.anon35 = alloca i64, align 8 %i39 = alloca i64, align 8 %x40 = alloca i32, align 4 - %varargslots41 = alloca [2 x %"any*"], align 16 - %retparam42 = alloca i64, align 8 - %a45 = alloca [1 x i32], align 4 - %.anon46 = alloca i64, align 8 - %i50 = alloca i64, align 8 - %x51 = alloca i32, align 4 - %varargslots52 = alloca [2 x %"any*"], align 16 + %varargslots42 = alloca [2 x %"any*"], align 16 + %retparam44 = alloca i64, align 8 + %a47 = alloca [1 x i32], align 4 + %.anon48 = alloca i64, align 8 + %i49 = alloca i64, align 8 + %x50 = alloca i32, align 4 + %varargslots51 = alloca [2 x %"any*"], align 16 %retparam53 = alloca i64, align 8 - %a56 = alloca [2 x i32], align 4 - %.anon57 = alloca i64, align 8 - %i61 = alloca i64, align 8 - %x62 = alloca i32, align 4 - %varargslots63 = alloca [2 x %"any*"], align 16 + %a54 = alloca [2 x i32], align 4 + %.anon55 = alloca i64, align 8 + %i59 = alloca i64, align 8 + %x60 = alloca i32, align 4 + %varargslots62 = alloca [2 x %"any*"], align 16 %retparam64 = alloca i64, align 8 %a67 = alloca [5 x i32], align 16 %.anon68 = alloca i64, align 8 %i72 = alloca i64, align 8 %x73 = alloca i32, align 4 - %varargslots74 = alloca [2 x %"any*"], align 16 - %retparam75 = alloca i64, align 8 - %a78 = alloca [8 x i32], align 16 - %.anon79 = alloca i64, align 8 - %i83 = alloca i64, align 8 - %x84 = alloca i32, align 4 - %varargslots85 = alloca [2 x %"any*"], align 16 - %retparam86 = alloca i64, align 8 + %varargslots75 = alloca [2 x %"any*"], align 16 + %retparam77 = alloca i64, align 8 + %a80 = alloca [8 x i32], align 16 + %.anon81 = alloca i64, align 8 + %i85 = alloca i64, align 8 + %x86 = alloca i32, align 4 + %varargslots88 = alloca [2 x %"any*"], align 16 + %retparam90 = alloca i64, align 8 %b = alloca [7 x i32], align 16 - %.anon89 = alloca i64, align 8 - %i93 = alloca i64, align 8 - %x94 = alloca i32, align 4 - %varargslots95 = alloca [2 x %"any*"], align 16 - %retparam96 = alloca i64, align 8 + %.anon93 = alloca i64, align 8 + %i97 = alloca i64, align 8 + %x98 = alloca i32, align 4 + %varargslots100 = alloca [2 x %"any*"], align 16 + %retparam102 = alloca i64, align 8 %c = alloca [8 x i32], align 16 - %.anon99 = alloca i64, align 8 - %i103 = alloca i64, align 8 - %x104 = alloca i32, align 4 - %varargslots105 = alloca [2 x %"any*"], align 16 - %retparam106 = alloca i64, align 8 - %a109 = alloca [6 x i32], align 16 - %.anon110 = alloca i64, align 8 - %i114 = alloca i64, align 8 - %x115 = alloca i32, align 4 - %varargslots116 = alloca [2 x %"any*"], align 16 - %retparam117 = alloca i64, align 8 + %.anon105 = alloca i64, align 8 + %i109 = alloca i64, align 8 + %x110 = alloca i32, align 4 + %varargslots112 = alloca [2 x %"any*"], align 16 + %retparam114 = alloca i64, align 8 + %a117 = alloca [6 x i32], align 16 + %.anon118 = alloca i64, align 8 + %i122 = alloca i64, align 8 + %x123 = alloca i32, align 4 + %varargslots125 = alloca [2 x %"any*"], align 16 + %retparam127 = alloca i64, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a, ptr align 4 @.__const, i32 12, i1 false) store i64 0, ptr %.anon, align 8 br label %loop.cond @@ -149,364 +149,320 @@ loop.body: ; preds = %loop.cond %1 = load i64, ptr %.anon, align 8 store i64 %1, ptr %i, align 8 %2 = load i64, ptr %.anon, align 8 - %3 = getelementptr inbounds [3 x i32], ptr %a, i64 0, i64 %2 - %4 = load i32, ptr %3, align 4 - store i32 %4, ptr %x, align 4 - %5 = insertvalue %"any*" undef, ptr %i, 0 - %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %7 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %6, ptr %7, align 16 - %8 = insertvalue %"any*" undef, ptr %x, 0 - %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %10 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %9, ptr %10, align 16 - %11 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 8, ptr %varargslots, i64 2) - %12 = load i64, ptr %.anon, align 8 - %add = add i64 %12, 1 + %ptroffset = getelementptr inbounds [4 x i8], ptr %a, i64 %2 + %3 = load i32, ptr %ptroffset, align 4 + store i32 %3, ptr %x, align 4 + %4 = insertvalue %"any*" undef, ptr %i, 0 + %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %5, ptr %varargslots, align 16 + %6 = insertvalue %"any*" undef, ptr %x, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %7, ptr %ptradd, align 16 + %8 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 8, ptr %varargslots, i64 2) + %9 = load i64, ptr %.anon, align 8 + %add = add i64 %9, 1 store i64 %add, ptr %.anon, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a1, ptr align 4 @.__const.1, i32 4, i1 false) store i64 0, ptr %.anon2, align 8 - br label %loop.cond3 - -loop.cond3: ; preds = %loop.body5, %loop.exit - %13 = load i64, ptr %.anon2, align 8 - %gt4 = icmp ugt i64 1, %13 - br i1 %gt4, label %loop.body5, label %loop.exit11 - -loop.body5: ; preds = %loop.cond3 - %14 = load i64, ptr %.anon2, align 8 - store i64 %14, ptr %i6, align 8 - %15 = load i64, ptr %.anon2, align 8 - %16 = getelementptr inbounds [1 x i32], ptr %a1, i64 0, i64 %15 - %17 = load i32, ptr %16, align 4 - store i32 %17, ptr %x7, align 4 - %18 = insertvalue %"any*" undef, ptr %i6, 0 - %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %20 = getelementptr inbounds [2 x %"any*"], ptr %varargslots8, i64 0, i64 0 - store %"any*" %19, ptr %20, align 16 - %21 = insertvalue %"any*" undef, ptr %x7, 0 - %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %23 = getelementptr inbounds [2 x %"any*"], ptr %varargslots8, i64 0, i64 1 - store %"any*" %22, ptr %23, align 16 - %24 = call i64 @std.io.printfn(ptr %retparam9, ptr @.str.2, i64 8, ptr %varargslots8, i64 2) - %25 = load i64, ptr %.anon2, align 8 - %add10 = add i64 %25, 1 - store i64 %add10, ptr %.anon2, align 8 - br label %loop.cond3 - -loop.exit11: ; preds = %loop.cond3 - call void @llvm.memcpy.p0.p0.i32(ptr align 16 %a12, ptr align 16 @.__const.3, i32 16, i1 false) - store i64 0, ptr %.anon13, align 8 - br label %loop.cond14 - -loop.cond14: ; preds = %loop.body16, %loop.exit11 - %26 = load i64, ptr %.anon13, align 8 - %gt15 = icmp ugt i64 4, %26 - br i1 %gt15, label %loop.body16, label %loop.exit22 - -loop.body16: ; preds = %loop.cond14 - %27 = load i64, ptr %.anon13, align 8 - store i64 %27, ptr %i17, align 8 - %28 = load i64, ptr %.anon13, align 8 - %29 = getelementptr inbounds [4 x i32], ptr %a12, i64 0, i64 %28 - %30 = load i32, ptr %29, align 4 - store i32 %30, ptr %x18, align 4 - %31 = insertvalue %"any*" undef, ptr %i17, 0 + %10 = load i64, ptr %.anon2, align 8 + store i64 %10, ptr %i3, align 8 + %11 = load i32, ptr %a1, align 4 + store i32 %11, ptr %x4, align 4 + %12 = insertvalue %"any*" undef, ptr %i3, 0 + %13 = insertvalue %"any*" %12, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %13, ptr %varargslots5, align 16 + %14 = insertvalue %"any*" undef, ptr %x4, 0 + %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd6 = getelementptr inbounds i8, ptr %varargslots5, i64 16 + store %"any*" %15, ptr %ptradd6, align 16 + %16 = call i64 @std.io.printfn(ptr %retparam7, ptr @.str.2, i64 8, ptr %varargslots5, i64 2) + call void @llvm.memcpy.p0.p0.i32(ptr align 16 %a8, ptr align 16 @.__const.3, i32 16, i1 false) + store i64 0, ptr %.anon9, align 8 + br label %loop.cond10 + +loop.cond10: ; preds = %loop.body12, %loop.exit + %17 = load i64, ptr %.anon9, align 8 + %gt11 = icmp ugt i64 4, %17 + br i1 %gt11, label %loop.body12, label %loop.exit20 + +loop.body12: ; preds = %loop.cond10 + %18 = load i64, ptr %.anon9, align 8 + store i64 %18, ptr %i13, align 8 + %19 = load i64, ptr %.anon9, align 8 + %ptroffset15 = getelementptr inbounds [4 x i8], ptr %a8, i64 %19 + %20 = load i32, ptr %ptroffset15, align 4 + store i32 %20, ptr %x14, align 4 + %21 = insertvalue %"any*" undef, ptr %i13, 0 + %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %22, ptr %varargslots16, align 16 + %23 = insertvalue %"any*" undef, ptr %x14, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd17 = getelementptr inbounds i8, ptr %varargslots16, i64 16 + store %"any*" %24, ptr %ptradd17, align 16 + %25 = call i64 @std.io.printfn(ptr %retparam18, ptr @.str.4, i64 6, ptr %varargslots16, i64 2) + %26 = load i64, ptr %.anon9, align 8 + %add19 = add i64 %26, 1 + store i64 %add19, ptr %.anon9, align 8 + br label %loop.cond10 + +loop.exit20: ; preds = %loop.cond10 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a21, ptr align 4 @.__const.5, i32 8, i1 false) + store i64 0, ptr %.anon22, align 8 + br label %loop.cond23 + +loop.cond23: ; preds = %loop.body25, %loop.exit20 + %27 = load i64, ptr %.anon22, align 8 + %gt24 = icmp ugt i64 2, %27 + br i1 %gt24, label %loop.body25, label %loop.exit33 + +loop.body25: ; preds = %loop.cond23 + %28 = load i64, ptr %.anon22, align 8 + store i64 %28, ptr %i26, align 8 + %29 = load i64, ptr %.anon22, align 8 + %ptroffset28 = getelementptr inbounds [4 x i8], ptr %a21, i64 %29 + %30 = load i32, ptr %ptroffset28, align 4 + store i32 %30, ptr %x27, align 4 + %31 = insertvalue %"any*" undef, ptr %i26, 0 %32 = insertvalue %"any*" %31, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %33 = getelementptr inbounds [2 x %"any*"], ptr %varargslots19, i64 0, i64 0 - store %"any*" %32, ptr %33, align 16 - %34 = insertvalue %"any*" undef, ptr %x18, 0 - %35 = insertvalue %"any*" %34, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %36 = getelementptr inbounds [2 x %"any*"], ptr %varargslots19, i64 0, i64 1 - store %"any*" %35, ptr %36, align 16 - %37 = call i64 @std.io.printfn(ptr %retparam20, ptr @.str.4, i64 6, ptr %varargslots19, i64 2) - %38 = load i64, ptr %.anon13, align 8 - %add21 = add i64 %38, 1 - store i64 %add21, ptr %.anon13, align 8 - br label %loop.cond14 - -loop.exit22: ; preds = %loop.cond14 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a23, ptr align 4 @.__const.5, i32 8, i1 false) - store i64 0, ptr %.anon24, align 8 - br label %loop.cond25 - -loop.cond25: ; preds = %loop.body27, %loop.exit22 - %39 = load i64, ptr %.anon24, align 8 - %gt26 = icmp ugt i64 2, %39 - br i1 %gt26, label %loop.body27, label %loop.exit33 - -loop.body27: ; preds = %loop.cond25 - %40 = load i64, ptr %.anon24, align 8 - store i64 %40, ptr %i28, align 8 - %41 = load i64, ptr %.anon24, align 8 - %42 = getelementptr inbounds [2 x i32], ptr %a23, i64 0, i64 %41 - %43 = load i32, ptr %42, align 4 - store i32 %43, ptr %x29, align 4 - %44 = insertvalue %"any*" undef, ptr %i28, 0 - %45 = insertvalue %"any*" %44, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %46 = getelementptr inbounds [2 x %"any*"], ptr %varargslots30, i64 0, i64 0 - store %"any*" %45, ptr %46, align 16 - %47 = insertvalue %"any*" undef, ptr %x29, 0 - %48 = insertvalue %"any*" %47, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %49 = getelementptr inbounds [2 x %"any*"], ptr %varargslots30, i64 0, i64 1 - store %"any*" %48, ptr %49, align 16 - %50 = call i64 @std.io.printfn(ptr %retparam31, ptr @.str.6, i64 6, ptr %varargslots30, i64 2) - %51 = load i64, ptr %.anon24, align 8 - %add32 = add i64 %51, 1 - store i64 %add32, ptr %.anon24, align 8 - br label %loop.cond25 - -loop.exit33: ; preds = %loop.cond25 + store %"any*" %32, ptr %varargslots29, align 16 + %33 = insertvalue %"any*" undef, ptr %x27, 0 + %34 = insertvalue %"any*" %33, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd30 = getelementptr inbounds i8, ptr %varargslots29, i64 16 + store %"any*" %34, ptr %ptradd30, align 16 + %35 = call i64 @std.io.printfn(ptr %retparam31, ptr @.str.6, i64 6, ptr %varargslots29, i64 2) + %36 = load i64, ptr %.anon22, align 8 + %add32 = add i64 %36, 1 + store i64 %add32, ptr %.anon22, align 8 + br label %loop.cond23 + +loop.exit33: ; preds = %loop.cond23 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a34, ptr align 4 @.__const.7, i32 12, i1 false) store i64 0, ptr %.anon35, align 8 br label %loop.cond36 loop.cond36: ; preds = %loop.body38, %loop.exit33 - %52 = load i64, ptr %.anon35, align 8 - %gt37 = icmp ugt i64 3, %52 - br i1 %gt37, label %loop.body38, label %loop.exit44 + %37 = load i64, ptr %.anon35, align 8 + %gt37 = icmp ugt i64 3, %37 + br i1 %gt37, label %loop.body38, label %loop.exit46 loop.body38: ; preds = %loop.cond36 - %53 = load i64, ptr %.anon35, align 8 - store i64 %53, ptr %i39, align 8 - %54 = load i64, ptr %.anon35, align 8 - %55 = getelementptr inbounds [3 x i32], ptr %a34, i64 0, i64 %54 - %56 = load i32, ptr %55, align 4 - store i32 %56, ptr %x40, align 4 - %57 = insertvalue %"any*" undef, ptr %i39, 0 - %58 = insertvalue %"any*" %57, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %59 = getelementptr inbounds [2 x %"any*"], ptr %varargslots41, i64 0, i64 0 - store %"any*" %58, ptr %59, align 16 - %60 = insertvalue %"any*" undef, ptr %x40, 0 - %61 = insertvalue %"any*" %60, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %62 = getelementptr inbounds [2 x %"any*"], ptr %varargslots41, i64 0, i64 1 - store %"any*" %61, ptr %62, align 16 - %63 = call i64 @std.io.printfn(ptr %retparam42, ptr @.str.8, i64 8, ptr %varargslots41, i64 2) - %64 = load i64, ptr %.anon35, align 8 - %add43 = add i64 %64, 1 - store i64 %add43, ptr %.anon35, align 8 + %38 = load i64, ptr %.anon35, align 8 + store i64 %38, ptr %i39, align 8 + %39 = load i64, ptr %.anon35, align 8 + %ptroffset41 = getelementptr inbounds [4 x i8], ptr %a34, i64 %39 + %40 = load i32, ptr %ptroffset41, align 4 + store i32 %40, ptr %x40, align 4 + %41 = insertvalue %"any*" undef, ptr %i39, 0 + %42 = insertvalue %"any*" %41, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %42, ptr %varargslots42, align 16 + %43 = insertvalue %"any*" undef, ptr %x40, 0 + %44 = insertvalue %"any*" %43, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd43 = getelementptr inbounds i8, ptr %varargslots42, i64 16 + store %"any*" %44, ptr %ptradd43, align 16 + %45 = call i64 @std.io.printfn(ptr %retparam44, ptr @.str.8, i64 8, ptr %varargslots42, i64 2) + %46 = load i64, ptr %.anon35, align 8 + %add45 = add i64 %46, 1 + store i64 %add45, ptr %.anon35, align 8 br label %loop.cond36 -loop.exit44: ; preds = %loop.cond36 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a45, ptr align 4 @.__const.9, i32 4, i1 false) - store i64 0, ptr %.anon46, align 8 - br label %loop.cond47 - -loop.cond47: ; preds = %loop.body49, %loop.exit44 - %65 = load i64, ptr %.anon46, align 8 - %gt48 = icmp ugt i64 1, %65 - br i1 %gt48, label %loop.body49, label %loop.exit55 - -loop.body49: ; preds = %loop.cond47 - %66 = load i64, ptr %.anon46, align 8 - store i64 %66, ptr %i50, align 8 - %67 = load i64, ptr %.anon46, align 8 - %68 = getelementptr inbounds [1 x i32], ptr %a45, i64 0, i64 %67 - %69 = load i32, ptr %68, align 4 - store i32 %69, ptr %x51, align 4 - %70 = insertvalue %"any*" undef, ptr %i50, 0 - %71 = insertvalue %"any*" %70, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %72 = getelementptr inbounds [2 x %"any*"], ptr %varargslots52, i64 0, i64 0 - store %"any*" %71, ptr %72, align 16 - %73 = insertvalue %"any*" undef, ptr %x51, 0 - %74 = insertvalue %"any*" %73, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %75 = getelementptr inbounds [2 x %"any*"], ptr %varargslots52, i64 0, i64 1 - store %"any*" %74, ptr %75, align 16 - %76 = call i64 @std.io.printfn(ptr %retparam53, ptr @.str.10, i64 8, ptr %varargslots52, i64 2) - %77 = load i64, ptr %.anon46, align 8 - %add54 = add i64 %77, 1 - store i64 %add54, ptr %.anon46, align 8 - br label %loop.cond47 - -loop.exit55: ; preds = %loop.cond47 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a56, ptr align 4 @.__const.11, i32 8, i1 false) - store i64 0, ptr %.anon57, align 8 - br label %loop.cond58 - -loop.cond58: ; preds = %loop.body60, %loop.exit55 - %78 = load i64, ptr %.anon57, align 8 - %gt59 = icmp ugt i64 2, %78 - br i1 %gt59, label %loop.body60, label %loop.exit66 - -loop.body60: ; preds = %loop.cond58 - %79 = load i64, ptr %.anon57, align 8 - store i64 %79, ptr %i61, align 8 - %80 = load i64, ptr %.anon57, align 8 - %81 = getelementptr inbounds [2 x i32], ptr %a56, i64 0, i64 %80 - %82 = load i32, ptr %81, align 4 - store i32 %82, ptr %x62, align 4 - %83 = insertvalue %"any*" undef, ptr %i61, 0 - %84 = insertvalue %"any*" %83, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %85 = getelementptr inbounds [2 x %"any*"], ptr %varargslots63, i64 0, i64 0 - store %"any*" %84, ptr %85, align 16 - %86 = insertvalue %"any*" undef, ptr %x62, 0 - %87 = insertvalue %"any*" %86, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %88 = getelementptr inbounds [2 x %"any*"], ptr %varargslots63, i64 0, i64 1 - store %"any*" %87, ptr %88, align 16 - %89 = call i64 @std.io.printfn(ptr %retparam64, ptr @.str.12, i64 8, ptr %varargslots63, i64 2) - %90 = load i64, ptr %.anon57, align 8 - %add65 = add i64 %90, 1 - store i64 %add65, ptr %.anon57, align 8 - br label %loop.cond58 - -loop.exit66: ; preds = %loop.cond58 +loop.exit46: ; preds = %loop.cond36 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a47, ptr align 4 @.__const.9, i32 4, i1 false) + store i64 0, ptr %.anon48, align 8 + %47 = load i64, ptr %.anon48, align 8 + store i64 %47, ptr %i49, align 8 + %48 = load i32, ptr %a47, align 4 + store i32 %48, ptr %x50, align 4 + %49 = insertvalue %"any*" undef, ptr %i49, 0 + %50 = insertvalue %"any*" %49, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %50, ptr %varargslots51, align 16 + %51 = insertvalue %"any*" undef, ptr %x50, 0 + %52 = insertvalue %"any*" %51, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd52 = getelementptr inbounds i8, ptr %varargslots51, i64 16 + store %"any*" %52, ptr %ptradd52, align 16 + %53 = call i64 @std.io.printfn(ptr %retparam53, ptr @.str.10, i64 8, ptr %varargslots51, i64 2) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %a54, ptr align 4 @.__const.11, i32 8, i1 false) + store i64 0, ptr %.anon55, align 8 + br label %loop.cond56 + +loop.cond56: ; preds = %loop.body58, %loop.exit46 + %54 = load i64, ptr %.anon55, align 8 + %gt57 = icmp ugt i64 2, %54 + br i1 %gt57, label %loop.body58, label %loop.exit66 + +loop.body58: ; preds = %loop.cond56 + %55 = load i64, ptr %.anon55, align 8 + store i64 %55, ptr %i59, align 8 + %56 = load i64, ptr %.anon55, align 8 + %ptroffset61 = getelementptr inbounds [4 x i8], ptr %a54, i64 %56 + %57 = load i32, ptr %ptroffset61, align 4 + store i32 %57, ptr %x60, align 4 + %58 = insertvalue %"any*" undef, ptr %i59, 0 + %59 = insertvalue %"any*" %58, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %59, ptr %varargslots62, align 16 + %60 = insertvalue %"any*" undef, ptr %x60, 0 + %61 = insertvalue %"any*" %60, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd63 = getelementptr inbounds i8, ptr %varargslots62, i64 16 + store %"any*" %61, ptr %ptradd63, align 16 + %62 = call i64 @std.io.printfn(ptr %retparam64, ptr @.str.12, i64 8, ptr %varargslots62, i64 2) + %63 = load i64, ptr %.anon55, align 8 + %add65 = add i64 %63, 1 + store i64 %add65, ptr %.anon55, align 8 + br label %loop.cond56 + +loop.exit66: ; preds = %loop.cond56 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %a67, ptr align 16 @.__const.13, i32 20, i1 false) store i64 0, ptr %.anon68, align 8 br label %loop.cond69 loop.cond69: ; preds = %loop.body71, %loop.exit66 - %91 = load i64, ptr %.anon68, align 8 - %gt70 = icmp ugt i64 5, %91 - br i1 %gt70, label %loop.body71, label %loop.exit77 + %64 = load i64, ptr %.anon68, align 8 + %gt70 = icmp ugt i64 5, %64 + br i1 %gt70, label %loop.body71, label %loop.exit79 loop.body71: ; preds = %loop.cond69 - %92 = load i64, ptr %.anon68, align 8 - store i64 %92, ptr %i72, align 8 - %93 = load i64, ptr %.anon68, align 8 - %94 = getelementptr inbounds [5 x i32], ptr %a67, i64 0, i64 %93 - %95 = load i32, ptr %94, align 4 - store i32 %95, ptr %x73, align 4 - %96 = insertvalue %"any*" undef, ptr %i72, 0 - %97 = insertvalue %"any*" %96, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %98 = getelementptr inbounds [2 x %"any*"], ptr %varargslots74, i64 0, i64 0 - store %"any*" %97, ptr %98, align 16 - %99 = insertvalue %"any*" undef, ptr %x73, 0 - %100 = insertvalue %"any*" %99, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %101 = getelementptr inbounds [2 x %"any*"], ptr %varargslots74, i64 0, i64 1 - store %"any*" %100, ptr %101, align 16 - %102 = call i64 @std.io.printfn(ptr %retparam75, ptr @.str.14, i64 8, ptr %varargslots74, i64 2) - %103 = load i64, ptr %.anon68, align 8 - %add76 = add i64 %103, 1 - store i64 %add76, ptr %.anon68, align 8 + %65 = load i64, ptr %.anon68, align 8 + store i64 %65, ptr %i72, align 8 + %66 = load i64, ptr %.anon68, align 8 + %ptroffset74 = getelementptr inbounds [4 x i8], ptr %a67, i64 %66 + %67 = load i32, ptr %ptroffset74, align 4 + store i32 %67, ptr %x73, align 4 + %68 = insertvalue %"any*" undef, ptr %i72, 0 + %69 = insertvalue %"any*" %68, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %69, ptr %varargslots75, align 16 + %70 = insertvalue %"any*" undef, ptr %x73, 0 + %71 = insertvalue %"any*" %70, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd76 = getelementptr inbounds i8, ptr %varargslots75, i64 16 + store %"any*" %71, ptr %ptradd76, align 16 + %72 = call i64 @std.io.printfn(ptr %retparam77, ptr @.str.14, i64 8, ptr %varargslots75, i64 2) + %73 = load i64, ptr %.anon68, align 8 + %add78 = add i64 %73, 1 + store i64 %add78, ptr %.anon68, align 8 br label %loop.cond69 -loop.exit77: ; preds = %loop.cond69 - call void @llvm.memcpy.p0.p0.i32(ptr align 16 %a78, ptr align 16 @.__const.15, i32 32, i1 false) - store i64 0, ptr %.anon79, align 8 - br label %loop.cond80 - -loop.cond80: ; preds = %loop.body82, %loop.exit77 - %104 = load i64, ptr %.anon79, align 8 - %gt81 = icmp ugt i64 8, %104 - br i1 %gt81, label %loop.body82, label %loop.exit88 - -loop.body82: ; preds = %loop.cond80 - %105 = load i64, ptr %.anon79, align 8 - store i64 %105, ptr %i83, align 8 - %106 = load i64, ptr %.anon79, align 8 - %107 = getelementptr inbounds [8 x i32], ptr %a78, i64 0, i64 %106 - %108 = load i32, ptr %107, align 4 - store i32 %108, ptr %x84, align 4 - %109 = insertvalue %"any*" undef, ptr %i83, 0 - %110 = insertvalue %"any*" %109, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %111 = getelementptr inbounds [2 x %"any*"], ptr %varargslots85, i64 0, i64 0 - store %"any*" %110, ptr %111, align 16 - %112 = insertvalue %"any*" undef, ptr %x84, 0 - %113 = insertvalue %"any*" %112, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %114 = getelementptr inbounds [2 x %"any*"], ptr %varargslots85, i64 0, i64 1 - store %"any*" %113, ptr %114, align 16 - %115 = call i64 @std.io.printfn(ptr %retparam86, ptr @.str.16, i64 8, ptr %varargslots85, i64 2) - %116 = load i64, ptr %.anon79, align 8 - %add87 = add i64 %116, 1 - store i64 %add87, ptr %.anon79, align 8 - br label %loop.cond80 - -loop.exit88: ; preds = %loop.cond80 +loop.exit79: ; preds = %loop.cond69 + call void @llvm.memcpy.p0.p0.i32(ptr align 16 %a80, ptr align 16 @.__const.15, i32 32, i1 false) + store i64 0, ptr %.anon81, align 8 + br label %loop.cond82 + +loop.cond82: ; preds = %loop.body84, %loop.exit79 + %74 = load i64, ptr %.anon81, align 8 + %gt83 = icmp ugt i64 8, %74 + br i1 %gt83, label %loop.body84, label %loop.exit92 + +loop.body84: ; preds = %loop.cond82 + %75 = load i64, ptr %.anon81, align 8 + store i64 %75, ptr %i85, align 8 + %76 = load i64, ptr %.anon81, align 8 + %ptroffset87 = getelementptr inbounds [4 x i8], ptr %a80, i64 %76 + %77 = load i32, ptr %ptroffset87, align 4 + store i32 %77, ptr %x86, align 4 + %78 = insertvalue %"any*" undef, ptr %i85, 0 + %79 = insertvalue %"any*" %78, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %79, ptr %varargslots88, align 16 + %80 = insertvalue %"any*" undef, ptr %x86, 0 + %81 = insertvalue %"any*" %80, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd89 = getelementptr inbounds i8, ptr %varargslots88, i64 16 + store %"any*" %81, ptr %ptradd89, align 16 + %82 = call i64 @std.io.printfn(ptr %retparam90, ptr @.str.16, i64 8, ptr %varargslots88, i64 2) + %83 = load i64, ptr %.anon81, align 8 + %add91 = add i64 %83, 1 + store i64 %add91, ptr %.anon81, align 8 + br label %loop.cond82 + +loop.exit92: ; preds = %loop.cond82 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %b, ptr align 16 @.__const.17, i32 28, i1 false) - store i64 0, ptr %.anon89, align 8 - br label %loop.cond90 - -loop.cond90: ; preds = %loop.body92, %loop.exit88 - %117 = load i64, ptr %.anon89, align 8 - %gt91 = icmp ugt i64 7, %117 - br i1 %gt91, label %loop.body92, label %loop.exit98 - -loop.body92: ; preds = %loop.cond90 - %118 = load i64, ptr %.anon89, align 8 - store i64 %118, ptr %i93, align 8 - %119 = load i64, ptr %.anon89, align 8 - %120 = getelementptr inbounds [7 x i32], ptr %b, i64 0, i64 %119 - %121 = load i32, ptr %120, align 4 - store i32 %121, ptr %x94, align 4 - %122 = insertvalue %"any*" undef, ptr %i93, 0 - %123 = insertvalue %"any*" %122, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %124 = getelementptr inbounds [2 x %"any*"], ptr %varargslots95, i64 0, i64 0 - store %"any*" %123, ptr %124, align 16 - %125 = insertvalue %"any*" undef, ptr %x94, 0 - %126 = insertvalue %"any*" %125, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %127 = getelementptr inbounds [2 x %"any*"], ptr %varargslots95, i64 0, i64 1 - store %"any*" %126, ptr %127, align 16 - %128 = call i64 @std.io.printfn(ptr %retparam96, ptr @.str.18, i64 8, ptr %varargslots95, i64 2) - %129 = load i64, ptr %.anon89, align 8 - %add97 = add i64 %129, 1 - store i64 %add97, ptr %.anon89, align 8 - br label %loop.cond90 - -loop.exit98: ; preds = %loop.cond90 + store i64 0, ptr %.anon93, align 8 + br label %loop.cond94 + +loop.cond94: ; preds = %loop.body96, %loop.exit92 + %84 = load i64, ptr %.anon93, align 8 + %gt95 = icmp ugt i64 7, %84 + br i1 %gt95, label %loop.body96, label %loop.exit104 + +loop.body96: ; preds = %loop.cond94 + %85 = load i64, ptr %.anon93, align 8 + store i64 %85, ptr %i97, align 8 + %86 = load i64, ptr %.anon93, align 8 + %ptroffset99 = getelementptr inbounds [4 x i8], ptr %b, i64 %86 + %87 = load i32, ptr %ptroffset99, align 4 + store i32 %87, ptr %x98, align 4 + %88 = insertvalue %"any*" undef, ptr %i97, 0 + %89 = insertvalue %"any*" %88, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %89, ptr %varargslots100, align 16 + %90 = insertvalue %"any*" undef, ptr %x98, 0 + %91 = insertvalue %"any*" %90, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd101 = getelementptr inbounds i8, ptr %varargslots100, i64 16 + store %"any*" %91, ptr %ptradd101, align 16 + %92 = call i64 @std.io.printfn(ptr %retparam102, ptr @.str.18, i64 8, ptr %varargslots100, i64 2) + %93 = load i64, ptr %.anon93, align 8 + %add103 = add i64 %93, 1 + store i64 %add103, ptr %.anon93, align 8 + br label %loop.cond94 + +loop.exit104: ; preds = %loop.cond94 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %c, ptr align 16 @.__const.19, i32 32, i1 false) - store i64 0, ptr %.anon99, align 8 - br label %loop.cond100 - -loop.cond100: ; preds = %loop.body102, %loop.exit98 - %130 = load i64, ptr %.anon99, align 8 - %gt101 = icmp ugt i64 8, %130 - br i1 %gt101, label %loop.body102, label %loop.exit108 - -loop.body102: ; preds = %loop.cond100 - %131 = load i64, ptr %.anon99, align 8 - store i64 %131, ptr %i103, align 8 - %132 = load i64, ptr %.anon99, align 8 - %133 = getelementptr inbounds [8 x i32], ptr %c, i64 0, i64 %132 - %134 = load i32, ptr %133, align 4 - store i32 %134, ptr %x104, align 4 - %135 = insertvalue %"any*" undef, ptr %i103, 0 - %136 = insertvalue %"any*" %135, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %137 = getelementptr inbounds [2 x %"any*"], ptr %varargslots105, i64 0, i64 0 - store %"any*" %136, ptr %137, align 16 - %138 = insertvalue %"any*" undef, ptr %x104, 0 - %139 = insertvalue %"any*" %138, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %140 = getelementptr inbounds [2 x %"any*"], ptr %varargslots105, i64 0, i64 1 - store %"any*" %139, ptr %140, align 16 - %141 = call i64 @std.io.printfn(ptr %retparam106, ptr @.str.20, i64 9, ptr %varargslots105, i64 2) - %142 = load i64, ptr %.anon99, align 8 - %add107 = add i64 %142, 1 - store i64 %add107, ptr %.anon99, align 8 - br label %loop.cond100 - -loop.exit108: ; preds = %loop.cond100 - call void @llvm.memcpy.p0.p0.i32(ptr align 16 %a109, ptr align 16 @.__const.21, i32 24, i1 false) - store i64 0, ptr %.anon110, align 8 - br label %loop.cond111 - -loop.cond111: ; preds = %loop.body113, %loop.exit108 - %143 = load i64, ptr %.anon110, align 8 - %gt112 = icmp ugt i64 6, %143 - br i1 %gt112, label %loop.body113, label %loop.exit119 - -loop.body113: ; preds = %loop.cond111 - %144 = load i64, ptr %.anon110, align 8 - store i64 %144, ptr %i114, align 8 - %145 = load i64, ptr %.anon110, align 8 - %146 = getelementptr inbounds [6 x i32], ptr %a109, i64 0, i64 %145 - %147 = load i32, ptr %146, align 4 - store i32 %147, ptr %x115, align 4 - %148 = insertvalue %"any*" undef, ptr %i114, 0 - %149 = insertvalue %"any*" %148, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 - %150 = getelementptr inbounds [2 x %"any*"], ptr %varargslots116, i64 0, i64 0 - store %"any*" %149, ptr %150, align 16 - %151 = insertvalue %"any*" undef, ptr %x115, 0 - %152 = insertvalue %"any*" %151, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %153 = getelementptr inbounds [2 x %"any*"], ptr %varargslots116, i64 0, i64 1 - store %"any*" %152, ptr %153, align 16 - %154 = call i64 @std.io.printfn(ptr %retparam117, ptr @.str.22, i64 6, ptr %varargslots116, i64 2) - %155 = load i64, ptr %.anon110, align 8 - %add118 = add i64 %155, 1 - store i64 %add118, ptr %.anon110, align 8 - br label %loop.cond111 - -loop.exit119: ; preds = %loop.cond111 + store i64 0, ptr %.anon105, align 8 + br label %loop.cond106 + +loop.cond106: ; preds = %loop.body108, %loop.exit104 + %94 = load i64, ptr %.anon105, align 8 + %gt107 = icmp ugt i64 8, %94 + br i1 %gt107, label %loop.body108, label %loop.exit116 + +loop.body108: ; preds = %loop.cond106 + %95 = load i64, ptr %.anon105, align 8 + store i64 %95, ptr %i109, align 8 + %96 = load i64, ptr %.anon105, align 8 + %ptroffset111 = getelementptr inbounds [4 x i8], ptr %c, i64 %96 + %97 = load i32, ptr %ptroffset111, align 4 + store i32 %97, ptr %x110, align 4 + %98 = insertvalue %"any*" undef, ptr %i109, 0 + %99 = insertvalue %"any*" %98, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %99, ptr %varargslots112, align 16 + %100 = insertvalue %"any*" undef, ptr %x110, 0 + %101 = insertvalue %"any*" %100, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd113 = getelementptr inbounds i8, ptr %varargslots112, i64 16 + store %"any*" %101, ptr %ptradd113, align 16 + %102 = call i64 @std.io.printfn(ptr %retparam114, ptr @.str.20, i64 9, ptr %varargslots112, i64 2) + %103 = load i64, ptr %.anon105, align 8 + %add115 = add i64 %103, 1 + store i64 %add115, ptr %.anon105, align 8 + br label %loop.cond106 + +loop.exit116: ; preds = %loop.cond106 + call void @llvm.memcpy.p0.p0.i32(ptr align 16 %a117, ptr align 16 @.__const.21, i32 24, i1 false) + store i64 0, ptr %.anon118, align 8 + br label %loop.cond119 + +loop.cond119: ; preds = %loop.body121, %loop.exit116 + %104 = load i64, ptr %.anon118, align 8 + %gt120 = icmp ugt i64 6, %104 + br i1 %gt120, label %loop.body121, label %loop.exit129 + +loop.body121: ; preds = %loop.cond119 + %105 = load i64, ptr %.anon118, align 8 + store i64 %105, ptr %i122, align 8 + %106 = load i64, ptr %.anon118, align 8 + %ptroffset124 = getelementptr inbounds [4 x i8], ptr %a117, i64 %106 + %107 = load i32, ptr %ptroffset124, align 4 + store i32 %107, ptr %x123, align 4 + %108 = insertvalue %"any*" undef, ptr %i122, 0 + %109 = insertvalue %"any*" %108, i64 ptrtoint (ptr @"$ct.ulong" to i64), 1 + store %"any*" %109, ptr %varargslots125, align 16 + %110 = insertvalue %"any*" undef, ptr %x123, 0 + %111 = insertvalue %"any*" %110, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + %ptradd126 = getelementptr inbounds i8, ptr %varargslots125, i64 16 + store %"any*" %111, ptr %ptradd126, align 16 + %112 = call i64 @std.io.printfn(ptr %retparam127, ptr @.str.22, i64 6, ptr %varargslots125, i64 2) + %113 = load i64, ptr %.anon118, align 8 + %add128 = add i64 %113, 1 + store i64 %add128, ptr %.anon118, align 8 + br label %loop.cond119 + +loop.exit129: ; preds = %loop.cond119 ret void } diff --git a/test/test_suite/macros/macro_with_body.c3t b/test/test_suite/macros/macro_with_body.c3t index d0a15095c..cd68734d9 100644 --- a/test/test_suite/macros/macro_with_body.c3t +++ b/test/test_suite/macros/macro_with_body.c3t @@ -48,10 +48,9 @@ fn void main() define i32 @withbody.Foo.mutate(ptr %0) #0 { entry: %1 = call i32 (ptr, ...) @printf(ptr @.str.2) - %2 = getelementptr inbounds %Foo, ptr %0, i32 0, i32 0 - %3 = load i32, ptr %2, align 4 - %add = add i32 %3, 1 - store i32 %add, ptr %2, align 4 + %2 = load i32, ptr %0, align 4 + %add = add i32 %2, 1 + store i32 %add, ptr %0, align 4 %mul = mul i32 10, %add ret i32 %mul } @@ -68,32 +67,31 @@ entry: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %f, ptr align 4 @.__const, i32 4, i1 false) store i32 0, ptr %y, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %foo, ptr align 4 %f, i32 4, i1 false) - %0 = getelementptr inbounds %Foo, ptr %foo, i32 0, i32 0 - %1 = load i32, ptr %0, align 4 - store i32 %1, ptr %y, align 4 - %2 = call i32 @withbody.Foo.mutate(ptr %foo) - store i32 %2, ptr %x, align 4 - %3 = load i32, ptr %y, align 4 - store i32 %3, ptr %dy, align 4 - %4 = load i32, ptr %x, align 4 - %5 = load i32, ptr %dy, align 4 - %6 = call i32 (ptr, ...) @printf(ptr @.str, i32 %4, i32 %5) + %0 = load i32, ptr %foo, align 4 + store i32 %0, ptr %y, align 4 + %1 = call i32 @withbody.Foo.mutate(ptr %foo) + store i32 %1, ptr %x, align 4 + %2 = load i32, ptr %y, align 4 + store i32 %2, ptr %dy, align 4 + %3 = load i32, ptr %x, align 4 + %4 = load i32, ptr %dy, align 4 + %5 = call i32 (ptr, ...) @printf(ptr @.str, i32 %3, i32 %4) store i32 0, ptr %i, align 4 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %7 = load i32, ptr %i, align 4 - %lt = icmp slt i32 %7, 10 + %6 = load i32, ptr %i, align 4 + %lt = icmp slt i32 %6, 10 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %8 = load i32, ptr %i, align 4 - %add = add i32 %8, 1 + %7 = load i32, ptr %i, align 4 + %add = add i32 %7, 1 store i32 %add, ptr %loop, align 4 - %9 = load i32, ptr %loop, align 4 - %10 = call i32 (ptr, ...) @printf(ptr @.str.1, i32 %9) - %11 = load i32, ptr %i, align 4 - %add1 = add i32 %11, 1 + %8 = load i32, ptr %loop, align 4 + %9 = call i32 (ptr, ...) @printf(ptr @.str.1, i32 %8) + %10 = load i32, ptr %i, align 4 + %add1 = add i32 %10, 1 store i32 %add1, ptr %i, align 4 br label %loop.cond diff --git a/test/test_suite/macros/unifying_implicit_void.c3t b/test/test_suite/macros/unifying_implicit_void.c3t index 39df98834..2b3bb37e4 100644 --- a/test/test_suite/macros/unifying_implicit_void.c3t +++ b/test/test_suite/macros/unifying_implicit_void.c3t @@ -41,71 +41,86 @@ entry: %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.std.io.ByteReader" to i64), 1 store %"any*" %1, ptr %s, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %self, ptr align 8 %s, i32 16, i1 false) - %2 = getelementptr inbounds %"any*", ptr %self, i32 0, i32 1 - %3 = load i64, ptr %2, align 8 - %4 = getelementptr inbounds %"any*", ptr %self, i32 0, i32 0 - %5 = inttoptr i64 %3 to ptr + %ptradd = getelementptr inbounds i8, ptr %self, i64 8 + %2 = load i64, ptr %ptradd, align 8 + %3 = inttoptr i64 %2 to ptr %type = load ptr, ptr %.cachedtype, align 8 - %6 = icmp eq ptr %5, %type - br i1 %6, label %cache_hit, label %cache_miss + %4 = icmp eq ptr %3, %type + br i1 %4, label %cache_hit, label %cache_miss + cache_miss: ; preds = %entry - %7 = getelementptr inbounds %.introspect, ptr %5, i32 0, i32 2 - %8 = load ptr, ptr %7, align 8 - %9 = call ptr @.dyn_search(ptr %8, ptr @"$sel.read_byte") - store ptr %9, ptr %.inlinecache, align 8 - store ptr %5, ptr %.cachedtype, align 8 - br label %10 + %ptradd1 = getelementptr inbounds i8, ptr %3, i64 16 + %5 = load ptr, ptr %ptradd1, align 8 + %6 = call ptr @.dyn_search(ptr %5, ptr @"$sel.read_byte") + store ptr %6, ptr %.inlinecache, align 8 + store ptr %3, ptr %.cachedtype, align 8 + br label %7 + cache_hit: ; preds = %entry %cache_hit_fn = load ptr, ptr %.inlinecache, align 8 - br label %10 -10: ; preds = %cache_hit, %cache_miss - %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %9, %cache_miss ] - %11 = icmp eq ptr %fn_phi, null - br i1 %11, label %missing_function, label %match -missing_function: ; preds = %10 - %12 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %12(ptr @.panic_msg, i64 46, ptr @.file, i64 25, ptr @.func, i64 4, i32 13) + br label %7 + +7: ; preds = %cache_hit, %cache_miss + %fn_phi = phi ptr [ %cache_hit_fn, %cache_hit ], [ %6, %cache_miss ] + %8 = icmp eq ptr %fn_phi, null + br i1 %8, label %missing_function, label %match + +missing_function: ; preds = %7 + %9 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %9(ptr @.panic_msg, i64 46, ptr @.file, i64 25, ptr @.func, i64 4, i32 13) unreachable -match: ; preds = %10 - %13 = load ptr, ptr %4, align 8 - %14 = call i64 %fn_phi(ptr %retparam, ptr %13) - %not_err = icmp eq i64 %14, 0 - %15 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %15, label %after_check, label %assign_optional + +match: ; preds = %7 + %10 = load ptr, ptr %self, align 8 + %11 = call i64 %fn_phi(ptr %retparam, ptr %10) + %not_err = icmp eq i64 %11, 0 + %12 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %12, label %after_check, label %assign_optional + assign_optional: ; preds = %match - store i64 %14, ptr %c.f, align 8 + store i64 %11, ptr %c.f, align 8 br label %after_assign + after_check: ; preds = %match - %16 = load i8, ptr %retparam, align 1 - store i8 %16, ptr %c, align 1 + %13 = load i8, ptr %retparam, align 1 + store i8 %13, ptr %c, align 1 store i64 0, ptr %c.f, align 8 br label %after_assign + after_assign: ; preds = %after_check, %assign_optional br label %testblock + testblock: ; preds = %after_assign %optval = load i64, ptr %c.f, align 8 - %not_err1 = icmp eq i64 %optval, 0 - %17 = call i1 @llvm.expect.i1(i1 %not_err1, i1 true) - br i1 %17, label %after_check3, label %assign_optional2 -assign_optional2: ; preds = %testblock + %not_err2 = icmp eq i64 %optval, 0 + %14 = call i1 @llvm.expect.i1(i1 %not_err2, i1 true) + br i1 %14, label %after_check4, label %assign_optional3 + +assign_optional3: ; preds = %testblock store i64 %optval, ptr %err, align 8 br label %end_block -after_check3: ; preds = %testblock + +after_check4: ; preds = %testblock store i64 0, ptr %err, align 8 br label %end_block -end_block: ; preds = %after_check3, %assign_optional2 - %18 = load i64, ptr %err, align 8 - %neq = icmp ne i64 %18, 0 + +end_block: ; preds = %after_check4, %assign_optional3 + %15 = load i64, ptr %err, align 8 + %neq = icmp ne i64 %15, 0 br i1 %neq, label %if.then, label %if.exit + if.then: ; preds = %end_block - %19 = load i64, ptr %err, align 8 - store i64 %19, ptr %error_var, align 8 + %16 = load i64, ptr %err, align 8 + store i64 %16, ptr %error_var, align 8 br label %guard_block + if.exit: ; preds = %end_block br label %noerr_block + guard_block: ; preds = %if.then - %20 = load i64, ptr %error_var, align 8 - ret i64 %20 + %17 = load i64, ptr %error_var, align 8 + ret i64 %17 + noerr_block: ; preds = %if.exit ret i64 0 } \ No newline at end of file diff --git a/test/test_suite/macros/userland_bitcast.c3t b/test/test_suite/macros/userland_bitcast.c3t index e4a4e33b6..b919b3d45 100644 --- a/test/test_suite/macros/userland_bitcast.c3t +++ b/test/test_suite/macros/userland_bitcast.c3t @@ -91,18 +91,16 @@ entry: %b = alloca ptr, align 8 %to = alloca ptr, align 8 %i = alloca i64, align 8 - %1 = getelementptr inbounds %Foo, ptr %z, i32 0, i32 0 - store i16 0, ptr %1, align 2 - %2 = getelementptr inbounds %Foo, ptr %z, i32 0, i32 1 - store i8 0, ptr %2, align 2 - %3 = getelementptr inbounds %Foo, ptr %z, i32 0, i32 2 - store i8 0, ptr %3, align 1 - %4 = getelementptr inbounds %Foo, ptr %z, i32 0, i32 3 - store i16 0, ptr %4, align 2 - %5 = getelementptr inbounds %Foo, ptr %z, i32 0, i32 4 - store i16 0, ptr %5, align 2 - %6 = getelementptr inbounds %Foo, ptr %z, i32 0, i32 0 - store i16 %0, ptr %6, align 2 + store i16 0, ptr %z, align 2 + %ptradd = getelementptr inbounds i8, ptr %z, i64 2 + store i8 0, ptr %ptradd, align 2 + %ptradd1 = getelementptr inbounds i8, ptr %z, i64 3 + store i8 0, ptr %ptradd1, align 1 + %ptradd2 = getelementptr inbounds i8, ptr %z, i64 4 + store i16 0, ptr %ptradd2, align 2 + %ptradd3 = getelementptr inbounds i8, ptr %z, i64 6 + store i16 0, ptr %ptradd3, align 2 + store i16 %0, ptr %z, align 2 call void @llvm.memcpy.p0.p0.i32(ptr align 2 %expr, ptr align 2 %z, i32 8, i1 false) store ptr %expr, ptr %b, align 8 store ptr %x, ptr %to, align 8 @@ -110,29 +108,30 @@ entry: br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %7 = load i64, ptr %i, align 8 - %lt = icmp ult i64 %7, 8 + %1 = load i64, ptr %i, align 8 + %lt = icmp ult i64 %1, 8 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %8 = load ptr, ptr %to, align 8 - %9 = load i64, ptr %i, align 8 - %ptroffset = getelementptr inbounds i16, ptr %8, i64 %9 - %10 = load ptr, ptr %b, align 8 - %11 = load i64, ptr %i, align 8 - %ptroffset1 = getelementptr inbounds i16, ptr %10, i64 %11 - %12 = load i16, ptr %ptroffset1, align 2 - store i16 %12, ptr %ptroffset, align 2 - %13 = load i64, ptr %i, align 8 - %add = add i64 %13, 2 + %2 = load ptr, ptr %to, align 8 + %3 = load i64, ptr %i, align 8 + %ptroffset = getelementptr inbounds [2 x i8], ptr %2, i64 %3 + %4 = load ptr, ptr %b, align 8 + %5 = load i64, ptr %i, align 8 + %ptroffset4 = getelementptr inbounds [2 x i8], ptr %4, i64 %5 + %6 = load i16, ptr %ptroffset4, align 2 + store i16 %6, ptr %ptroffset, align 2 + %7 = load i64, ptr %i, align 8 + %add = add i64 %7, 2 store i64 %add, ptr %i, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond - %14 = load i64, ptr %x, align 8 - ret i64 %14 + %8 = load i64, ptr %x, align 8 + ret i64 %8 } +; Function Attrs: define i32 @userland_bitcast.test(float %0) #0 { entry: %expr = alloca float, align 4 @@ -154,12 +153,12 @@ loop.cond: ; preds = %loop.body, %entry loop.body: ; preds = %loop.cond %2 = load ptr, ptr %to, align 8 %3 = load i64, ptr %i, align 8 - %ptroffset = getelementptr inbounds i8, ptr %2, i64 %3 + %ptradd = getelementptr inbounds i8, ptr %2, i64 %3 %4 = load ptr, ptr %b, align 8 %5 = load i64, ptr %i, align 8 - %ptroffset1 = getelementptr inbounds i8, ptr %4, i64 %5 - %6 = load i8, ptr %ptroffset1, align 1 - store i8 %6, ptr %ptroffset, align 1 + %ptradd1 = getelementptr inbounds i8, ptr %4, i64 %5 + %6 = load i8, ptr %ptradd1, align 1 + store i8 %6, ptr %ptradd, align 1 %7 = load i64, ptr %i, align 8 %add = add i64 %7, 1 store i64 %add, ptr %i, align 8 @@ -170,6 +169,7 @@ loop.exit: ; preds = %loop.cond ret i32 %8 } +; Function Attrs: define void @userland_bitcast.main() #0 { entry: %f = alloca float, align 4 @@ -214,10 +214,10 @@ loop.cond: ; preds = %loop.body, %entry loop.body: ; preds = %loop.cond %2 = load ptr, ptr %to, align 8 %3 = load i64, ptr %i1, align 8 - %ptroffset = getelementptr inbounds i32, ptr %2, i64 %3 + %ptroffset = getelementptr inbounds [4 x i8], ptr %2, i64 %3 %4 = load ptr, ptr %b, align 8 %5 = load i64, ptr %i1, align 8 - %ptroffset2 = getelementptr inbounds i32, ptr %4, i64 %5 + %ptroffset2 = getelementptr inbounds [4 x i8], ptr %4, i64 %5 %6 = load i32, ptr %ptroffset2, align 4 store i32 %6, ptr %ptroffset, align 4 %7 = load i64, ptr %i1, align 8 @@ -243,10 +243,10 @@ loop.cond8: ; preds = %loop.body10, %loop. loop.body10: ; preds = %loop.cond8 %11 = load ptr, ptr %to6, align 8 %12 = load i64, ptr %i7, align 8 - %ptroffset11 = getelementptr inbounds i32, ptr %11, i64 %12 + %ptroffset11 = getelementptr inbounds [4 x i8], ptr %11, i64 %12 %13 = load ptr, ptr %b5, align 8 %14 = load i64, ptr %i7, align 8 - %ptroffset12 = getelementptr inbounds i32, ptr %13, i64 %14 + %ptroffset12 = getelementptr inbounds [4 x i8], ptr %13, i64 %14 %15 = load i32, ptr %ptroffset12, align 4 store i32 %15, ptr %ptroffset11, align 4 %16 = load i64, ptr %i7, align 8 @@ -279,10 +279,10 @@ loop.cond21: ; preds = %loop.body23, %loop. loop.body23: ; preds = %loop.cond21 %23 = load ptr, ptr %to19, align 8 %24 = load i64, ptr %i20, align 8 - %ptroffset24 = getelementptr inbounds i64, ptr %23, i64 %24 + %ptroffset24 = getelementptr inbounds [8 x i8], ptr %23, i64 %24 %25 = load ptr, ptr %b18, align 8 %26 = load i64, ptr %i20, align 8 - %ptroffset25 = getelementptr inbounds i64, ptr %25, i64 %26 + %ptroffset25 = getelementptr inbounds [8 x i8], ptr %25, i64 %26 %27 = load i64, ptr %ptroffset25, align 8 store i64 %27, ptr %ptroffset24, align 8 %28 = load i64, ptr %i20, align 8 @@ -308,10 +308,10 @@ loop.cond33: ; preds = %loop.body35, %loop. loop.body35: ; preds = %loop.cond33 %32 = load ptr, ptr %to31, align 8 %33 = load i64, ptr %i32, align 8 - %ptroffset36 = getelementptr inbounds i64, ptr %32, i64 %33 + %ptroffset36 = getelementptr inbounds [8 x i8], ptr %32, i64 %33 %34 = load ptr, ptr %b30, align 8 %35 = load i64, ptr %i32, align 8 - %ptroffset37 = getelementptr inbounds i64, ptr %34, i64 %35 + %ptroffset37 = getelementptr inbounds [8 x i8], ptr %34, i64 %35 %36 = load i64, ptr %ptroffset37, align 8 store i64 %36, ptr %ptroffset36, align 8 %37 = load i64, ptr %i32, align 8 diff --git a/test/test_suite/methods/methods_with_inferred_type.c3t b/test/test_suite/methods/methods_with_inferred_type.c3t index 60687b3b9..5e38793d8 100644 --- a/test/test_suite/methods/methods_with_inferred_type.c3t +++ b/test/test_suite/methods/methods_with_inferred_type.c3t @@ -49,16 +49,17 @@ entry: ret void } +; Function Attrs: define i32 @test.Abc.add(ptr %0) #0 { entry: - %1 = getelementptr inbounds %Abc, ptr %0, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - %3 = getelementptr inbounds %Abc, ptr %0, i32 0, i32 1 - %4 = load i32, ptr %3, align 4 - %add = add i32 %2, %4 + %1 = load i32, ptr %0, align 4 + %ptradd = getelementptr inbounds i8, ptr %0, i64 4 + %2 = load i32, ptr %ptradd, align 4 + %add = add i32 %1, %2 ret i32 %add } +; Function Attrs: define void @test.test() #0 { entry: %x = alloca %Abc, align 4 @@ -68,16 +69,15 @@ entry: call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 8, i1 false) %0 = call i32 @test.Abc.add(ptr %x) store i32 %0, ptr %a, align 4 - %1 = getelementptr inbounds %Abc, ptr %x, i32 0, i32 0 - %2 = load i32, ptr %1, align 4 - %3 = getelementptr inbounds %Abc, ptr %x, i32 0, i32 1 - %4 = load i32, ptr %3, align 4 - %add = add i32 %2, %4 + %1 = load i32, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + %2 = load i32, ptr %ptradd, align 4 + %add = add i32 %1, %2 store i32 %add, ptr %b, align 4 store i32 100, ptr %f, align 4 call void @test.Foo.add(ptr %f) - %5 = load i32, ptr %f, align 4 - %add1 = add i32 %5, 1 + %3 = load i32, ptr %f, align 4 + %add1 = add i32 %3, 1 store i32 %add1, ptr %f, align 4 ret void } diff --git a/test/test_suite/pointers/array_pointer_decay.c3t b/test/test_suite/pointers/array_pointer_decay.c3t index 2a0fb2023..79586d79f 100644 --- a/test/test_suite/pointers/array_pointer_decay.c3t +++ b/test/test_suite/pointers/array_pointer_decay.c3t @@ -32,47 +32,46 @@ entry: %xx = alloca ptr, align 8 %yy = alloca ptr, align 8 %zz = alloca ptr, align 8 - %0 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 0 - store i32 0, ptr %0, align 4 - %1 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - store i32 0, ptr %1, align 4 - %2 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 2 - store i32 0, ptr %2, align 4 + store i32 0, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + store i32 0, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + store i32 0, ptr %ptradd1, align 4 store ptr %x, ptr %y, align 8 - %3 = load ptr, ptr %y, align 8 - store ptr %3, ptr %z, align 8 + %0 = load ptr, ptr %y, align 8 + store ptr %0, ptr %z, align 8 + %1 = load ptr, ptr %y, align 8 + %2 = insertvalue %"int[]" undef, ptr %1, 0 + %3 = insertvalue %"int[]" %2, i64 3, 1 + store %"int[]" %3, ptr %sub, align 8 %4 = load ptr, ptr %y, align 8 - %5 = insertvalue %"int[]" undef, ptr %4, 0 - %6 = insertvalue %"int[]" %5, i64 3, 1 - store %"int[]" %6, ptr %sub, align 8 - %7 = load ptr, ptr %y, align 8 - %ptroffset = getelementptr inbounds [3 x i32], ptr %7, i64 1 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %y1, ptr align 4 %ptroffset, i32 12, i1 false) - %8 = load ptr, ptr %z, align 8 - %ptroffset1 = getelementptr inbounds i32, ptr %8, i64 1 - %9 = load i32, ptr %ptroffset1, align 4 - store i32 %9, ptr %z1, align 4 - %ptroffset2 = getelementptr [3 x i32], ptr %x, i64 1 - store ptr %ptroffset2, ptr %xx, align 8 - %10 = load ptr, ptr %xx, align 8 - store ptr %10, ptr %yy, align 8 - %11 = load ptr, ptr %yy, align 8 - %ptroffset3 = getelementptr [3 x i32], ptr %11, i64 -1 - store ptr %ptroffset3, ptr %zz, align 8 - %12 = load ptr, ptr %y, align 8 - %13 = getelementptr inbounds [3 x i32], ptr %12, i64 0, i64 1 - %14 = load ptr, ptr %y, align 8 - %15 = load ptr, ptr %z, align 8 - %16 = load ptr, ptr %zz, align 8 - %17 = load ptr, ptr %xx, align 8 - call void (ptr, ...) @printf(ptr @.str, ptr %14, ptr %15, ptr %16, ptr %13, ptr %17) - %18 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - store i32 123, ptr %18, align 4 - %19 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - %20 = load ptr, ptr %z, align 8 - %ptroffset4 = getelementptr inbounds i32, ptr %20, i64 1 - %21 = load i32, ptr %19, align 4 - %22 = load i32, ptr %ptroffset4, align 4 - call void (ptr, ...) @printf(ptr @.str.1, i32 %21, i32 %22) + %ptradd2 = getelementptr inbounds i8, ptr %4, i64 12 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %y1, ptr align 4 %ptradd2, i32 12, i1 false) + %5 = load ptr, ptr %z, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %5, i64 4 + %6 = load i32, ptr %ptradd3, align 4 + store i32 %6, ptr %z1, align 4 + %ptradd_any = getelementptr i8, ptr %x, i64 12 + store ptr %ptradd_any, ptr %xx, align 8 + %7 = load ptr, ptr %xx, align 8 + store ptr %7, ptr %yy, align 8 + %8 = load ptr, ptr %yy, align 8 + %ptradd_any4 = getelementptr i8, ptr %8, i64 -12 + store ptr %ptradd_any4, ptr %zz, align 8 + %9 = load ptr, ptr %y, align 8 + %ptradd5 = getelementptr inbounds i8, ptr %9, i64 4 + %10 = load ptr, ptr %y, align 8 + %11 = load ptr, ptr %z, align 8 + %12 = load ptr, ptr %zz, align 8 + %13 = load ptr, ptr %xx, align 8 + call void (ptr, ...) @printf(ptr @.str, ptr %10, ptr %11, ptr %12, ptr %ptradd5, ptr %13) + %ptradd6 = getelementptr inbounds i8, ptr %x, i64 4 + store i32 123, ptr %ptradd6, align 4 + %ptradd7 = getelementptr inbounds i8, ptr %x, i64 4 + %14 = load ptr, ptr %z, align 8 + %ptradd8 = getelementptr inbounds i8, ptr %14, i64 4 + %15 = load i32, ptr %ptradd7, align 4 + %16 = load i32, ptr %ptradd8, align 4 + call void (ptr, ...) @printf(ptr @.str.1, i32 %15, i32 %16) ret void } \ No newline at end of file diff --git a/test/test_suite/pointers/pointer_index.c3t b/test/test_suite/pointers/pointer_index.c3t index 91991b306..461a4061f 100644 --- a/test/test_suite/pointers/pointer_index.c3t +++ b/test/test_suite/pointers/pointer_index.c3t @@ -30,49 +30,47 @@ entry: %b = alloca i32, align 4 %c = alloca i32, align 4 %d = alloca i32, align 4 - %ptroffset = getelementptr inbounds i32, ptr %0, i64 0 - %1 = load i32, ptr %ptroffset, align 4 + %1 = load i32, ptr %0, align 4 store i32 %1, ptr %a, align 4 %2 = load i32, ptr %0, align 4 store i32 %2, ptr %b, align 4 - %ptroffset1 = getelementptr inbounds i32, ptr %0, i64 1 - %3 = load i32, ptr %ptroffset1, align 4 + %ptradd = getelementptr inbounds i8, ptr %0, i64 4 + %3 = load i32, ptr %ptradd, align 4 store i32 %3, ptr %c, align 4 - %ptroffset2 = getelementptr inbounds i32, ptr %0, i64 -1 - %4 = load i32, ptr %ptroffset2, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %0, i64 -4 + %4 = load i32, ptr %ptradd1, align 4 store i32 %4, ptr %d, align 4 ret void } - +; Function Attrs: define void @pointer_index.test2(ptr %0) #0 { entry: %a = alloca i8, align 1 %b = alloca i8, align 1 %c = alloca i8, align 1 - %ptroffset = getelementptr inbounds i8, ptr %0, i64 0 - %1 = load i8, ptr %ptroffset, align 1 + %1 = load i8, ptr %0, align 1 store i8 %1, ptr %a, align 1 %2 = load i8, ptr %0, align 1 store i8 %2, ptr %b, align 1 - %ptroffset1 = getelementptr inbounds i8, ptr %0, i64 1 - %3 = load i8, ptr %ptroffset1, align 1 + %ptradd = getelementptr inbounds i8, ptr %0, i64 1 + %3 = load i8, ptr %ptradd, align 1 store i8 %3, ptr %c, align 1 ret void } +; Function Attrs: define void @pointer_index.test3(ptr %0) #0 { entry: %a = alloca i64, align 8 %b = alloca i64, align 8 %c = alloca i64, align 8 - %ptroffset = getelementptr inbounds i64, ptr %0, i64 0 - %1 = load i64, ptr %ptroffset, align 8 + %1 = load i64, ptr %0, align 8 store i64 %1, ptr %a, align 8 %2 = load i64, ptr %0, align 8 store i64 %2, ptr %b, align 8 - %ptroffset1 = getelementptr inbounds i64, ptr %0, i64 1 - %3 = load i64, ptr %ptroffset1, align 8 + %ptradd = getelementptr inbounds i8, ptr %0, i64 8 + %3 = load i64, ptr %ptradd, align 8 store i64 %3, ptr %c, align 8 ret void } diff --git a/test/test_suite/pointers/subarray_variant_to_ptr.c3t b/test/test_suite/pointers/subarray_variant_to_ptr.c3t index efab5577e..5caf1569d 100644 --- a/test/test_suite/pointers/subarray_variant_to_ptr.c3t +++ b/test/test_suite/pointers/subarray_variant_to_ptr.c3t @@ -36,34 +36,33 @@ entry: %z = alloca %"any*", align 8 %w = alloca ptr, align 8 store i64 %0, ptr %z, align 8 - %ptroffset = getelementptr inbounds ptr, ptr %z, i64 1 - store ptr %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"any*", ptr %z, i32 0, i32 0 - %3 = load ptr, ptr %2, align 8 - store ptr %3, ptr %w, align 8 - %4 = load ptr, ptr %w, align 8 - %5 = load i32, ptr %4, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %5) + %ptradd = getelementptr inbounds i8, ptr %z, i64 8 + store ptr %1, ptr %ptradd, align 8 + %2 = load ptr, ptr %z, align 8 + store ptr %2, ptr %w, align 8 + %3 = load ptr, ptr %w, align 8 + %4 = load i32, ptr %3, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %4) ret void } - +; Function Attrs: define void @foo.test2(ptr %0, i64 %1) #0 { entry: %z = alloca %"int[]", align 8 %w = alloca ptr, align 8 store ptr %0, ptr %z, align 8 - %ptroffset = getelementptr inbounds i64, ptr %z, i64 1 - store i64 %1, ptr %ptroffset, align 8 - %2 = getelementptr inbounds %"int[]", ptr %z, i32 0, i32 0 - %3 = load ptr, ptr %2, align 8 - store ptr %3, ptr %w, align 8 - %4 = load ptr, ptr %w, align 8 - %5 = load i32, ptr %4, align 4 - call void (ptr, ...) @printf(ptr @.str.1, i32 %5) + %ptradd = getelementptr inbounds i8, ptr %z, i64 8 + store i64 %1, ptr %ptradd, align 8 + %2 = load ptr, ptr %z, align 8 + store ptr %2, ptr %w, align 8 + %3 = load ptr, ptr %w, align 8 + %4 = load i32, ptr %3, align 4 + call void (ptr, ...) @printf(ptr @.str.1, i32 %4) ret void } +; Function Attrs: define void @foo.main() #0 { entry: %x = alloca i32, align 4 @@ -76,14 +75,12 @@ entry: %0 = insertvalue %"any*" undef, ptr %x, 0 %1 = insertvalue %"any*" %0, i64 ptrtoint (ptr @"$ct.int" to i64), 1 store %"any*" %1, ptr %taddr, align 8 - %2 = getelementptr inbounds { i64, ptr }, ptr %taddr, i32 0, i32 0 - %lo = load i64, ptr %2, align 8 - %3 = getelementptr inbounds { i64, ptr }, ptr %taddr, i32 0, i32 1 - %hi = load ptr, ptr %3, align 8 + %lo = load i64, ptr %taddr, align 8 + %ptradd = getelementptr inbounds i8, ptr %taddr, i64 8 + %hi = load ptr, ptr %ptradd, align 8 call void @foo.test1(i64 %lo, ptr %hi) - %4 = getelementptr inbounds [2 x i32], ptr %w, i64 0, i64 0 - %5 = insertvalue %"int[]" undef, ptr %4, 0 - %6 = insertvalue %"int[]" %5, i64 2, 1 - call void @foo.test2(ptr %4, i64 2) + %2 = insertvalue %"int[]" undef, ptr %w, 0 + %3 = insertvalue %"int[]" %2, i64 2, 1 + call void @foo.test2(ptr %w, i64 2) ret void } \ No newline at end of file diff --git a/test/test_suite/safe/deref.c3t b/test/test_suite/safe/deref.c3t index 4de8e3e7d..b2d6fb6f2 100644 --- a/test/test_suite/safe/deref.c3t +++ b/test/test_suite/safe/deref.c3t @@ -17,16 +17,15 @@ entry: store ptr null, ptr %x, align 8 %0 = load ptr, ptr %x, align 8 %checknull = icmp eq ptr %0, null - br i1 %checknull, label %panic, label %checkok - -panic: ; preds = %entry - %1 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %1(ptr @.panic_msg, i64 42, ptr @.file, i64 8, ptr @.func, i64 4, i32 6) - unreachable - + %1 = call i1 @llvm.expect.i1(i1 %checknull, i1 false) + br i1 %1, label %panic, label %checkok checkok: ; preds = %entry %2 = load i32, ptr %0, align 4 store i32 %2, ptr %y, align 4 ret void +panic: ; preds = %entry + %3 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %3(ptr @.panic_msg, i64 42, ptr @.file, i64 8, ptr @.func, i64 4, i32 6) + unreachable } diff --git a/test/test_suite/slices/slice_assign.c3t b/test/test_suite/slices/slice_assign.c3t index 16a8f46d9..493c86330 100644 --- a/test/test_suite/slices/slice_assign.c3t +++ b/test/test_suite/slices/slice_assign.c3t @@ -20,46 +20,46 @@ fn void main() @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 - +; Function Attrs: declare void @printf(ptr, ...) #0 +; Function Attrs: define void @test.main() #0 { entry: %x = alloca [8 x i32], align 16 %.anon = alloca i64, align 8 %i = alloca i32, align 4 call void @llvm.memset.p0.i64(ptr align 16 %x, i8 0, i64 32, i1 false) - %0 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 0 - store i32 3, ptr %0, align 4 - %1 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 1 - store i32 3, ptr %1, align 4 - %2 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 1 - store i32 5, ptr %2, align 4 - %3 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 2 - store i32 5, ptr %3, align 4 - %4 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 5 - store i32 52, ptr %4, align 4 - %5 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 6 - store i32 52, ptr %5, align 4 - %6 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 7 - store i32 52, ptr %6, align 4 + store i32 3, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + store i32 3, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 4 + store i32 5, ptr %ptradd1, align 4 + %ptradd2 = getelementptr inbounds i8, ptr %x, i64 8 + store i32 5, ptr %ptradd2, align 4 + %ptradd3 = getelementptr inbounds i8, ptr %x, i64 20 + store i32 52, ptr %ptradd3, align 4 + %ptradd4 = getelementptr inbounds i8, ptr %x, i64 24 + store i32 52, ptr %ptradd4, align 4 + %ptradd5 = getelementptr inbounds i8, ptr %x, i64 28 + store i32 52, ptr %ptradd5, align 4 store i64 0, ptr %.anon, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %7 = load i64, ptr %.anon, align 8 - %gt = icmp ugt i64 8, %7 + %0 = load i64, ptr %.anon, align 8 + %gt = icmp ugt i64 8, %0 br i1 %gt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %8 = load i64, ptr %.anon, align 8 - %9 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 %8 - %10 = load i32, ptr %9, align 4 - store i32 %10, ptr %i, align 4 - %11 = load i32, ptr %i, align 4 - call void (ptr, ...) @printf(ptr @.str, i32 %11) - %12 = load i64, ptr %.anon, align 8 - %add = add i64 %12, 1 + %1 = load i64, ptr %.anon, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %x, i64 %1 + %2 = load i32, ptr %ptroffset, align 4 + store i32 %2, ptr %i, align 4 + %3 = load i32, ptr %i, align 4 + call void (ptr, ...) @printf(ptr @.str, i32 %3) + %4 = load i64, ptr %.anon, align 8 + %add = add i64 %4, 1 store i64 %add, ptr %.anon, align 8 br label %loop.cond @@ -67,21 +67,21 @@ loop.exit: ; preds = %loop.cond br label %cond cond: ; preds = %assign, %loop.exit - %13 = phi i64 [ 0, %loop.exit ], [ %add1, %assign ] - %lt = icmp slt i64 %13, 8 + %5 = phi i64 [ 0, %loop.exit ], [ %add7, %assign ] + %lt = icmp slt i64 %5, 8 br i1 %lt, label %assign, label %exit assign: ; preds = %cond - %14 = getelementptr inbounds [8 x i32], ptr %x, i64 0, i64 %13 - store i32 123, ptr %14, align 4 - %add1 = add i64 %13, 1 + %ptroffset6 = getelementptr inbounds [4 x i8], ptr %x, i64 %5 + store i32 123, ptr %ptroffset6, align 4 + %add7 = add i64 %5, 1 br label %cond exit: ; preds = %cond ret void } - +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 { entry: call void @test.main() diff --git a/test/test_suite/slices/slice_assign2.c3t b/test/test_suite/slices/slice_assign2.c3t index c2f858d44..7d5b96b9c 100644 --- a/test/test_suite/slices/slice_assign2.c3t +++ b/test/test_suite/slices/slice_assign2.c3t @@ -29,22 +29,20 @@ entry: %tempval = alloca %Foo, align 8 %y = alloca [3 x %Bar], align 16 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %x, ptr align 16 @.__const, i32 72, i1 false) - %0 = getelementptr inbounds [3 x %Foo], ptr %x, i64 0, i64 1 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tempval, ptr align 8 %0, i32 24, i1 false) - %1 = getelementptr inbounds [3 x %Foo], ptr %x, i64 0, i64 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %1, ptr align 8 %tempval, i32 24, i1 false) - %2 = getelementptr inbounds [3 x %Foo], ptr %x, i64 0, i64 1 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %2, ptr align 8 %tempval, i32 24, i1 false) - %3 = getelementptr inbounds [3 x %Foo], ptr %x, i64 0, i64 2 - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %3, ptr align 8 %tempval, i32 24, i1 false) + %ptradd = getelementptr inbounds i8, ptr %x, i64 24 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tempval, ptr align 8 %ptradd, i32 24, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %x, ptr align 8 %tempval, i32 24, i1 false) + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 24 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %ptradd1, ptr align 8 %tempval, i32 24, i1 false) + %ptradd2 = getelementptr inbounds i8, ptr %x, i64 48 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %ptradd2, ptr align 8 %tempval, i32 24, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 16 %y, ptr align 16 @.__const.1, i32 48, i1 false) - %4 = getelementptr inbounds [3 x %Bar], ptr %y, i64 0, i64 1 - %5 = load %Bar, ptr %4, align 16 - %6 = getelementptr inbounds [3 x %Bar], ptr %y, i64 0, i64 0 - store %Bar %5, ptr %6, align 8 - %7 = getelementptr inbounds [3 x %Bar], ptr %y, i64 0, i64 1 - store %Bar %5, ptr %7, align 8 - %8 = getelementptr inbounds [3 x %Bar], ptr %y, i64 0, i64 2 - store %Bar %5, ptr %8, align 8 + %ptradd3 = getelementptr inbounds i8, ptr %y, i64 16 + %0 = load %Bar, ptr %ptradd3, align 16 + store %Bar %0, ptr %y, align 8 + %ptradd4 = getelementptr inbounds i8, ptr %y, i64 16 + store %Bar %0, ptr %ptradd4, align 8 + %ptradd5 = getelementptr inbounds i8, ptr %y, i64 32 + store %Bar %0, ptr %ptradd5, align 8 ret void } diff --git a/test/test_suite/slices/slice_init.c3t b/test/test_suite/slices/slice_init.c3t index 09f3874c4..455037f69 100644 --- a/test/test_suite/slices/slice_init.c3t +++ b/test/test_suite/slices/slice_init.c3t @@ -21,25 +21,25 @@ entry: %y = alloca [4 x float], align 16 %sretparam1 = alloca [20 x float], align 4 call void @foo.get(ptr sret([20 x float]) align 4 %sretparam) - %0 = getelementptr inbounds [20 x float], ptr %sretparam, i64 0, i64 1 - %1 = insertvalue %"float[]" undef, ptr %0, 0 - %2 = insertvalue %"float[]" %1, i64 4, 1 - %3 = extractvalue %"float[]" %2, 0 - %4 = load [4 x float], ptr %3, align 4 - %5 = extractvalue [4 x float] %4, 0 - %6 = insertelement <4 x float> undef, float %5, i64 0 - %7 = extractvalue [4 x float] %4, 1 - %8 = insertelement <4 x float> %6, float %7, i64 1 - %9 = extractvalue [4 x float] %4, 2 - %10 = insertelement <4 x float> %8, float %9, i64 2 - %11 = extractvalue [4 x float] %4, 3 - %12 = insertelement <4 x float> %10, float %11, i64 3 - store <4 x float> %12, ptr %x, align 16 + %ptradd = getelementptr inbounds i8, ptr %sretparam, i64 4 + %0 = insertvalue %"float[]" undef, ptr %ptradd, 0 + %1 = insertvalue %"float[]" %0, i64 4, 1 + %2 = extractvalue %"float[]" %1, 0 + %3 = load [4 x float], ptr %2, align 4 + %4 = extractvalue [4 x float] %3, 0 + %5 = insertelement <4 x float> undef, float %4, i64 0 + %6 = extractvalue [4 x float] %3, 1 + %7 = insertelement <4 x float> %5, float %6, i64 1 + %8 = extractvalue [4 x float] %3, 2 + %9 = insertelement <4 x float> %7, float %8, i64 2 + %10 = extractvalue [4 x float] %3, 3 + %11 = insertelement <4 x float> %9, float %10, i64 3 + store <4 x float> %11, ptr %x, align 16 call void @foo.get(ptr sret([20 x float]) align 4 %sretparam1) - %13 = getelementptr inbounds [20 x float], ptr %sretparam1, i64 0, i64 2 - %14 = insertvalue %"float[]" undef, ptr %13, 0 - %15 = insertvalue %"float[]" %14, i64 4, 1 - %16 = extractvalue %"float[]" %15, 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 16 %y, ptr align 4 %16, i32 16, i1 false) + %ptradd2 = getelementptr inbounds i8, ptr %sretparam1, i64 8 + %12 = insertvalue %"float[]" undef, ptr %ptradd2, 0 + %13 = insertvalue %"float[]" %12, i64 4, 1 + %14 = extractvalue %"float[]" %13, 0 + call void @llvm.memcpy.p0.p0.i32(ptr align 16 %y, ptr align 4 %14, i32 16, i1 false) ret void } diff --git a/test/test_suite/slices/slice_to_slice_assign.c3t b/test/test_suite/slices/slice_to_slice_assign.c3t index 5c67bfd88..99f8a3f83 100644 --- a/test/test_suite/slices/slice_to_slice_assign.c3t +++ b/test/test_suite/slices/slice_to_slice_assign.c3t @@ -27,122 +27,112 @@ entry: %taddr = alloca %"int[]", align 8 %varargslots = alloca [2 x %"any*"], align 16 %retparam = alloca i64, align 8 - %taddr1 = alloca %"int[]", align 8 - %varargslots2 = alloca [2 x %"any*"], align 16 - %retparam3 = alloca i64, align 8 + %taddr6 = alloca %"int[]", align 8 + %varargslots8 = alloca [2 x %"any*"], align 16 + %retparam10 = alloca i64, align 8 %a = alloca %"int[][]", align 8 %literal = alloca [1 x %"int[]"], align 16 - %literal4 = alloca [1 x i32], align 4 + %literal11 = alloca [1 x i32], align 4 %b = alloca %"int[][]", align 8 - %literal5 = alloca [1 x %"int[]"], align 16 - %literal6 = alloca [1 x i32], align 4 - %varargslots7 = alloca [1 x %"any*"], align 16 - %retparam8 = alloca i64, align 8 - %taddr10 = alloca %"int[][]", align 8 - %varargslots11 = alloca [1 x %"any*"], align 16 - %retparam12 = alloca i64, align 8 + %literal12 = alloca [1 x %"int[]"], align 16 + %literal13 = alloca [1 x i32], align 4 %varargslots14 = alloca [1 x %"any*"], align 16 %retparam15 = alloca i64, align 8 + %taddr16 = alloca %"int[][]", align 8 + %varargslots18 = alloca [1 x %"any*"], align 16 + %retparam19 = alloca i64, align 8 + %varargslots21 = alloca [1 x %"any*"], align 16 + %retparam22 = alloca i64, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 16 %z, ptr align 16 @.__const, i32 28, i1 false) call void @llvm.memset.p0.i64(ptr align 16 %y, i8 0, i64 24, i1 false) - %0 = getelementptr inbounds [7 x i32], ptr %z, i64 0, i64 3 - %1 = insertvalue %"int[]" undef, ptr %0, 0 - %2 = insertvalue %"int[]" %1, i64 3, 1 - %3 = getelementptr inbounds [6 x i32], ptr %y, i64 0, i64 1 - %4 = insertvalue %"int[]" undef, ptr %3, 0 - %5 = insertvalue %"int[]" %4, i64 3, 1 - %6 = extractvalue %"int[]" %5, 0 - %7 = extractvalue %"int[]" %2, 0 - store %"int[]" %2, ptr %taddr, align 8 - %8 = getelementptr inbounds %"int[]", ptr %taddr, i32 0, i32 1 - %9 = load i64, ptr %8, align 8 - %10 = mul i64 %9, 4 - call void @llvm.memmove.p0.p0.i64(ptr align 4 %6, ptr align 4 %7, i64 %10, i1 false) - %11 = insertvalue %"any*" undef, ptr %y, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.a6$int" to i64), 1 - %13 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %12, ptr %13, align 16 - %14 = insertvalue %"any*" undef, ptr %z, 0 - %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.a7$int" to i64), 1 - %16 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %15, ptr %16, align 16 - %17 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 5, ptr %varargslots, i64 2) - %18 = getelementptr inbounds [7 x i32], ptr %z, i64 0, i64 5 - %19 = insertvalue %"int[]" undef, ptr %18, 0 - %20 = insertvalue %"int[]" %19, i64 2, 1 - %21 = getelementptr inbounds [6 x i32], ptr %y, i64 0, i64 4 - %22 = insertvalue %"int[]" undef, ptr %21, 0 - %23 = insertvalue %"int[]" %22, i64 2, 1 - %24 = extractvalue %"int[]" %23, 0 - %25 = extractvalue %"int[]" %20, 0 - store %"int[]" %20, ptr %taddr1, align 8 - %26 = getelementptr inbounds %"int[]", ptr %taddr1, i32 0, i32 1 - %27 = load i64, ptr %26, align 8 - %28 = mul i64 %27, 4 - call void @llvm.memmove.p0.p0.i64(ptr align 4 %24, ptr align 4 %25, i64 %28, i1 false) - %29 = insertvalue %"any*" undef, ptr %y, 0 - %30 = insertvalue %"any*" %29, i64 ptrtoint (ptr @"$ct.a6$int" to i64), 1 - %31 = getelementptr inbounds [2 x %"any*"], ptr %varargslots2, i64 0, i64 0 - store %"any*" %30, ptr %31, align 16 - %32 = insertvalue %"any*" undef, ptr %z, 0 - %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.a7$int" to i64), 1 - %34 = getelementptr inbounds [2 x %"any*"], ptr %varargslots2, i64 0, i64 1 - store %"any*" %33, ptr %34, align 16 - %35 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.1, i64 5, ptr %varargslots2, i64 2) - %36 = getelementptr inbounds [1 x %"int[]"], ptr %literal, i64 0, i64 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const.2, i32 4, i1 false) - %37 = insertvalue %"int[]" undef, ptr %literal4, 0 - %38 = insertvalue %"int[]" %37, i64 1, 1 - store %"int[]" %38, ptr %36, align 8 - %39 = insertvalue %"int[][]" undef, ptr %literal, 0 + %ptradd = getelementptr inbounds i8, ptr %z, i64 12 + %0 = insertvalue %"int[]" undef, ptr %ptradd, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 4 + %2 = insertvalue %"int[]" undef, ptr %ptradd1, 0 + %3 = insertvalue %"int[]" %2, i64 3, 1 + %4 = extractvalue %"int[]" %3, 0 + %5 = extractvalue %"int[]" %1, 0 + store %"int[]" %1, ptr %taddr, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %taddr, i64 8 + %6 = load i64, ptr %ptradd2, align 8 + %7 = mul i64 %6, 4 + call void @llvm.memmove.p0.p0.i64(ptr align 4 %4, ptr align 4 %5, i64 %7, i1 false) + %8 = insertvalue %"any*" undef, ptr %y, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.a6$int" to i64), 1 + store %"any*" %9, ptr %varargslots, align 16 + %10 = insertvalue %"any*" undef, ptr %z, 0 + %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.a7$int" to i64), 1 + %ptradd3 = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %11, ptr %ptradd3, align 16 + %12 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 5, ptr %varargslots, i64 2) + %ptradd4 = getelementptr inbounds i8, ptr %z, i64 20 + %13 = insertvalue %"int[]" undef, ptr %ptradd4, 0 + %14 = insertvalue %"int[]" %13, i64 2, 1 + %ptradd5 = getelementptr inbounds i8, ptr %y, i64 16 + %15 = insertvalue %"int[]" undef, ptr %ptradd5, 0 + %16 = insertvalue %"int[]" %15, i64 2, 1 + %17 = extractvalue %"int[]" %16, 0 + %18 = extractvalue %"int[]" %14, 0 + store %"int[]" %14, ptr %taddr6, align 8 + %ptradd7 = getelementptr inbounds i8, ptr %taddr6, i64 8 + %19 = load i64, ptr %ptradd7, align 8 + %20 = mul i64 %19, 4 + call void @llvm.memmove.p0.p0.i64(ptr align 4 %17, ptr align 4 %18, i64 %20, i1 false) + %21 = insertvalue %"any*" undef, ptr %y, 0 + %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.a6$int" to i64), 1 + store %"any*" %22, ptr %varargslots8, align 16 + %23 = insertvalue %"any*" undef, ptr %z, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.a7$int" to i64), 1 + %ptradd9 = getelementptr inbounds i8, ptr %varargslots8, i64 16 + store %"any*" %24, ptr %ptradd9, align 16 + %25 = call i64 @std.io.printfn(ptr %retparam10, ptr @.str.1, i64 5, ptr %varargslots8, i64 2) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal11, ptr align 4 @.__const.2, i32 4, i1 false) + %26 = insertvalue %"int[]" undef, ptr %literal11, 0 + %27 = insertvalue %"int[]" %26, i64 1, 1 + store %"int[]" %27, ptr %literal, align 8 + %28 = insertvalue %"int[][]" undef, ptr %literal, 0 + %29 = insertvalue %"int[][]" %28, i64 1, 1 + store %"int[][]" %29, ptr %a, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal13, ptr align 4 @.__const.3, i32 4, i1 false) + %30 = insertvalue %"int[]" undef, ptr %literal13, 0 + %31 = insertvalue %"int[]" %30, i64 1, 1 + store %"int[]" %31, ptr %literal12, align 8 + %32 = insertvalue %"int[][]" undef, ptr %literal12, 0 + %33 = insertvalue %"int[][]" %32, i64 1, 1 + store %"int[][]" %33, ptr %b, align 8 + %34 = insertvalue %"any*" undef, ptr %a, 0 + %35 = insertvalue %"any*" %34, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + store %"any*" %35, ptr %varargslots14, align 16 + %36 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.4, i64 2, ptr %varargslots14, i64 1) + %37 = load %"int[][]", ptr %b, align 8 + %38 = extractvalue %"int[][]" %37, 0 + %39 = insertvalue %"int[][]" undef, ptr %38, 0 %40 = insertvalue %"int[][]" %39, i64 1, 1 - store %"int[][]" %40, ptr %a, align 8 - %41 = getelementptr inbounds [1 x %"int[]"], ptr %literal5, i64 0, i64 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal6, ptr align 4 @.__const.3, i32 4, i1 false) - %42 = insertvalue %"int[]" undef, ptr %literal6, 0 - %43 = insertvalue %"int[]" %42, i64 1, 1 - store %"int[]" %43, ptr %41, align 8 - %44 = insertvalue %"int[][]" undef, ptr %literal5, 0 - %45 = insertvalue %"int[][]" %44, i64 1, 1 - store %"int[][]" %45, ptr %b, align 8 - %46 = insertvalue %"any*" undef, ptr %a, 0 - %47 = insertvalue %"any*" %46, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %48 = getelementptr inbounds [1 x %"any*"], ptr %varargslots7, i64 0, i64 0 - store %"any*" %47, ptr %48, align 16 - %49 = call i64 @std.io.printfn(ptr %retparam8, ptr @.str.4, i64 2, ptr %varargslots7, i64 1) - %50 = load %"int[][]", ptr %b, align 8 - %51 = extractvalue %"int[][]" %50, 0 - %ptroffset = getelementptr inbounds %"int[]", ptr %51, i64 0 - %52 = insertvalue %"int[][]" undef, ptr %ptroffset, 0 - %53 = insertvalue %"int[][]" %52, i64 1, 1 + %41 = load %"int[][]", ptr %a, align 8 + %42 = extractvalue %"int[][]" %41, 0 + %43 = insertvalue %"int[][]" undef, ptr %42, 0 + %44 = insertvalue %"int[][]" %43, i64 1, 1 + %45 = extractvalue %"int[][]" %44, 0 + %46 = extractvalue %"int[][]" %40, 0 + store %"int[][]" %40, ptr %taddr16, align 8 + %ptradd17 = getelementptr inbounds i8, ptr %taddr16, i64 8 + %47 = load i64, ptr %ptradd17, align 8 + %48 = mul i64 %47, 16 + call void @llvm.memmove.p0.p0.i64(ptr align 8 %45, ptr align 8 %46, i64 %48, i1 false) + %49 = insertvalue %"any*" undef, ptr %a, 0 + %50 = insertvalue %"any*" %49, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + store %"any*" %50, ptr %varargslots18, align 16 + %51 = call i64 @std.io.printfn(ptr %retparam19, ptr @.str.5, i64 2, ptr %varargslots18, i64 1) + %ptradd20 = getelementptr inbounds i8, ptr %y, i64 8 + %52 = insertvalue %"int[]" undef, ptr %ptradd20, 0 + %53 = insertvalue %"int[]" %52, i64 3, 1 %54 = load %"int[][]", ptr %a, align 8 %55 = extractvalue %"int[][]" %54, 0 - %ptroffset9 = getelementptr inbounds %"int[]", ptr %55, i64 0 - %56 = insertvalue %"int[][]" undef, ptr %ptroffset9, 0 - %57 = insertvalue %"int[][]" %56, i64 1, 1 - %58 = extractvalue %"int[][]" %57, 0 - %59 = extractvalue %"int[][]" %53, 0 - store %"int[][]" %53, ptr %taddr10, align 8 - %60 = getelementptr inbounds %"int[][]", ptr %taddr10, i32 0, i32 1 - %61 = load i64, ptr %60, align 8 - %62 = mul i64 %61, 16 - call void @llvm.memmove.p0.p0.i64(ptr align 8 %58, ptr align 8 %59, i64 %62, i1 false) - %63 = insertvalue %"any*" undef, ptr %a, 0 - %64 = insertvalue %"any*" %63, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %65 = getelementptr inbounds [1 x %"any*"], ptr %varargslots11, i64 0, i64 0 - store %"any*" %64, ptr %65, align 16 - %66 = call i64 @std.io.printfn(ptr %retparam12, ptr @.str.5, i64 2, ptr %varargslots11, i64 1) - %67 = getelementptr inbounds [6 x i32], ptr %y, i64 0, i64 2 - %68 = insertvalue %"int[]" undef, ptr %67, 0 - %69 = insertvalue %"int[]" %68, i64 3, 1 - %70 = load %"int[][]", ptr %a, align 8 - %71 = extractvalue %"int[][]" %70, 0 - %ptroffset13 = getelementptr inbounds %"int[]", ptr %71, i64 0 - store %"int[]" %69, ptr %ptroffset13, align 8 - %72 = insertvalue %"any*" undef, ptr %a, 0 - %73 = insertvalue %"any*" %72, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %74 = getelementptr inbounds [1 x %"any*"], ptr %varargslots14, i64 0, i64 0 - store %"any*" %73, ptr %74, align 16 - %75 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.6, i64 2, ptr %varargslots14, i64 1) + store %"int[]" %53, ptr %55, align 8 + %56 = insertvalue %"any*" undef, ptr %a, 0 + %57 = insertvalue %"any*" %56, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + store %"any*" %57, ptr %varargslots21, align 16 + %58 = call i64 @std.io.printfn(ptr %retparam22, ptr @.str.6, i64 2, ptr %varargslots21, i64 1) ret void } diff --git a/test/test_suite/slices/slice_to_slice_vector_assign.c3t b/test/test_suite/slices/slice_to_slice_vector_assign.c3t index 1024fd16d..471d8f4cc 100644 --- a/test/test_suite/slices/slice_to_slice_vector_assign.c3t +++ b/test/test_suite/slices/slice_to_slice_vector_assign.c3t @@ -28,122 +28,112 @@ entry: %taddr = alloca %"int[]", align 8 %varargslots = alloca [2 x %"any*"], align 16 %retparam = alloca i64, align 8 - %taddr1 = alloca %"int[]", align 8 - %varargslots2 = alloca [2 x %"any*"], align 16 - %retparam3 = alloca i64, align 8 + %taddr6 = alloca %"int[]", align 8 + %varargslots8 = alloca [2 x %"any*"], align 16 + %retparam10 = alloca i64, align 8 %a = alloca %"int[][]", align 8 %literal = alloca [1 x %"int[]"], align 16 - %literal4 = alloca [1 x i32], align 4 + %literal11 = alloca [1 x i32], align 4 %b = alloca %"int[][]", align 8 - %literal5 = alloca [1 x %"int[]"], align 16 - %literal6 = alloca [1 x i32], align 4 - %varargslots7 = alloca [1 x %"any*"], align 16 - %retparam8 = alloca i64, align 8 - %taddr10 = alloca %"int[][]", align 8 - %varargslots11 = alloca [1 x %"any*"], align 16 - %retparam12 = alloca i64, align 8 + %literal12 = alloca [1 x %"int[]"], align 16 + %literal13 = alloca [1 x i32], align 4 %varargslots14 = alloca [1 x %"any*"], align 16 %retparam15 = alloca i64, align 8 + %taddr16 = alloca %"int[][]", align 8 + %varargslots18 = alloca [1 x %"any*"], align 16 + %retparam19 = alloca i64, align 8 + %varargslots21 = alloca [1 x %"any*"], align 16 + %retparam22 = alloca i64, align 8 store <7 x i32> , ptr %z, align 32 store <6 x i32> zeroinitializer, ptr %y, align 32 - %0 = getelementptr inbounds <7 x i32>, ptr %z, i64 0, i64 3 - %1 = insertvalue %"int[]" undef, ptr %0, 0 - %2 = insertvalue %"int[]" %1, i64 3, 1 - %3 = getelementptr inbounds <6 x i32>, ptr %y, i64 0, i64 1 - %4 = insertvalue %"int[]" undef, ptr %3, 0 - %5 = insertvalue %"int[]" %4, i64 3, 1 - %6 = extractvalue %"int[]" %5, 0 - %7 = extractvalue %"int[]" %2, 0 - store %"int[]" %2, ptr %taddr, align 8 - %8 = getelementptr inbounds %"int[]", ptr %taddr, i32 0, i32 1 - %9 = load i64, ptr %8, align 8 - %10 = mul i64 %9, 4 - call void @llvm.memmove.p0.p0.i64(ptr align 4 %6, ptr align 4 %7, i64 %10, i1 false) - %11 = insertvalue %"any*" undef, ptr %y, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.v6$int" to i64), 1 - %13 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %12, ptr %13, align 16 - %14 = insertvalue %"any*" undef, ptr %z, 0 - %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.v7$int" to i64), 1 - %16 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %15, ptr %16, align 16 - %17 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 5, ptr %varargslots, i64 2) - %18 = getelementptr inbounds <7 x i32>, ptr %z, i64 0, i64 5 - %19 = insertvalue %"int[]" undef, ptr %18, 0 - %20 = insertvalue %"int[]" %19, i64 2, 1 - %21 = getelementptr inbounds <6 x i32>, ptr %y, i64 0, i64 4 - %22 = insertvalue %"int[]" undef, ptr %21, 0 - %23 = insertvalue %"int[]" %22, i64 2, 1 - %24 = extractvalue %"int[]" %23, 0 - %25 = extractvalue %"int[]" %20, 0 - store %"int[]" %20, ptr %taddr1, align 8 - %26 = getelementptr inbounds %"int[]", ptr %taddr1, i32 0, i32 1 - %27 = load i64, ptr %26, align 8 - %28 = mul i64 %27, 4 - call void @llvm.memmove.p0.p0.i64(ptr align 4 %24, ptr align 4 %25, i64 %28, i1 false) - %29 = insertvalue %"any*" undef, ptr %y, 0 - %30 = insertvalue %"any*" %29, i64 ptrtoint (ptr @"$ct.v6$int" to i64), 1 - %31 = getelementptr inbounds [2 x %"any*"], ptr %varargslots2, i64 0, i64 0 - store %"any*" %30, ptr %31, align 16 - %32 = insertvalue %"any*" undef, ptr %z, 0 - %33 = insertvalue %"any*" %32, i64 ptrtoint (ptr @"$ct.v7$int" to i64), 1 - %34 = getelementptr inbounds [2 x %"any*"], ptr %varargslots2, i64 0, i64 1 - store %"any*" %33, ptr %34, align 16 - %35 = call i64 @std.io.printfn(ptr %retparam3, ptr @.str.1, i64 5, ptr %varargslots2, i64 2) - %36 = getelementptr inbounds [1 x %"int[]"], ptr %literal, i64 0, i64 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal4, ptr align 4 @.__const, i32 4, i1 false) - %37 = insertvalue %"int[]" undef, ptr %literal4, 0 - %38 = insertvalue %"int[]" %37, i64 1, 1 - store %"int[]" %38, ptr %36, align 8 - %39 = insertvalue %"int[][]" undef, ptr %literal, 0 + %ptradd = getelementptr inbounds i8, ptr %z, i64 12 + %0 = insertvalue %"int[]" undef, ptr %ptradd, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 4 + %2 = insertvalue %"int[]" undef, ptr %ptradd1, 0 + %3 = insertvalue %"int[]" %2, i64 3, 1 + %4 = extractvalue %"int[]" %3, 0 + %5 = extractvalue %"int[]" %1, 0 + store %"int[]" %1, ptr %taddr, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %taddr, i64 8 + %6 = load i64, ptr %ptradd2, align 8 + %7 = mul i64 %6, 4 + call void @llvm.memmove.p0.p0.i64(ptr align 4 %4, ptr align 4 %5, i64 %7, i1 false) + %8 = insertvalue %"any*" undef, ptr %y, 0 + %9 = insertvalue %"any*" %8, i64 ptrtoint (ptr @"$ct.v6$int" to i64), 1 + store %"any*" %9, ptr %varargslots, align 16 + %10 = insertvalue %"any*" undef, ptr %z, 0 + %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.v7$int" to i64), 1 + %ptradd3 = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %11, ptr %ptradd3, align 16 + %12 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 5, ptr %varargslots, i64 2) + %ptradd4 = getelementptr inbounds i8, ptr %z, i64 20 + %13 = insertvalue %"int[]" undef, ptr %ptradd4, 0 + %14 = insertvalue %"int[]" %13, i64 2, 1 + %ptradd5 = getelementptr inbounds i8, ptr %y, i64 16 + %15 = insertvalue %"int[]" undef, ptr %ptradd5, 0 + %16 = insertvalue %"int[]" %15, i64 2, 1 + %17 = extractvalue %"int[]" %16, 0 + %18 = extractvalue %"int[]" %14, 0 + store %"int[]" %14, ptr %taddr6, align 8 + %ptradd7 = getelementptr inbounds i8, ptr %taddr6, i64 8 + %19 = load i64, ptr %ptradd7, align 8 + %20 = mul i64 %19, 4 + call void @llvm.memmove.p0.p0.i64(ptr align 4 %17, ptr align 4 %18, i64 %20, i1 false) + %21 = insertvalue %"any*" undef, ptr %y, 0 + %22 = insertvalue %"any*" %21, i64 ptrtoint (ptr @"$ct.v6$int" to i64), 1 + store %"any*" %22, ptr %varargslots8, align 16 + %23 = insertvalue %"any*" undef, ptr %z, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.v7$int" to i64), 1 + %ptradd9 = getelementptr inbounds i8, ptr %varargslots8, i64 16 + store %"any*" %24, ptr %ptradd9, align 16 + %25 = call i64 @std.io.printfn(ptr %retparam10, ptr @.str.1, i64 5, ptr %varargslots8, i64 2) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal11, ptr align 4 @.__const, i32 4, i1 false) + %26 = insertvalue %"int[]" undef, ptr %literal11, 0 + %27 = insertvalue %"int[]" %26, i64 1, 1 + store %"int[]" %27, ptr %literal, align 8 + %28 = insertvalue %"int[][]" undef, ptr %literal, 0 + %29 = insertvalue %"int[][]" %28, i64 1, 1 + store %"int[][]" %29, ptr %a, align 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal13, ptr align 4 @.__const.2, i32 4, i1 false) + %30 = insertvalue %"int[]" undef, ptr %literal13, 0 + %31 = insertvalue %"int[]" %30, i64 1, 1 + store %"int[]" %31, ptr %literal12, align 8 + %32 = insertvalue %"int[][]" undef, ptr %literal12, 0 + %33 = insertvalue %"int[][]" %32, i64 1, 1 + store %"int[][]" %33, ptr %b, align 8 + %34 = insertvalue %"any*" undef, ptr %a, 0 + %35 = insertvalue %"any*" %34, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + store %"any*" %35, ptr %varargslots14, align 16 + %36 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.3, i64 2, ptr %varargslots14, i64 1) + %37 = load %"int[][]", ptr %b, align 8 + %38 = extractvalue %"int[][]" %37, 0 + %39 = insertvalue %"int[][]" undef, ptr %38, 0 %40 = insertvalue %"int[][]" %39, i64 1, 1 - store %"int[][]" %40, ptr %a, align 8 - %41 = getelementptr inbounds [1 x %"int[]"], ptr %literal5, i64 0, i64 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %literal6, ptr align 4 @.__const.2, i32 4, i1 false) - %42 = insertvalue %"int[]" undef, ptr %literal6, 0 - %43 = insertvalue %"int[]" %42, i64 1, 1 - store %"int[]" %43, ptr %41, align 8 - %44 = insertvalue %"int[][]" undef, ptr %literal5, 0 - %45 = insertvalue %"int[][]" %44, i64 1, 1 - store %"int[][]" %45, ptr %b, align 8 - %46 = insertvalue %"any*" undef, ptr %a, 0 - %47 = insertvalue %"any*" %46, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %48 = getelementptr inbounds [1 x %"any*"], ptr %varargslots7, i64 0, i64 0 - store %"any*" %47, ptr %48, align 16 - %49 = call i64 @std.io.printfn(ptr %retparam8, ptr @.str.3, i64 2, ptr %varargslots7, i64 1) - %50 = load %"int[][]", ptr %b, align 8 - %51 = extractvalue %"int[][]" %50, 0 - %ptroffset = getelementptr inbounds %"int[]", ptr %51, i64 0 - %52 = insertvalue %"int[][]" undef, ptr %ptroffset, 0 - %53 = insertvalue %"int[][]" %52, i64 1, 1 + %41 = load %"int[][]", ptr %a, align 8 + %42 = extractvalue %"int[][]" %41, 0 + %43 = insertvalue %"int[][]" undef, ptr %42, 0 + %44 = insertvalue %"int[][]" %43, i64 1, 1 + %45 = extractvalue %"int[][]" %44, 0 + %46 = extractvalue %"int[][]" %40, 0 + store %"int[][]" %40, ptr %taddr16, align 8 + %ptradd17 = getelementptr inbounds i8, ptr %taddr16, i64 8 + %47 = load i64, ptr %ptradd17, align 8 + %48 = mul i64 %47, 16 + call void @llvm.memmove.p0.p0.i64(ptr align 8 %45, ptr align 8 %46, i64 %48, i1 false) + %49 = insertvalue %"any*" undef, ptr %a, 0 + %50 = insertvalue %"any*" %49, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + store %"any*" %50, ptr %varargslots18, align 16 + %51 = call i64 @std.io.printfn(ptr %retparam19, ptr @.str.4, i64 2, ptr %varargslots18, i64 1) + %ptradd20 = getelementptr inbounds i8, ptr %y, i64 8 + %52 = insertvalue %"int[]" undef, ptr %ptradd20, 0 + %53 = insertvalue %"int[]" %52, i64 3, 1 %54 = load %"int[][]", ptr %a, align 8 %55 = extractvalue %"int[][]" %54, 0 - %ptroffset9 = getelementptr inbounds %"int[]", ptr %55, i64 0 - %56 = insertvalue %"int[][]" undef, ptr %ptroffset9, 0 - %57 = insertvalue %"int[][]" %56, i64 1, 1 - %58 = extractvalue %"int[][]" %57, 0 - %59 = extractvalue %"int[][]" %53, 0 - store %"int[][]" %53, ptr %taddr10, align 8 - %60 = getelementptr inbounds %"int[][]", ptr %taddr10, i32 0, i32 1 - %61 = load i64, ptr %60, align 8 - %62 = mul i64 %61, 16 - call void @llvm.memmove.p0.p0.i64(ptr align 8 %58, ptr align 8 %59, i64 %62, i1 false) - %63 = insertvalue %"any*" undef, ptr %a, 0 - %64 = insertvalue %"any*" %63, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %65 = getelementptr inbounds [1 x %"any*"], ptr %varargslots11, i64 0, i64 0 - store %"any*" %64, ptr %65, align 16 - %66 = call i64 @std.io.printfn(ptr %retparam12, ptr @.str.4, i64 2, ptr %varargslots11, i64 1) - %67 = getelementptr inbounds <6 x i32>, ptr %y, i64 0, i64 2 - %68 = insertvalue %"int[]" undef, ptr %67, 0 - %69 = insertvalue %"int[]" %68, i64 3, 1 - %70 = load %"int[][]", ptr %a, align 8 - %71 = extractvalue %"int[][]" %70, 0 - %ptroffset13 = getelementptr inbounds %"int[]", ptr %71, i64 0 - store %"int[]" %69, ptr %ptroffset13, align 8 - %72 = insertvalue %"any*" undef, ptr %a, 0 - %73 = insertvalue %"any*" %72, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 - %74 = getelementptr inbounds [1 x %"any*"], ptr %varargslots14, i64 0, i64 0 - store %"any*" %73, ptr %74, align 16 - %75 = call i64 @std.io.printfn(ptr %retparam15, ptr @.str.5, i64 2, ptr %varargslots14, i64 1) + store %"int[]" %53, ptr %55, align 8 + %56 = insertvalue %"any*" undef, ptr %a, 0 + %57 = insertvalue %"any*" %56, i64 ptrtoint (ptr @"$ct.sa$sa$int" to i64), 1 + store %"any*" %57, ptr %varargslots21, align 16 + %58 = call i64 @std.io.printfn(ptr %retparam22, ptr @.str.5, i64 2, ptr %varargslots21, i64 1) ret void } diff --git a/test/test_suite/statements/custom_foreach_with_ref.c3t b/test/test_suite/statements/custom_foreach_with_ref.c3t index a9390dfa2..74b435b4e 100644 --- a/test/test_suite/statements/custom_foreach_with_ref.c3t +++ b/test/test_suite/statements/custom_foreach_with_ref.c3t @@ -103,10 +103,10 @@ fn void main() @.str.13 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 @.str.14 = private unnamed_addr constant [7 x i8] c"%d %d\0A\00", align 1 - +; Function Attrs: declare void @printf(ptr, ...) #0 - +; Function Attrs: define void @foo.getFields(ptr noalias sret([5 x i32]) align 4 %0) #0 { entry: %literal = alloca [5 x i32], align 16 @@ -116,329 +116,313 @@ entry: ret void } - +; Function Attrs: define ptr @foo.call(ptr %0) #0 { entry: call void (ptr, ...) @printf(ptr @.str.1) ret ptr %0 } - +; Function Attrs: define void @foo.main() #0 { entry: %x = alloca %Foo, align 4 %.anon = alloca ptr, align 8 - %.anon1 = alloca i32, align 4 %.anon2 = alloca i32, align 4 + %.anon3 = alloca i32, align 4 %i = alloca i32, align 4 %y = alloca i32, align 4 %a = alloca i32, align 4 - %.anon3 = alloca i32, align 4 %.anon4 = alloca i32, align 4 - %i8 = alloca i32, align 4 - %y9 = alloca ptr, align 8 - %a10 = alloca i32, align 4 - %.anon15 = alloca i32, align 4 - %.anon16 = alloca i32, align 4 - %i20 = alloca i32, align 4 - %y21 = alloca i32, align 4 - %a22 = alloca i32, align 4 - %.anon26 = alloca i32, align 4 - %.anon27 = alloca i32, align 4 - %i31 = alloca i32, align 4 - %y32 = alloca i32, align 4 - %a33 = alloca i32, align 4 - %.anon37 = alloca i32, align 4 - %.anon38 = alloca i32, align 4 - %i42 = alloca i32, align 4 - %y43 = alloca i32, align 4 - %a44 = alloca i32, align 4 - %.anon49 = alloca [5 x i32], align 16 - %.anon50 = alloca i64, align 8 - %i53 = alloca i64, align 8 - %y54 = alloca i32, align 4 - %.anon58 = alloca [5 x i32], align 16 - %.anon59 = alloca i64, align 8 - %i63 = alloca i64, align 8 - %y64 = alloca i32, align 4 - %.anon67 = alloca ptr, align 8 + %.anon5 = alloca i32, align 4 + %i9 = alloca i32, align 4 + %y10 = alloca ptr, align 8 + %a11 = alloca i32, align 4 + %.anon17 = alloca i32, align 4 + %.anon18 = alloca i32, align 4 + %i22 = alloca i32, align 4 + %y23 = alloca i32, align 4 + %a24 = alloca i32, align 4 + %.anon29 = alloca i32, align 4 + %.anon30 = alloca i32, align 4 + %i34 = alloca i32, align 4 + %y35 = alloca i32, align 4 + %a36 = alloca i32, align 4 + %.anon41 = alloca i32, align 4 + %.anon42 = alloca i32, align 4 + %i46 = alloca i32, align 4 + %y47 = alloca i32, align 4 + %a48 = alloca i32, align 4 + %.anon54 = alloca [5 x i32], align 16 + %.anon55 = alloca i64, align 8 + %i58 = alloca i64, align 8 + %y59 = alloca i32, align 4 + %.anon64 = alloca [5 x i32], align 16 + %.anon65 = alloca i64, align 8 + %i69 = alloca i64, align 8 + %y70 = alloca i32, align 4 + %.anon74 = alloca ptr, align 8 %sretparam = alloca [5 x i32], align 4 - %.anon68 = alloca i64, align 8 - %i72 = alloca i64, align 8 - %y73 = alloca i32, align 4 - %y76 = alloca ptr, align 8 + %.anon75 = alloca i64, align 8 + %i79 = alloca i64, align 8 + %y80 = alloca i32, align 4 + %y85 = alloca ptr, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const.2, i32 12, i1 false) - %0 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %1 = getelementptr inbounds [3 x i32], ptr %0, i64 0, i64 0 - %2 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %3 = getelementptr inbounds [3 x i32], ptr %2, i64 0, i64 1 - %4 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %5 = getelementptr inbounds [3 x i32], ptr %4, i64 0, i64 2 - %6 = load i32, ptr %1, align 4 - %7 = load i32, ptr %3, align 4 - %8 = load i32, ptr %5, align 4 - call void (ptr, ...) @printf(ptr @.str.3, i32 %6, i32 %7, i32 %8) - %9 = call ptr @foo.call(ptr %x) - store ptr %9, ptr %.anon, align 8 - %10 = load ptr, ptr %.anon, align 8 - store i32 3, ptr %.anon1, align 4 - store i32 0, ptr %.anon2, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + %0 = load i32, ptr %x, align 4 + %1 = load i32, ptr %ptradd, align 4 + %2 = load i32, ptr %ptradd1, align 4 + call void (ptr, ...) @printf(ptr @.str.3, i32 %0, i32 %1, i32 %2) + %3 = call ptr @foo.call(ptr %x) + store ptr %3, ptr %.anon, align 8 + %4 = load ptr, ptr %.anon, align 8 + store i32 3, ptr %.anon2, align 4 + store i32 0, ptr %.anon3, align 4 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %11 = load i32, ptr %.anon2, align 4 - %12 = load i32, ptr %.anon1, align 4 - %lt = icmp slt i32 %11, %12 + %5 = load i32, ptr %.anon3, align 4 + %6 = load i32, ptr %.anon2, align 4 + %lt = icmp slt i32 %5, %6 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %13 = load i32, ptr %.anon2, align 4 - store i32 %13, ptr %i, align 4 - %14 = load ptr, ptr %.anon, align 8 - %15 = load i32, ptr %.anon2, align 4 - store i32 %15, ptr %a, align 4 - %16 = getelementptr inbounds %Foo, ptr %14, i32 0, i32 0 - %17 = load i32, ptr %a, align 4 - %sext = sext i32 %17 to i64 - %18 = getelementptr inbounds [3 x i32], ptr %16, i64 0, i64 %sext - %19 = load i32, ptr %18, align 4 - store i32 %19, ptr %y, align 4 - %20 = load i32, ptr %i, align 4 - %21 = load i32, ptr %y, align 4 - call void (ptr, ...) @printf(ptr @.str.4, i32 %20, i32 %21) - %22 = load i32, ptr %.anon2, align 4 - %add = add i32 %22, 1 - store i32 %add, ptr %.anon2, align 4 + %7 = load i32, ptr %.anon3, align 4 + store i32 %7, ptr %i, align 4 + %8 = load ptr, ptr %.anon, align 8 + %9 = load i32, ptr %.anon3, align 4 + store i32 %9, ptr %a, align 4 + %10 = load i32, ptr %a, align 4 + %sext = sext i32 %10 to i64 + %ptroffset = getelementptr inbounds [4 x i8], ptr %8, i64 %sext + %11 = load i32, ptr %ptroffset, align 4 + store i32 %11, ptr %y, align 4 + %12 = load i32, ptr %i, align 4 + %13 = load i32, ptr %y, align 4 + call void (ptr, ...) @printf(ptr @.str.4, i32 %12, i32 %13) + %14 = load i32, ptr %.anon3, align 4 + %add = add i32 %14, 1 + store i32 %add, ptr %.anon3, align 4 br label %loop.cond loop.exit: ; preds = %loop.cond - store i32 3, ptr %.anon3, align 4 - store i32 0, ptr %.anon4, align 4 - br label %loop.cond5 - -loop.cond5: ; preds = %loop.body7, %loop.exit - %23 = load i32, ptr %.anon4, align 4 - %24 = load i32, ptr %.anon3, align 4 - %lt6 = icmp slt i32 %23, %24 - br i1 %lt6, label %loop.body7, label %loop.exit14 - -loop.body7: ; preds = %loop.cond5 - %25 = load i32, ptr %.anon4, align 4 - store i32 %25, ptr %i8, align 4 - %26 = load i32, ptr %.anon4, align 4 - store i32 %26, ptr %a10, align 4 - %27 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %28 = load i32, ptr %a10, align 4 - %sext11 = sext i32 %28 to i64 - %29 = getelementptr inbounds [3 x i32], ptr %27, i64 0, i64 %sext11 - store ptr %29, ptr %y9, align 8 - %30 = load ptr, ptr %y9, align 8 - %31 = load i32, ptr %30, align 4 - %add12 = add i32 %31, 1 - store i32 %add12, ptr %30, align 4 - %32 = load ptr, ptr %y9, align 8 - %33 = load i32, ptr %i8, align 4 - %34 = load i32, ptr %32, align 4 - call void (ptr, ...) @printf(ptr @.str.5, i32 %33, i32 %34) - %35 = load i32, ptr %.anon4, align 4 - %add13 = add i32 %35, 1 - store i32 %add13, ptr %.anon4, align 4 - br label %loop.cond5 - -loop.exit14: ; preds = %loop.cond5 - store i32 3, ptr %.anon15, align 4 - store i32 0, ptr %.anon16, align 4 - br label %loop.cond17 - -loop.cond17: ; preds = %loop.body19, %loop.exit14 - %36 = load i32, ptr %.anon16, align 4 - %37 = load i32, ptr %.anon15, align 4 - %lt18 = icmp slt i32 %36, %37 - br i1 %lt18, label %loop.body19, label %loop.exit25 - -loop.body19: ; preds = %loop.cond17 - %38 = load i32, ptr %.anon16, align 4 - store i32 %38, ptr %i20, align 4 - %39 = load i32, ptr %.anon16, align 4 - store i32 %39, ptr %a22, align 4 - %40 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %41 = load i32, ptr %a22, align 4 - %sext23 = sext i32 %41 to i64 - %42 = getelementptr inbounds [3 x i32], ptr %40, i64 0, i64 %sext23 - %43 = load i32, ptr %42, align 4 - store i32 %43, ptr %y21, align 4 - %44 = load i32, ptr %i20, align 4 - %45 = load i32, ptr %y21, align 4 - call void (ptr, ...) @printf(ptr @.str.6, i32 %44, i32 %45) - %46 = load i32, ptr %.anon16, align 4 - %add24 = add i32 %46, 1 - store i32 %add24, ptr %.anon16, align 4 - br label %loop.cond17 - -loop.exit25: ; preds = %loop.cond17 - store i32 3, ptr %.anon26, align 4 - store i32 0, ptr %.anon27, align 4 - br label %loop.cond28 - -loop.cond28: ; preds = %loop.body30, %loop.exit25 - %47 = load i32, ptr %.anon27, align 4 - %48 = load i32, ptr %.anon26, align 4 - %lt29 = icmp slt i32 %47, %48 - br i1 %lt29, label %loop.body30, label %loop.exit36 - -loop.body30: ; preds = %loop.cond28 - %49 = load i32, ptr %.anon27, align 4 - store i32 %49, ptr %i31, align 4 - %50 = load i32, ptr %.anon27, align 4 - store i32 %50, ptr %a33, align 4 - %51 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %52 = load i32, ptr %a33, align 4 - %sext34 = sext i32 %52 to i64 - %53 = getelementptr inbounds [3 x i32], ptr %51, i64 0, i64 %sext34 - %54 = load i32, ptr %53, align 4 - store i32 %54, ptr %y32, align 4 - %55 = load i32, ptr %i31, align 4 - %56 = load i32, ptr %y32, align 4 - call void (ptr, ...) @printf(ptr @.str.7, i32 %55, i32 %56) - %57 = load i32, ptr %.anon27, align 4 - %add35 = add i32 %57, 1 - store i32 %add35, ptr %.anon27, align 4 - br label %loop.cond28 - -loop.exit36: ; preds = %loop.cond28 - store i32 3, ptr %.anon37, align 4 - store i32 0, ptr %.anon38, align 4 - br label %loop.cond39 - -loop.cond39: ; preds = %loop.body41, %loop.exit36 - %58 = load i32, ptr %.anon38, align 4 - %59 = load i32, ptr %.anon37, align 4 - %lt40 = icmp slt i32 %58, %59 - br i1 %lt40, label %loop.body41, label %loop.exit48 - -loop.body41: ; preds = %loop.cond39 - %60 = load i32, ptr %.anon38, align 4 - store i32 %60, ptr %i42, align 4 - %61 = load i32, ptr %.anon38, align 4 - store i32 %61, ptr %a44, align 4 - %62 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %63 = load i32, ptr %a44, align 4 - %sext45 = sext i32 %63 to i64 - %64 = getelementptr inbounds [3 x i32], ptr %62, i64 0, i64 %sext45 - %65 = load i32, ptr %64, align 4 - store i32 %65, ptr %y43, align 4 - %66 = load i32, ptr %i42, align 4 - %67 = load i32, ptr %y43, align 4 - call void (ptr, ...) @printf(ptr @.str.8, i32 %66, i32 %67) - %68 = load i32, ptr %i42, align 4 - %add46 = add i32 %68, 1 - store i32 %add46, ptr %i42, align 4 - %69 = load i32, ptr %.anon38, align 4 - %add47 = add i32 %69, 1 - store i32 %add47, ptr %.anon38, align 4 - br label %loop.cond39 - -loop.exit48: ; preds = %loop.cond39 - call void @llvm.memcpy.p0.p0.i32(ptr align 16 %.anon49, ptr align 16 @.__const.9, i32 20, i1 false) - store i64 0, ptr %.anon50, align 8 - br label %loop.cond51 - -loop.cond51: ; preds = %loop.body52, %loop.exit48 - %70 = load i64, ptr %.anon50, align 8 - %gt = icmp ugt i64 5, %70 - br i1 %gt, label %loop.body52, label %loop.exit57 - -loop.body52: ; preds = %loop.cond51 - %71 = load i64, ptr %.anon50, align 8 - store i64 %71, ptr %i53, align 8 - %72 = load i64, ptr %.anon50, align 8 - %73 = getelementptr inbounds [5 x i32], ptr %.anon49, i64 0, i64 %72 - %74 = load i32, ptr %73, align 4 - store i32 %74, ptr %y54, align 4 - %75 = load i64, ptr %i53, align 8 - %76 = load i32, ptr %y54, align 4 - call void (ptr, ...) @printf(ptr @.str.10, i64 %75, i32 %76) - %77 = load i64, ptr %i53, align 8 - %add55 = add i64 %77, 1 - store i64 %add55, ptr %i53, align 8 - %78 = load i64, ptr %.anon50, align 8 - %add56 = add i64 %78, 1 - store i64 %add56, ptr %.anon50, align 8 - br label %loop.cond51 - -loop.exit57: ; preds = %loop.cond51 - call void @foo.getFields(ptr sret([5 x i32]) align 4 %.anon58) - store i64 0, ptr %.anon59, align 8 - br label %loop.cond60 - -loop.cond60: ; preds = %loop.body62, %loop.exit57 - %79 = load i64, ptr %.anon59, align 8 - %gt61 = icmp ugt i64 5, %79 - br i1 %gt61, label %loop.body62, label %loop.exit66 - -loop.body62: ; preds = %loop.cond60 - %80 = load i64, ptr %.anon59, align 8 - store i64 %80, ptr %i63, align 8 - %81 = load i64, ptr %.anon59, align 8 - %82 = getelementptr inbounds [5 x i32], ptr %.anon58, i64 0, i64 %81 - %83 = load i32, ptr %82, align 4 - store i32 %83, ptr %y64, align 4 - %84 = load i64, ptr %i63, align 8 - %85 = load i32, ptr %y64, align 4 - call void (ptr, ...) @printf(ptr @.str.11, i64 %84, i32 %85) - %86 = load i64, ptr %.anon59, align 8 - %add65 = add i64 %86, 1 - store i64 %add65, ptr %.anon59, align 8 - br label %loop.cond60 - -loop.exit66: ; preds = %loop.cond60 + store i32 3, ptr %.anon4, align 4 + store i32 0, ptr %.anon5, align 4 + br label %loop.cond6 + +loop.cond6: ; preds = %loop.body8, %loop.exit + %15 = load i32, ptr %.anon5, align 4 + %16 = load i32, ptr %.anon4, align 4 + %lt7 = icmp slt i32 %15, %16 + br i1 %lt7, label %loop.body8, label %loop.exit16 + +loop.body8: ; preds = %loop.cond6 + %17 = load i32, ptr %.anon5, align 4 + store i32 %17, ptr %i9, align 4 + %18 = load i32, ptr %.anon5, align 4 + store i32 %18, ptr %a11, align 4 + %19 = load i32, ptr %a11, align 4 + %sext12 = sext i32 %19 to i64 + %ptroffset13 = getelementptr inbounds [4 x i8], ptr %x, i64 %sext12 + store ptr %ptroffset13, ptr %y10, align 8 + %20 = load ptr, ptr %y10, align 8 + %21 = load i32, ptr %20, align 4 + %add14 = add i32 %21, 1 + store i32 %add14, ptr %20, align 4 + %22 = load ptr, ptr %y10, align 8 + %23 = load i32, ptr %i9, align 4 + %24 = load i32, ptr %22, align 4 + call void (ptr, ...) @printf(ptr @.str.5, i32 %23, i32 %24) + %25 = load i32, ptr %.anon5, align 4 + %add15 = add i32 %25, 1 + store i32 %add15, ptr %.anon5, align 4 + br label %loop.cond6 + +loop.exit16: ; preds = %loop.cond6 + store i32 3, ptr %.anon17, align 4 + store i32 0, ptr %.anon18, align 4 + br label %loop.cond19 + +loop.cond19: ; preds = %loop.body21, %loop.exit16 + %26 = load i32, ptr %.anon18, align 4 + %27 = load i32, ptr %.anon17, align 4 + %lt20 = icmp slt i32 %26, %27 + br i1 %lt20, label %loop.body21, label %loop.exit28 + +loop.body21: ; preds = %loop.cond19 + %28 = load i32, ptr %.anon18, align 4 + store i32 %28, ptr %i22, align 4 + %29 = load i32, ptr %.anon18, align 4 + store i32 %29, ptr %a24, align 4 + %30 = load i32, ptr %a24, align 4 + %sext25 = sext i32 %30 to i64 + %ptroffset26 = getelementptr inbounds [4 x i8], ptr %x, i64 %sext25 + %31 = load i32, ptr %ptroffset26, align 4 + store i32 %31, ptr %y23, align 4 + %32 = load i32, ptr %i22, align 4 + %33 = load i32, ptr %y23, align 4 + call void (ptr, ...) @printf(ptr @.str.6, i32 %32, i32 %33) + %34 = load i32, ptr %.anon18, align 4 + %add27 = add i32 %34, 1 + store i32 %add27, ptr %.anon18, align 4 + br label %loop.cond19 + +loop.exit28: ; preds = %loop.cond19 + store i32 3, ptr %.anon29, align 4 + store i32 0, ptr %.anon30, align 4 + br label %loop.cond31 + +loop.cond31: ; preds = %loop.body33, %loop.exit28 + %35 = load i32, ptr %.anon30, align 4 + %36 = load i32, ptr %.anon29, align 4 + %lt32 = icmp slt i32 %35, %36 + br i1 %lt32, label %loop.body33, label %loop.exit40 + +loop.body33: ; preds = %loop.cond31 + %37 = load i32, ptr %.anon30, align 4 + store i32 %37, ptr %i34, align 4 + %38 = load i32, ptr %.anon30, align 4 + store i32 %38, ptr %a36, align 4 + %39 = load i32, ptr %a36, align 4 + %sext37 = sext i32 %39 to i64 + %ptroffset38 = getelementptr inbounds [4 x i8], ptr %x, i64 %sext37 + %40 = load i32, ptr %ptroffset38, align 4 + store i32 %40, ptr %y35, align 4 + %41 = load i32, ptr %i34, align 4 + %42 = load i32, ptr %y35, align 4 + call void (ptr, ...) @printf(ptr @.str.7, i32 %41, i32 %42) + %43 = load i32, ptr %.anon30, align 4 + %add39 = add i32 %43, 1 + store i32 %add39, ptr %.anon30, align 4 + br label %loop.cond31 + +loop.exit40: ; preds = %loop.cond31 + store i32 3, ptr %.anon41, align 4 + store i32 0, ptr %.anon42, align 4 + br label %loop.cond43 + +loop.cond43: ; preds = %loop.body45, %loop.exit40 + %44 = load i32, ptr %.anon42, align 4 + %45 = load i32, ptr %.anon41, align 4 + %lt44 = icmp slt i32 %44, %45 + br i1 %lt44, label %loop.body45, label %loop.exit53 + +loop.body45: ; preds = %loop.cond43 + %46 = load i32, ptr %.anon42, align 4 + store i32 %46, ptr %i46, align 4 + %47 = load i32, ptr %.anon42, align 4 + store i32 %47, ptr %a48, align 4 + %48 = load i32, ptr %a48, align 4 + %sext49 = sext i32 %48 to i64 + %ptroffset50 = getelementptr inbounds [4 x i8], ptr %x, i64 %sext49 + %49 = load i32, ptr %ptroffset50, align 4 + store i32 %49, ptr %y47, align 4 + %50 = load i32, ptr %i46, align 4 + %51 = load i32, ptr %y47, align 4 + call void (ptr, ...) @printf(ptr @.str.8, i32 %50, i32 %51) + %52 = load i32, ptr %i46, align 4 + %add51 = add i32 %52, 1 + store i32 %add51, ptr %i46, align 4 + %53 = load i32, ptr %.anon42, align 4 + %add52 = add i32 %53, 1 + store i32 %add52, ptr %.anon42, align 4 + br label %loop.cond43 + +loop.exit53: ; preds = %loop.cond43 + call void @llvm.memcpy.p0.p0.i32(ptr align 16 %.anon54, ptr align 16 @.__const.9, i32 20, i1 false) + store i64 0, ptr %.anon55, align 8 + br label %loop.cond56 + +loop.cond56: ; preds = %loop.body57, %loop.exit53 + %54 = load i64, ptr %.anon55, align 8 + %gt = icmp ugt i64 5, %54 + br i1 %gt, label %loop.body57, label %loop.exit63 + +loop.body57: ; preds = %loop.cond56 + %55 = load i64, ptr %.anon55, align 8 + store i64 %55, ptr %i58, align 8 + %56 = load i64, ptr %.anon55, align 8 + %ptroffset60 = getelementptr inbounds [4 x i8], ptr %.anon54, i64 %56 + %57 = load i32, ptr %ptroffset60, align 4 + store i32 %57, ptr %y59, align 4 + %58 = load i64, ptr %i58, align 8 + %59 = load i32, ptr %y59, align 4 + call void (ptr, ...) @printf(ptr @.str.10, i64 %58, i32 %59) + %60 = load i64, ptr %i58, align 8 + %add61 = add i64 %60, 1 + store i64 %add61, ptr %i58, align 8 + %61 = load i64, ptr %.anon55, align 8 + %add62 = add i64 %61, 1 + store i64 %add62, ptr %.anon55, align 8 + br label %loop.cond56 + +loop.exit63: ; preds = %loop.cond56 + call void @foo.getFields(ptr sret([5 x i32]) align 4 %.anon64) + store i64 0, ptr %.anon65, align 8 + br label %loop.cond66 + +loop.cond66: ; preds = %loop.body68, %loop.exit63 + %62 = load i64, ptr %.anon65, align 8 + %gt67 = icmp ugt i64 5, %62 + br i1 %gt67, label %loop.body68, label %loop.exit73 + +loop.body68: ; preds = %loop.cond66 + %63 = load i64, ptr %.anon65, align 8 + store i64 %63, ptr %i69, align 8 + %64 = load i64, ptr %.anon65, align 8 + %ptroffset71 = getelementptr inbounds [4 x i8], ptr %.anon64, i64 %64 + %65 = load i32, ptr %ptroffset71, align 4 + store i32 %65, ptr %y70, align 4 + %66 = load i64, ptr %i69, align 8 + %67 = load i32, ptr %y70, align 4 + call void (ptr, ...) @printf(ptr @.str.11, i64 %66, i32 %67) + %68 = load i64, ptr %.anon65, align 8 + %add72 = add i64 %68, 1 + store i64 %add72, ptr %.anon65, align 8 + br label %loop.cond66 + +loop.exit73: ; preds = %loop.cond66 call void @foo.getFields(ptr sret([5 x i32]) align 4 %sretparam) - store ptr %sretparam, ptr %.anon67, align 8 - store i64 0, ptr %.anon68, align 8 - br label %loop.cond69 - -loop.cond69: ; preds = %loop.body71, %loop.exit66 - %87 = load i64, ptr %.anon68, align 8 - %gt70 = icmp ugt i64 5, %87 - br i1 %gt70, label %loop.body71, label %loop.exit75 - -loop.body71: ; preds = %loop.cond69 - %88 = load i64, ptr %.anon68, align 8 - store i64 %88, ptr %i72, align 8 - %89 = load ptr, ptr %.anon67, align 8 - %90 = load i64, ptr %.anon68, align 8 - %91 = getelementptr inbounds [5 x i32], ptr %89, i64 0, i64 %90 - %92 = load i32, ptr %91, align 4 - store i32 %92, ptr %y73, align 4 - %93 = load i64, ptr %i72, align 8 - %94 = load i32, ptr %y73, align 4 - call void (ptr, ...) @printf(ptr @.str.12, i64 %93, i32 %94) - %95 = load i64, ptr %.anon68, align 8 - %add74 = add i64 %95, 1 - store i64 %add74, ptr %.anon68, align 8 - br label %loop.cond69 - -loop.exit75: ; preds = %loop.cond69 - %96 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %97 = getelementptr inbounds [3 x i32], ptr %96, i64 0, i64 0 - %98 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %99 = getelementptr inbounds [3 x i32], ptr %98, i64 0, i64 1 - %100 = load i32, ptr %97, align 4 - %101 = load i32, ptr %99, align 4 - call void (ptr, ...) @printf(ptr @.str.13, i32 %100, i32 %101) - %102 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %103 = getelementptr inbounds [3 x i32], ptr %102, i64 0, i64 1 - store ptr %103, ptr %y76, align 8 - %104 = load ptr, ptr %y76, align 8 - %105 = load i32, ptr %104, align 4 - %add77 = add i32 %105, 1 - store i32 %add77, ptr %104, align 4 - %106 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %107 = getelementptr inbounds [3 x i32], ptr %106, i64 0, i64 0 - %108 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %109 = getelementptr inbounds [3 x i32], ptr %108, i64 0, i64 1 - %110 = load i32, ptr %107, align 4 - %111 = load i32, ptr %109, align 4 - call void (ptr, ...) @printf(ptr @.str.14, i32 %110, i32 %111) + store ptr %sretparam, ptr %.anon74, align 8 + store i64 0, ptr %.anon75, align 8 + br label %loop.cond76 + +loop.cond76: ; preds = %loop.body78, %loop.exit73 + %69 = load i64, ptr %.anon75, align 8 + %gt77 = icmp ugt i64 5, %69 + br i1 %gt77, label %loop.body78, label %loop.exit83 + +loop.body78: ; preds = %loop.cond76 + %70 = load i64, ptr %.anon75, align 8 + store i64 %70, ptr %i79, align 8 + %71 = load ptr, ptr %.anon74, align 8 + %72 = load i64, ptr %.anon75, align 8 + %ptroffset81 = getelementptr inbounds [4 x i8], ptr %71, i64 %72 + %73 = load i32, ptr %ptroffset81, align 4 + store i32 %73, ptr %y80, align 4 + %74 = load i64, ptr %i79, align 8 + %75 = load i32, ptr %y80, align 4 + call void (ptr, ...) @printf(ptr @.str.12, i64 %74, i32 %75) + %76 = load i64, ptr %.anon75, align 8 + %add82 = add i64 %76, 1 + store i64 %add82, ptr %.anon75, align 8 + br label %loop.cond76 + +loop.exit83: ; preds = %loop.cond76 + %ptradd84 = getelementptr inbounds i8, ptr %x, i64 4 + %77 = load i32, ptr %x, align 4 + %78 = load i32, ptr %ptradd84, align 4 + call void (ptr, ...) @printf(ptr @.str.13, i32 %77, i32 %78) + %ptradd86 = getelementptr inbounds i8, ptr %x, i64 4 + store ptr %ptradd86, ptr %y85, align 8 + %79 = load ptr, ptr %y85, align 8 + %80 = load i32, ptr %79, align 4 + %add87 = add i32 %80, 1 + store i32 %add87, ptr %79, align 4 + %ptradd88 = getelementptr inbounds i8, ptr %x, i64 4 + %81 = load i32, ptr %x, align 4 + %82 = load i32, ptr %ptradd88, align 4 + call void (ptr, ...) @printf(ptr @.str.14, i32 %81, i32 %82) ret void } diff --git a/test/test_suite/statements/foreach_break.c3t b/test/test_suite/statements/foreach_break.c3t index a91132c9f..a46ddb94e 100644 --- a/test/test_suite/statements/foreach_break.c3t +++ b/test/test_suite/statements/foreach_break.c3t @@ -21,52 +21,51 @@ entry: %g = alloca i32, align 4 %.anon = alloca i64, align 8 %z = alloca i32, align 4 - %0 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 0 - store i32 0, ptr %0, align 4 - %1 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - store i32 0, ptr %1, align 4 - %2 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 2 - store i32 0, ptr %2, align 4 + store i32 0, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + store i32 0, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + store i32 0, ptr %ptradd1, align 4 store i32 0, ptr %g, align 4 store i64 0, ptr %.anon, align 8 br label %loop.cond loop.cond: ; preds = %loop.inc, %entry - %3 = load i64, ptr %.anon, align 8 - %gt = icmp ugt i64 3, %3 + %0 = load i64, ptr %.anon, align 8 + %gt = icmp ugt i64 3, %0 br i1 %gt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %4 = load i64, ptr %.anon, align 8 - %5 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 %4 - %6 = load i32, ptr %5, align 4 - store i32 %6, ptr %z, align 4 - %7 = load i32, ptr %z, align 4 - %gt1 = icmp sgt i32 %7, 0 - br i1 %gt1, label %if.then, label %if.exit + %1 = load i64, ptr %.anon, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %x, i64 %1 + %2 = load i32, ptr %ptroffset, align 4 + store i32 %2, ptr %z, align 4 + %3 = load i32, ptr %z, align 4 + %gt2 = icmp sgt i32 %3, 0 + br i1 %gt2, label %if.then, label %if.exit if.then: ; preds = %loop.body br label %loop.exit if.exit: ; preds = %loop.body - %8 = load i32, ptr %z, align 4 - %eq = icmp eq i32 %8, 1 - br i1 %eq, label %if.then2, label %if.exit3 + %4 = load i32, ptr %z, align 4 + %eq = icmp eq i32 %4, 1 + br i1 %eq, label %if.then3, label %if.exit4 -if.then2: ; preds = %if.exit +if.then3: ; preds = %if.exit br label %loop.inc -if.exit3: ; preds = %if.exit - %9 = load i32, ptr %g, align 4 - %10 = load i32, ptr %z, align 4 - %add = add i32 %9, %10 +if.exit4: ; preds = %if.exit + %5 = load i32, ptr %g, align 4 + %6 = load i32, ptr %z, align 4 + %add = add i32 %5, %6 store i32 %add, ptr %g, align 4 br label %loop.inc -loop.inc: ; preds = %if.exit3, %if.then2 - %11 = load i64, ptr %.anon, align 8 - %add4 = add i64 %11, 1 - store i64 %add4, ptr %.anon, align 8 +loop.inc: ; preds = %if.exit4, %if.then3 + %7 = load i64, ptr %.anon, align 8 + %add5 = add i64 %7, 1 + store i64 %add5, ptr %.anon, align 8 br label %loop.cond loop.exit: ; preds = %if.then, %loop.cond diff --git a/test/test_suite/statements/foreach_common.c3t b/test/test_suite/statements/foreach_common.c3t index bafc3fb80..6234d1044 100644 --- a/test/test_suite/statements/foreach_common.c3t +++ b/test/test_suite/statements/foreach_common.c3t @@ -65,33 +65,33 @@ entry: %a = alloca float, align 4 %.anon1 = alloca i64, align 8 %a5 = alloca ptr, align 8 - %.anon9 = alloca i64, align 8 - %a13 = alloca ptr, align 8 - %.anon17 = alloca i64, align 8 + %.anon10 = alloca i64, align 8 + %a14 = alloca ptr, align 8 + %.anon19 = alloca i64, align 8 %i = alloca i64, align 8 - %a21 = alloca float, align 4 - %.anon25 = alloca i64, align 8 - %i29 = alloca i8, align 1 - %a30 = alloca double, align 8 - %.anon34 = alloca i64, align 8 - %a38 = alloca double, align 8 - %.anon42 = alloca i64, align 8 - %.anon43 = alloca i64, align 8 - %a46 = alloca float, align 4 - %.anon50 = alloca i64, align 8 - %.anon51 = alloca i64, align 8 - %a55 = alloca ptr, align 8 - %.anon60 = alloca i64, align 8 - %.anon61 = alloca i64, align 8 - %i65 = alloca i64, align 8 - %a66 = alloca float, align 4 - %.anon70 = alloca i64, align 8 - %.anon71 = alloca i64, align 8 - %i75 = alloca i8, align 1 - %a77 = alloca double, align 8 - %.anon82 = alloca i64, align 8 - %.anon83 = alloca i64, align 8 - %a87 = alloca double, align 8 + %a23 = alloca float, align 4 + %.anon28 = alloca i64, align 8 + %i32 = alloca i8, align 1 + %a33 = alloca double, align 8 + %.anon38 = alloca i64, align 8 + %a42 = alloca double, align 8 + %.anon47 = alloca i64, align 8 + %.anon48 = alloca i64, align 8 + %a51 = alloca float, align 4 + %.anon55 = alloca i64, align 8 + %.anon56 = alloca i64, align 8 + %a60 = alloca ptr, align 8 + %.anon66 = alloca i64, align 8 + %.anon67 = alloca i64, align 8 + %i71 = alloca i64, align 8 + %a72 = alloca float, align 4 + %.anon76 = alloca i64, align 8 + %.anon77 = alloca i64, align 8 + %i81 = alloca i8, align 1 + %a83 = alloca double, align 8 + %.anon88 = alloca i64, align 8 + %.anon89 = alloca i64, align 8 + %a93 = alloca double, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %foo, ptr align 4 @.__const, i32 12, i1 false) store <3 x float> , ptr %foo2, align 16 store i64 0, ptr %.anon, align 8 @@ -104,14 +104,14 @@ loop.cond: ; preds = %loop.body, %entry loop.body: ; preds = %loop.cond %1 = load i64, ptr %.anon, align 8 - %2 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %1 - %3 = load float, ptr %2, align 4 - store float %3, ptr %a, align 4 - %4 = load float, ptr %a, align 4 - %fpfpext = fpext float %4 to double + %ptroffset = getelementptr inbounds [4 x i8], ptr %foo, i64 %1 + %2 = load float, ptr %ptroffset, align 4 + store float %2, ptr %a, align 4 + %3 = load float, ptr %a, align 4 + %fpfpext = fpext float %3 to double call void (ptr, ...) @printf(ptr @.str, double %fpfpext) - %5 = load i64, ptr %.anon, align 8 - %add = add i64 %5, 1 + %4 = load i64, ptr %.anon, align 8 + %add = add i64 %4, 1 store i64 %add, ptr %.anon, align 8 br label %loop.cond @@ -120,255 +120,255 @@ loop.exit: ; preds = %loop.cond br label %loop.cond2 loop.cond2: ; preds = %loop.body4, %loop.exit - %6 = load i64, ptr %.anon1, align 8 - %gt3 = icmp ugt i64 3, %6 - br i1 %gt3, label %loop.body4, label %loop.exit8 + %5 = load i64, ptr %.anon1, align 8 + %gt3 = icmp ugt i64 3, %5 + br i1 %gt3, label %loop.body4, label %loop.exit9 loop.body4: ; preds = %loop.cond2 - %7 = load i64, ptr %.anon1, align 8 - %8 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %7 - store ptr %8, ptr %a5, align 8 + %6 = load i64, ptr %.anon1, align 8 + %ptroffset6 = getelementptr inbounds [4 x i8], ptr %foo, i64 %6 + store ptr %ptroffset6, ptr %a5, align 8 + %7 = load ptr, ptr %a5, align 8 + %8 = load float, ptr %7, align 4 + %fmul = fmul float %8, 2.000000e+00 + store float %fmul, ptr %7, align 4 %9 = load ptr, ptr %a5, align 8 %10 = load float, ptr %9, align 4 - %fmul = fmul float %10, 2.000000e+00 - store float %fmul, ptr %9, align 4 - %11 = load ptr, ptr %a5, align 8 - %12 = load float, ptr %11, align 4 - %fpfpext6 = fpext float %12 to double - call void (ptr, ...) @printf(ptr @.str.1, double %fpfpext6) - %13 = load i64, ptr %.anon1, align 8 - %add7 = add i64 %13, 1 - store i64 %add7, ptr %.anon1, align 8 + %fpfpext7 = fpext float %10 to double + call void (ptr, ...) @printf(ptr @.str.1, double %fpfpext7) + %11 = load i64, ptr %.anon1, align 8 + %add8 = add i64 %11, 1 + store i64 %add8, ptr %.anon1, align 8 br label %loop.cond2 -loop.exit8: ; preds = %loop.cond2 - store i64 0, ptr %.anon9, align 8 - br label %loop.cond10 - -loop.cond10: ; preds = %loop.body12, %loop.exit8 - %14 = load i64, ptr %.anon9, align 8 - %gt11 = icmp ugt i64 3, %14 - br i1 %gt11, label %loop.body12, label %loop.exit16 - -loop.body12: ; preds = %loop.cond10 - %15 = load i64, ptr %.anon9, align 8 - %16 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %15 - store ptr %16, ptr %a13, align 8 - %17 = load ptr, ptr %a13, align 8 - %18 = load float, ptr %17, align 4 - %fpfpext14 = fpext float %18 to double - call void (ptr, ...) @printf(ptr @.str.2, double %fpfpext14) - %19 = load i64, ptr %.anon9, align 8 - %add15 = add i64 %19, 1 - store i64 %add15, ptr %.anon9, align 8 - br label %loop.cond10 - -loop.exit16: ; preds = %loop.cond10 - store i64 0, ptr %.anon17, align 8 - br label %loop.cond18 - -loop.cond18: ; preds = %loop.body20, %loop.exit16 - %20 = load i64, ptr %.anon17, align 8 - %gt19 = icmp ugt i64 3, %20 - br i1 %gt19, label %loop.body20, label %loop.exit24 - -loop.body20: ; preds = %loop.cond18 - %21 = load i64, ptr %.anon17, align 8 - store i64 %21, ptr %i, align 8 - %22 = load i64, ptr %.anon17, align 8 - %23 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %22 - %24 = load float, ptr %23, align 4 - store float %24, ptr %a21, align 4 - %25 = load float, ptr %a21, align 4 - %fpfpext22 = fpext float %25 to double - %26 = load i64, ptr %i, align 8 - call void (ptr, ...) @printf(ptr @.str.3, i64 %26, double %fpfpext22) - %27 = load i64, ptr %.anon17, align 8 - %add23 = add i64 %27, 1 - store i64 %add23, ptr %.anon17, align 8 - br label %loop.cond18 - -loop.exit24: ; preds = %loop.cond18 - store i64 0, ptr %.anon25, align 8 - br label %loop.cond26 - -loop.cond26: ; preds = %loop.body28, %loop.exit24 - %28 = load i64, ptr %.anon25, align 8 - %gt27 = icmp ugt i64 3, %28 - br i1 %gt27, label %loop.body28, label %loop.exit33 - -loop.body28: ; preds = %loop.cond26 - %29 = load i64, ptr %.anon25, align 8 - %trunc = trunc i64 %29 to i8 - store i8 %trunc, ptr %i29, align 1 - %30 = load i64, ptr %.anon25, align 8 - %31 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %30 - %32 = load float, ptr %31, align 4 - %fpfpext31 = fpext float %32 to double - store double %fpfpext31, ptr %a30, align 8 - %33 = load i8, ptr %i29, align 1 - %zext = zext i8 %33 to i32 - %34 = load double, ptr %a30, align 8 - call void (ptr, ...) @printf(ptr @.str.4, i32 %zext, double %34) - %35 = load i64, ptr %.anon25, align 8 - %add32 = add i64 %35, 1 - store i64 %add32, ptr %.anon25, align 8 - br label %loop.cond26 - -loop.exit33: ; preds = %loop.cond26 - store i64 0, ptr %.anon34, align 8 - br label %loop.cond35 - -loop.cond35: ; preds = %loop.body37, %loop.exit33 - %36 = load i64, ptr %.anon34, align 8 - %gt36 = icmp ugt i64 3, %36 - br i1 %gt36, label %loop.body37, label %loop.exit41 - -loop.body37: ; preds = %loop.cond35 - %37 = load i64, ptr %.anon34, align 8 - %38 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %37 - %39 = load float, ptr %38, align 4 - %fpfpext39 = fpext float %39 to double - store double %fpfpext39, ptr %a38, align 8 - %40 = load double, ptr %a38, align 8 - call void (ptr, ...) @printf(ptr @.str.5, double %40) - %41 = load i64, ptr %.anon34, align 8 - %add40 = add i64 %41, 1 - store i64 %add40, ptr %.anon34, align 8 - br label %loop.cond35 - -loop.exit41: ; preds = %loop.cond35 - store i64 3, ptr %.anon42, align 8 - store i64 0, ptr %.anon43, align 8 - br label %loop.cond44 - -loop.cond44: ; preds = %loop.body45, %loop.exit41 - %42 = load i64, ptr %.anon43, align 8 - %43 = load i64, ptr %.anon42, align 8 - %lt = icmp ult i64 %42, %43 - br i1 %lt, label %loop.body45, label %loop.exit49 - -loop.body45: ; preds = %loop.cond44 - %44 = load <3 x float>, ptr %foo2, align 16 - %45 = load i64, ptr %.anon43, align 8 - %46 = extractelement <3 x float> %44, i64 %45 - store float %46, ptr %a46, align 4 - %47 = load float, ptr %a46, align 4 - %fpfpext47 = fpext float %47 to double - call void (ptr, ...) @printf(ptr @.str.6, double %fpfpext47) - %48 = load i64, ptr %.anon43, align 8 - %add48 = add i64 %48, 1 - store i64 %add48, ptr %.anon43, align 8 - br label %loop.cond44 - -loop.exit49: ; preds = %loop.cond44 - store i64 3, ptr %.anon50, align 8 - store i64 0, ptr %.anon51, align 8 - br label %loop.cond52 - -loop.cond52: ; preds = %loop.body54, %loop.exit49 - %49 = load i64, ptr %.anon51, align 8 - %50 = load i64, ptr %.anon50, align 8 - %lt53 = icmp ult i64 %49, %50 - br i1 %lt53, label %loop.body54, label %loop.exit59 - -loop.body54: ; preds = %loop.cond52 - %51 = load i64, ptr %.anon51, align 8 - %52 = getelementptr inbounds <3 x float>, ptr %foo2, i64 0, i64 %51 - store ptr %52, ptr %a55, align 8 - %53 = load ptr, ptr %a55, align 8 - %54 = load float, ptr %53, align 4 - %fmul56 = fmul float %54, 2.000000e+00 - store float %fmul56, ptr %53, align 4 - %55 = load ptr, ptr %a55, align 8 - %56 = load float, ptr %55, align 4 - %fpfpext57 = fpext float %56 to double - call void (ptr, ...) @printf(ptr @.str.7, double %fpfpext57) - %57 = load i64, ptr %.anon51, align 8 - %add58 = add i64 %57, 1 - store i64 %add58, ptr %.anon51, align 8 - br label %loop.cond52 - -loop.exit59: ; preds = %loop.cond52 - store i64 3, ptr %.anon60, align 8 - store i64 0, ptr %.anon61, align 8 - br label %loop.cond62 - -loop.cond62: ; preds = %loop.body64, %loop.exit59 - %58 = load i64, ptr %.anon61, align 8 - %59 = load i64, ptr %.anon60, align 8 - %lt63 = icmp ult i64 %58, %59 - br i1 %lt63, label %loop.body64, label %loop.exit69 - -loop.body64: ; preds = %loop.cond62 - %60 = load i64, ptr %.anon61, align 8 - store i64 %60, ptr %i65, align 8 - %61 = load <3 x float>, ptr %foo2, align 16 - %62 = load i64, ptr %.anon61, align 8 - %63 = extractelement <3 x float> %61, i64 %62 - store float %63, ptr %a66, align 4 - %64 = load float, ptr %a66, align 4 - %fpfpext67 = fpext float %64 to double - %65 = load i64, ptr %i65, align 8 - call void (ptr, ...) @printf(ptr @.str.8, i64 %65, double %fpfpext67) - %66 = load i64, ptr %.anon61, align 8 - %add68 = add i64 %66, 1 - store i64 %add68, ptr %.anon61, align 8 - br label %loop.cond62 - -loop.exit69: ; preds = %loop.cond62 - store i64 3, ptr %.anon70, align 8 - store i64 0, ptr %.anon71, align 8 - br label %loop.cond72 - -loop.cond72: ; preds = %loop.body74, %loop.exit69 - %67 = load i64, ptr %.anon71, align 8 - %68 = load i64, ptr %.anon70, align 8 - %lt73 = icmp ult i64 %67, %68 - br i1 %lt73, label %loop.body74, label %loop.exit81 - -loop.body74: ; preds = %loop.cond72 - %69 = load i64, ptr %.anon71, align 8 - %trunc76 = trunc i64 %69 to i8 - store i8 %trunc76, ptr %i75, align 1 - %70 = load <3 x float>, ptr %foo2, align 16 - %71 = load i64, ptr %.anon71, align 8 - %72 = extractelement <3 x float> %70, i64 %71 - %fpfpext78 = fpext float %72 to double - store double %fpfpext78, ptr %a77, align 8 - %73 = load i8, ptr %i75, align 1 - %zext79 = zext i8 %73 to i32 - %74 = load double, ptr %a77, align 8 - call void (ptr, ...) @printf(ptr @.str.9, i32 %zext79, double %74) - %75 = load i64, ptr %.anon71, align 8 - %add80 = add i64 %75, 1 - store i64 %add80, ptr %.anon71, align 8 - br label %loop.cond72 - -loop.exit81: ; preds = %loop.cond72 - store i64 3, ptr %.anon82, align 8 - store i64 0, ptr %.anon83, align 8 - br label %loop.cond84 - -loop.cond84: ; preds = %loop.body86, %loop.exit81 - %76 = load i64, ptr %.anon83, align 8 - %77 = load i64, ptr %.anon82, align 8 - %lt85 = icmp ult i64 %76, %77 - br i1 %lt85, label %loop.body86, label %loop.exit90 - -loop.body86: ; preds = %loop.cond84 - %78 = load <3 x float>, ptr %foo2, align 16 - %79 = load i64, ptr %.anon83, align 8 - %80 = extractelement <3 x float> %78, i64 %79 - %fpfpext88 = fpext float %80 to double - store double %fpfpext88, ptr %a87, align 8 - %81 = load double, ptr %a87, align 8 - call void (ptr, ...) @printf(ptr @.str.10, double %81) - %82 = load i64, ptr %.anon83, align 8 - %add89 = add i64 %82, 1 - store i64 %add89, ptr %.anon83, align 8 - br label %loop.cond84 - -loop.exit90: ; preds = %loop.cond84 +loop.exit9: ; preds = %loop.cond2 + store i64 0, ptr %.anon10, align 8 + br label %loop.cond11 + +loop.cond11: ; preds = %loop.body13, %loop.exit9 + %12 = load i64, ptr %.anon10, align 8 + %gt12 = icmp ugt i64 3, %12 + br i1 %gt12, label %loop.body13, label %loop.exit18 + +loop.body13: ; preds = %loop.cond11 + %13 = load i64, ptr %.anon10, align 8 + %ptroffset15 = getelementptr inbounds [4 x i8], ptr %foo, i64 %13 + store ptr %ptroffset15, ptr %a14, align 8 + %14 = load ptr, ptr %a14, align 8 + %15 = load float, ptr %14, align 4 + %fpfpext16 = fpext float %15 to double + call void (ptr, ...) @printf(ptr @.str.2, double %fpfpext16) + %16 = load i64, ptr %.anon10, align 8 + %add17 = add i64 %16, 1 + store i64 %add17, ptr %.anon10, align 8 + br label %loop.cond11 + +loop.exit18: ; preds = %loop.cond11 + store i64 0, ptr %.anon19, align 8 + br label %loop.cond20 + +loop.cond20: ; preds = %loop.body22, %loop.exit18 + %17 = load i64, ptr %.anon19, align 8 + %gt21 = icmp ugt i64 3, %17 + br i1 %gt21, label %loop.body22, label %loop.exit27 + +loop.body22: ; preds = %loop.cond20 + %18 = load i64, ptr %.anon19, align 8 + store i64 %18, ptr %i, align 8 + %19 = load i64, ptr %.anon19, align 8 + %ptroffset24 = getelementptr inbounds [4 x i8], ptr %foo, i64 %19 + %20 = load float, ptr %ptroffset24, align 4 + store float %20, ptr %a23, align 4 + %21 = load float, ptr %a23, align 4 + %fpfpext25 = fpext float %21 to double + %22 = load i64, ptr %i, align 8 + call void (ptr, ...) @printf(ptr @.str.3, i64 %22, double %fpfpext25) + %23 = load i64, ptr %.anon19, align 8 + %add26 = add i64 %23, 1 + store i64 %add26, ptr %.anon19, align 8 + br label %loop.cond20 + +loop.exit27: ; preds = %loop.cond20 + store i64 0, ptr %.anon28, align 8 + br label %loop.cond29 + +loop.cond29: ; preds = %loop.body31, %loop.exit27 + %24 = load i64, ptr %.anon28, align 8 + %gt30 = icmp ugt i64 3, %24 + br i1 %gt30, label %loop.body31, label %loop.exit37 + +loop.body31: ; preds = %loop.cond29 + %25 = load i64, ptr %.anon28, align 8 + %trunc = trunc i64 %25 to i8 + store i8 %trunc, ptr %i32, align 1 + %26 = load i64, ptr %.anon28, align 8 + %ptroffset34 = getelementptr inbounds [4 x i8], ptr %foo, i64 %26 + %27 = load float, ptr %ptroffset34, align 4 + %fpfpext35 = fpext float %27 to double + store double %fpfpext35, ptr %a33, align 8 + %28 = load i8, ptr %i32, align 1 + %zext = zext i8 %28 to i32 + %29 = load double, ptr %a33, align 8 + call void (ptr, ...) @printf(ptr @.str.4, i32 %zext, double %29) + %30 = load i64, ptr %.anon28, align 8 + %add36 = add i64 %30, 1 + store i64 %add36, ptr %.anon28, align 8 + br label %loop.cond29 + +loop.exit37: ; preds = %loop.cond29 + store i64 0, ptr %.anon38, align 8 + br label %loop.cond39 + +loop.cond39: ; preds = %loop.body41, %loop.exit37 + %31 = load i64, ptr %.anon38, align 8 + %gt40 = icmp ugt i64 3, %31 + br i1 %gt40, label %loop.body41, label %loop.exit46 + +loop.body41: ; preds = %loop.cond39 + %32 = load i64, ptr %.anon38, align 8 + %ptroffset43 = getelementptr inbounds [4 x i8], ptr %foo, i64 %32 + %33 = load float, ptr %ptroffset43, align 4 + %fpfpext44 = fpext float %33 to double + store double %fpfpext44, ptr %a42, align 8 + %34 = load double, ptr %a42, align 8 + call void (ptr, ...) @printf(ptr @.str.5, double %34) + %35 = load i64, ptr %.anon38, align 8 + %add45 = add i64 %35, 1 + store i64 %add45, ptr %.anon38, align 8 + br label %loop.cond39 + +loop.exit46: ; preds = %loop.cond39 + store i64 3, ptr %.anon47, align 8 + store i64 0, ptr %.anon48, align 8 + br label %loop.cond49 + +loop.cond49: ; preds = %loop.body50, %loop.exit46 + %36 = load i64, ptr %.anon48, align 8 + %37 = load i64, ptr %.anon47, align 8 + %lt = icmp ult i64 %36, %37 + br i1 %lt, label %loop.body50, label %loop.exit54 + +loop.body50: ; preds = %loop.cond49 + %38 = load <3 x float>, ptr %foo2, align 16 + %39 = load i64, ptr %.anon48, align 8 + %40 = extractelement <3 x float> %38, i64 %39 + store float %40, ptr %a51, align 4 + %41 = load float, ptr %a51, align 4 + %fpfpext52 = fpext float %41 to double + call void (ptr, ...) @printf(ptr @.str.6, double %fpfpext52) + %42 = load i64, ptr %.anon48, align 8 + %add53 = add i64 %42, 1 + store i64 %add53, ptr %.anon48, align 8 + br label %loop.cond49 + +loop.exit54: ; preds = %loop.cond49 + store i64 3, ptr %.anon55, align 8 + store i64 0, ptr %.anon56, align 8 + br label %loop.cond57 + +loop.cond57: ; preds = %loop.body59, %loop.exit54 + %43 = load i64, ptr %.anon56, align 8 + %44 = load i64, ptr %.anon55, align 8 + %lt58 = icmp ult i64 %43, %44 + br i1 %lt58, label %loop.body59, label %loop.exit65 + +loop.body59: ; preds = %loop.cond57 + %45 = load i64, ptr %.anon56, align 8 + %ptroffset61 = getelementptr inbounds [4 x i8], ptr %foo2, i64 %45 + store ptr %ptroffset61, ptr %a60, align 8 + %46 = load ptr, ptr %a60, align 8 + %47 = load float, ptr %46, align 4 + %fmul62 = fmul float %47, 2.000000e+00 + store float %fmul62, ptr %46, align 4 + %48 = load ptr, ptr %a60, align 8 + %49 = load float, ptr %48, align 4 + %fpfpext63 = fpext float %49 to double + call void (ptr, ...) @printf(ptr @.str.7, double %fpfpext63) + %50 = load i64, ptr %.anon56, align 8 + %add64 = add i64 %50, 1 + store i64 %add64, ptr %.anon56, align 8 + br label %loop.cond57 + +loop.exit65: ; preds = %loop.cond57 + store i64 3, ptr %.anon66, align 8 + store i64 0, ptr %.anon67, align 8 + br label %loop.cond68 + +loop.cond68: ; preds = %loop.body70, %loop.exit65 + %51 = load i64, ptr %.anon67, align 8 + %52 = load i64, ptr %.anon66, align 8 + %lt69 = icmp ult i64 %51, %52 + br i1 %lt69, label %loop.body70, label %loop.exit75 + +loop.body70: ; preds = %loop.cond68 + %53 = load i64, ptr %.anon67, align 8 + store i64 %53, ptr %i71, align 8 + %54 = load <3 x float>, ptr %foo2, align 16 + %55 = load i64, ptr %.anon67, align 8 + %56 = extractelement <3 x float> %54, i64 %55 + store float %56, ptr %a72, align 4 + %57 = load float, ptr %a72, align 4 + %fpfpext73 = fpext float %57 to double + %58 = load i64, ptr %i71, align 8 + call void (ptr, ...) @printf(ptr @.str.8, i64 %58, double %fpfpext73) + %59 = load i64, ptr %.anon67, align 8 + %add74 = add i64 %59, 1 + store i64 %add74, ptr %.anon67, align 8 + br label %loop.cond68 + +loop.exit75: ; preds = %loop.cond68 + store i64 3, ptr %.anon76, align 8 + store i64 0, ptr %.anon77, align 8 + br label %loop.cond78 + +loop.cond78: ; preds = %loop.body80, %loop.exit75 + %60 = load i64, ptr %.anon77, align 8 + %61 = load i64, ptr %.anon76, align 8 + %lt79 = icmp ult i64 %60, %61 + br i1 %lt79, label %loop.body80, label %loop.exit87 + +loop.body80: ; preds = %loop.cond78 + %62 = load i64, ptr %.anon77, align 8 + %trunc82 = trunc i64 %62 to i8 + store i8 %trunc82, ptr %i81, align 1 + %63 = load <3 x float>, ptr %foo2, align 16 + %64 = load i64, ptr %.anon77, align 8 + %65 = extractelement <3 x float> %63, i64 %64 + %fpfpext84 = fpext float %65 to double + store double %fpfpext84, ptr %a83, align 8 + %66 = load i8, ptr %i81, align 1 + %zext85 = zext i8 %66 to i32 + %67 = load double, ptr %a83, align 8 + call void (ptr, ...) @printf(ptr @.str.9, i32 %zext85, double %67) + %68 = load i64, ptr %.anon77, align 8 + %add86 = add i64 %68, 1 + store i64 %add86, ptr %.anon77, align 8 + br label %loop.cond78 + +loop.exit87: ; preds = %loop.cond78 + store i64 3, ptr %.anon88, align 8 + store i64 0, ptr %.anon89, align 8 + br label %loop.cond90 + +loop.cond90: ; preds = %loop.body92, %loop.exit87 + %69 = load i64, ptr %.anon89, align 8 + %70 = load i64, ptr %.anon88, align 8 + %lt91 = icmp ult i64 %69, %70 + br i1 %lt91, label %loop.body92, label %loop.exit96 + +loop.body92: ; preds = %loop.cond90 + %71 = load <3 x float>, ptr %foo2, align 16 + %72 = load i64, ptr %.anon89, align 8 + %73 = extractelement <3 x float> %71, i64 %72 + %fpfpext94 = fpext float %73 to double + store double %fpfpext94, ptr %a93, align 8 + %74 = load double, ptr %a93, align 8 + call void (ptr, ...) @printf(ptr @.str.10, double %74) + %75 = load i64, ptr %.anon89, align 8 + %add95 = add i64 %75, 1 + store i64 %add95, ptr %.anon89, align 8 + br label %loop.cond90 + +loop.exit96: ; preds = %loop.cond90 ret void } diff --git a/test/test_suite/statements/foreach_custom.c3t b/test/test_suite/statements/foreach_custom.c3t index a096e4dbf..62eb9ea03 100644 --- a/test/test_suite/statements/foreach_custom.c3t +++ b/test/test_suite/statements/foreach_custom.c3t @@ -43,35 +43,31 @@ entry: %f = alloca i32, align 4 %index = alloca i64, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %i, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %1 = insertvalue %"int[]" undef, ptr %i, 0 - %2 = insertvalue %"int[]" %1, i64 3, 1 - store %"int[]" %2, ptr %0, align 8 - %3 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %4 = getelementptr inbounds %"int[]", ptr %3, i32 0, i32 1 - %5 = load i64, ptr %4, align 8 - store i64 %5, ptr %.anon, align 8 + %0 = insertvalue %"int[]" undef, ptr %i, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + store %"int[]" %1, ptr %x, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + %2 = load i64, ptr %ptradd, align 8 + store i64 %2, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond loop.cond: ; preds = %entry - %6 = load i64, ptr %.anon1, align 8 - %7 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %6, %7 + %3 = load i64, ptr %.anon1, align 8 + %4 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %3, %4 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %8 = load i64, ptr %.anon1, align 8 - store i64 %8, ptr %index, align 8 - %9 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %10 = getelementptr inbounds %"int[]", ptr %9, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - %12 = load i64, ptr %index, align 8 - %ptroffset = getelementptr inbounds i32, ptr %11, i64 %12 - %13 = load i32, ptr %ptroffset, align 4 - store i32 %13, ptr %f, align 4 - %14 = load i32, ptr %f, align 4 - %15 = call i32 (ptr, ...) @printf(ptr @.str, i32 %14) + %5 = load i64, ptr %.anon1, align 8 + store i64 %5, ptr %index, align 8 + %6 = load ptr, ptr %x, align 8 + %7 = load i64, ptr %index, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %6, i64 %7 + %8 = load i32, ptr %ptroffset, align 4 + store i32 %8, ptr %f, align 4 + %9 = load i32, ptr %f, align 4 + %10 = call i32 (ptr, ...) @printf(ptr @.str, i32 %9) br label %loop.body2 loop.body2: ; preds = %loop.body @@ -81,10 +77,10 @@ loop.exit: ; preds = %loop.body2, %loop.c ret void } - +; Function Attrs: declare i32 @printf(ptr, ...) #0 - +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 { entry: call void @test.main() diff --git a/test/test_suite/statements/foreach_custom_macro.c3t b/test/test_suite/statements/foreach_custom_macro.c3t index 77f659151..827a8e69a 100644 --- a/test/test_suite/statements/foreach_custom_macro.c3t +++ b/test/test_suite/statements/foreach_custom_macro.c3t @@ -39,7 +39,7 @@ extern fn int printf(char *fmt, ...); @.__const = private unnamed_addr constant [3 x i32] [i32 1, i32 3, i32 10], align 4 @.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1 - +; Function Attrs: define void @foo.main() #0 { entry: %i = alloca [3 x i32], align 4 @@ -49,35 +49,31 @@ entry: %f = alloca i32, align 4 %index = alloca i64, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %i, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %1 = insertvalue %"int[]" undef, ptr %i, 0 - %2 = insertvalue %"int[]" %1, i64 3, 1 - store %"int[]" %2, ptr %0, align 8 - %3 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %4 = getelementptr inbounds %"int[]", ptr %3, i32 0, i32 1 - %5 = load i64, ptr %4, align 8 - store i64 %5, ptr %.anon, align 8 + %0 = insertvalue %"int[]" undef, ptr %i, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + store %"int[]" %1, ptr %x, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + %2 = load i64, ptr %ptradd, align 8 + store i64 %2, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond loop.cond: ; preds = %entry - %6 = load i64, ptr %.anon1, align 8 - %7 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %6, %7 + %3 = load i64, ptr %.anon1, align 8 + %4 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %3, %4 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %8 = load i64, ptr %.anon1, align 8 - store i64 %8, ptr %index, align 8 - %9 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %10 = getelementptr inbounds %"int[]", ptr %9, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - %12 = load i64, ptr %index, align 8 - %ptroffset = getelementptr inbounds i32, ptr %11, i64 %12 - %13 = load i32, ptr %ptroffset, align 4 - store i32 %13, ptr %f, align 4 - %14 = load i32, ptr %f, align 4 - %15 = call i32 (ptr, ...) @printf(ptr @.str, i32 %14) + %5 = load i64, ptr %.anon1, align 8 + store i64 %5, ptr %index, align 8 + %6 = load ptr, ptr %x, align 8 + %7 = load i64, ptr %index, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %6, i64 %7 + %8 = load i32, ptr %ptroffset, align 4 + store i32 %8, ptr %f, align 4 + %9 = load i32, ptr %f, align 4 + %10 = call i32 (ptr, ...) @printf(ptr @.str, i32 %9) br label %loop.body2 loop.body2: ; preds = %loop.body @@ -87,10 +83,10 @@ loop.exit: ; preds = %loop.body2, %loop.c ret void } - +; Function Attrs: declare i32 @printf(ptr, ...) #0 - +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 { entry: call void @foo.main() diff --git a/test/test_suite/statements/foreach_more_implementations.c3t b/test/test_suite/statements/foreach_more_implementations.c3t index 037dfc79d..848bf8f67 100644 --- a/test/test_suite/statements/foreach_more_implementations.c3t +++ b/test/test_suite/statements/foreach_more_implementations.c3t @@ -51,87 +51,82 @@ entry: %element = alloca i64, align 8 %varargslots = alloca [1 x %"any*"], align 16 %retparam = alloca i64, align 8 - %.anon3 = alloca i64, align 8 - %vector4 = alloca %Vector, align 8 - %.anon5 = alloca i64, align 8 + %.anon4 = alloca i64, align 8 + %vector5 = alloca %Vector, align 8 + %.anon6 = alloca i64, align 8 %i = alloca i32, align 4 - %element9 = alloca i64, align 8 - %varargslots11 = alloca [1 x %"any*"], align 16 - %retparam12 = alloca i64, align 8 + %element10 = alloca i64, align 8 + %varargslots13 = alloca [1 x %"any*"], align 16 + %retparam14 = alloca i64, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 8, i1 false) - %0 = getelementptr inbounds %Vector, ptr %v, i32 0, i32 0 - store i64 2, ptr %0, align 8 - %1 = getelementptr inbounds %Vector, ptr %v, i32 0, i32 1 - store ptr %x, ptr %1, align 8 + store i64 2, ptr %v, align 8 + %ptradd = getelementptr inbounds i8, ptr %v, i64 8 + store ptr %x, ptr %ptradd, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %vector, ptr align 8 %v, i32 16, i1 false) - %2 = getelementptr inbounds %Vector, ptr %vector, i32 0, i32 0 - %3 = load i64, ptr %2, align 8 - store i64 %3, ptr %.anon, align 8 + %0 = load i64, ptr %vector, align 8 + store i64 %0, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %4 = load i64, ptr %.anon1, align 8 - %5 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %4, %5 + %1 = load i64, ptr %.anon1, align 8 + %2 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %1, %2 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %6 = load i64, ptr %.anon1, align 8 - store i64 %6, ptr %element, align 8 - %7 = getelementptr inbounds %Vector, ptr %v, i32 0, i32 1 - %8 = load ptr, ptr %7, align 8 - %9 = load i64, ptr %element, align 8 - %ptroffset = getelementptr inbounds i32, ptr %8, i64 %9 + %3 = load i64, ptr %.anon1, align 8 + store i64 %3, ptr %element, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %v, i64 8 + %4 = load ptr, ptr %ptradd2, align 8 + %5 = load i64, ptr %element, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %4, i64 %5 store ptr %ptroffset, ptr %ref, align 8 + %6 = load ptr, ptr %ref, align 8 + %7 = insertvalue %"any*" undef, ptr %6, 0 + %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %8, ptr %varargslots, align 16 + %9 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 3, ptr %varargslots, i64 1) %10 = load ptr, ptr %ref, align 8 - %11 = insertvalue %"any*" undef, ptr %10, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %13 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %12, ptr %13, align 16 - %14 = call i64 @std.io.printf(ptr %retparam, ptr @.str, i64 3, ptr %varargslots, i64 1) - %15 = load ptr, ptr %ref, align 8 - %16 = load i32, ptr %15, align 4 - %add = add i32 %16, 2 - store i32 %add, ptr %15, align 4 - %17 = load i64, ptr %.anon1, align 8 - %add2 = add i64 %17, 1 - store i64 %add2, ptr %.anon1, align 8 + %11 = load i32, ptr %10, align 4 + %add = add i32 %11, 2 + store i32 %add, ptr %10, align 4 + %12 = load i64, ptr %.anon1, align 8 + %add3 = add i64 %12, 1 + store i64 %add3, ptr %.anon1, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %vector4, ptr align 8 %v, i32 16, i1 false) - %18 = getelementptr inbounds %Vector, ptr %vector4, i32 0, i32 0 - %19 = load i64, ptr %18, align 8 - store i64 %19, ptr %.anon3, align 8 - store i64 0, ptr %.anon5, align 8 - br label %loop.cond6 + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %vector5, ptr align 8 %v, i32 16, i1 false) + %13 = load i64, ptr %vector5, align 8 + store i64 %13, ptr %.anon4, align 8 + store i64 0, ptr %.anon6, align 8 + br label %loop.cond7 -loop.cond6: ; preds = %loop.body8, %loop.exit - %20 = load i64, ptr %.anon5, align 8 - %21 = load i64, ptr %.anon3, align 8 - %lt7 = icmp ult i64 %20, %21 - br i1 %lt7, label %loop.body8, label %loop.exit14 +loop.cond7: ; preds = %loop.body9, %loop.exit + %14 = load i64, ptr %.anon6, align 8 + %15 = load i64, ptr %.anon4, align 8 + %lt8 = icmp ult i64 %14, %15 + br i1 %lt8, label %loop.body9, label %loop.exit16 -loop.body8: ; preds = %loop.cond6 - %22 = load i64, ptr %.anon5, align 8 - store i64 %22, ptr %element9, align 8 - %23 = getelementptr inbounds %Vector, ptr %v, i32 0, i32 1 - %24 = load ptr, ptr %23, align 8 - %25 = load i64, ptr %element9, align 8 - %ptroffset10 = getelementptr inbounds i32, ptr %24, i64 %25 - %26 = load i32, ptr %ptroffset10, align 4 - store i32 %26, ptr %i, align 4 - %27 = insertvalue %"any*" undef, ptr %i, 0 - %28 = insertvalue %"any*" %27, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %29 = getelementptr inbounds [1 x %"any*"], ptr %varargslots11, i64 0, i64 0 - store %"any*" %28, ptr %29, align 16 - %30 = call i64 @std.io.printf(ptr %retparam12, ptr @.str.1, i64 3, ptr %varargslots11, i64 1) - %31 = load i64, ptr %.anon5, align 8 - %add13 = add i64 %31, 1 - store i64 %add13, ptr %.anon5, align 8 - br label %loop.cond6 +loop.body9: ; preds = %loop.cond7 + %16 = load i64, ptr %.anon6, align 8 + store i64 %16, ptr %element10, align 8 + %ptradd11 = getelementptr inbounds i8, ptr %v, i64 8 + %17 = load ptr, ptr %ptradd11, align 8 + %18 = load i64, ptr %element10, align 8 + %ptroffset12 = getelementptr inbounds [4 x i8], ptr %17, i64 %18 + %19 = load i32, ptr %ptroffset12, align 4 + store i32 %19, ptr %i, align 4 + %20 = insertvalue %"any*" undef, ptr %i, 0 + %21 = insertvalue %"any*" %20, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %21, ptr %varargslots13, align 16 + %22 = call i64 @std.io.printf(ptr %retparam14, ptr @.str.1, i64 3, ptr %varargslots13, i64 1) + %23 = load i64, ptr %.anon6, align 8 + %add15 = add i64 %23, 1 + store i64 %add15, ptr %.anon6, align 8 + br label %loop.cond7 -loop.exit14: ; preds = %loop.cond6 +loop.exit16: ; preds = %loop.cond7 ret void } \ No newline at end of file diff --git a/test/test_suite/statements/foreach_r_break.c3t b/test/test_suite/statements/foreach_r_break.c3t index 4dcff9524..fd3115148 100644 --- a/test/test_suite/statements/foreach_r_break.c3t +++ b/test/test_suite/statements/foreach_r_break.c3t @@ -16,54 +16,54 @@ fn void test() /* #expect: test.ll +; Function Attrs: define void @test.test() #0 { entry: %x = alloca [3 x i32], align 4 %g = alloca i32, align 4 %.anon = alloca i64, align 8 %z = alloca i32, align 4 - %0 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 0 - store i32 0, ptr %0, align 4 - %1 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - store i32 0, ptr %1, align 4 - %2 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 2 - store i32 0, ptr %2, align 4 + store i32 0, ptr %x, align 4 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + store i32 0, ptr %ptradd, align 4 + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + store i32 0, ptr %ptradd1, align 4 store i32 0, ptr %g, align 4 store i64 3, ptr %.anon, align 8 br label %loop.cond -loop.cond: ; preds = %if.exit3, %if.then2, %entry - %3 = load i64, ptr %.anon, align 8 - %gt = icmp ugt i64 %3, 0 +loop.cond: ; preds = %if.exit4, %if.then3, %entry + %0 = load i64, ptr %.anon, align 8 + %gt = icmp ugt i64 %0, 0 br i1 %gt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %4 = load i64, ptr %.anon, align 8 - %sub = sub i64 %4, 1 + %1 = load i64, ptr %.anon, align 8 + %sub = sub i64 %1, 1 store i64 %sub, ptr %.anon, align 8 - %5 = load i64, ptr %.anon, align 8 - %6 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 %5 - %7 = load i32, ptr %6, align 4 - store i32 %7, ptr %z, align 4 - %8 = load i32, ptr %z, align 4 - %gt1 = icmp sgt i32 %8, 0 - br i1 %gt1, label %if.then, label %if.exit + %2 = load i64, ptr %.anon, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %x, i64 %2 + %3 = load i32, ptr %ptroffset, align 4 + store i32 %3, ptr %z, align 4 + %4 = load i32, ptr %z, align 4 + %gt2 = icmp sgt i32 %4, 0 + br i1 %gt2, label %if.then, label %if.exit if.then: ; preds = %loop.body br label %loop.exit if.exit: ; preds = %loop.body - %9 = load i32, ptr %z, align 4 - %eq = icmp eq i32 %9, 1 - br i1 %eq, label %if.then2, label %if.exit3 + %5 = load i32, ptr %z, align 4 + %eq = icmp eq i32 %5, 1 + br i1 %eq, label %if.then3, label %if.exit4 -if.then2: ; preds = %if.exit +if.then3: ; preds = %if.exit br label %loop.cond -if.exit3: ; preds = %if.exit - %10 = load i32, ptr %g, align 4 - %11 = load i32, ptr %z, align 4 - %add = add i32 %10, %11 +if.exit4: ; preds = %if.exit + %6 = load i32, ptr %g, align 4 + %7 = load i32, ptr %z, align 4 + %add = add i32 %6, %7 store i32 %add, ptr %g, align 4 br label %loop.cond diff --git a/test/test_suite/statements/foreach_r_common.c3t b/test/test_suite/statements/foreach_r_common.c3t index ee955888b..345be41fa 100644 --- a/test/test_suite/statements/foreach_r_common.c3t +++ b/test/test_suite/statements/foreach_r_common.c3t @@ -65,28 +65,28 @@ entry: %a = alloca float, align 4 %.anon1 = alloca i64, align 8 %a6 = alloca ptr, align 8 - %.anon9 = alloca i64, align 8 - %a14 = alloca ptr, align 8 - %.anon17 = alloca i64, align 8 + %.anon10 = alloca i64, align 8 + %a15 = alloca ptr, align 8 + %.anon19 = alloca i64, align 8 %i = alloca i64, align 8 - %a22 = alloca float, align 4 - %.anon25 = alloca i64, align 8 - %i30 = alloca i8, align 1 - %a31 = alloca double, align 8 - %.anon34 = alloca i64, align 8 - %a39 = alloca double, align 8 - %.anon42 = alloca i64, align 8 - %a47 = alloca float, align 4 - %.anon50 = alloca i64, align 8 - %a55 = alloca ptr, align 8 - %.anon59 = alloca i64, align 8 - %i64 = alloca i64, align 8 - %a65 = alloca float, align 4 - %.anon68 = alloca i64, align 8 - %i73 = alloca i8, align 1 - %a75 = alloca double, align 8 - %.anon79 = alloca i64, align 8 - %a84 = alloca double, align 8 + %a24 = alloca float, align 4 + %.anon28 = alloca i64, align 8 + %i33 = alloca i8, align 1 + %a34 = alloca double, align 8 + %.anon38 = alloca i64, align 8 + %a43 = alloca double, align 8 + %.anon47 = alloca i64, align 8 + %a52 = alloca float, align 4 + %.anon55 = alloca i64, align 8 + %a60 = alloca ptr, align 8 + %.anon65 = alloca i64, align 8 + %i70 = alloca i64, align 8 + %a71 = alloca float, align 4 + %.anon74 = alloca i64, align 8 + %i79 = alloca i8, align 1 + %a81 = alloca double, align 8 + %.anon85 = alloca i64, align 8 + %a90 = alloca double, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %foo, ptr align 4 @.__const, i32 12, i1 false) store <3 x float> , ptr %foo2, align 16 store i64 3, ptr %.anon, align 8 @@ -102,11 +102,11 @@ loop.body: ; preds = %loop.cond %sub = sub i64 %1, 1 store i64 %sub, ptr %.anon, align 8 %2 = load i64, ptr %.anon, align 8 - %3 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %2 - %4 = load float, ptr %3, align 4 - store float %4, ptr %a, align 4 - %5 = load float, ptr %a, align 4 - %fpfpext = fpext float %5 to double + %ptroffset = getelementptr inbounds [4 x i8], ptr %foo, i64 %2 + %3 = load float, ptr %ptroffset, align 4 + store float %3, ptr %a, align 4 + %4 = load float, ptr %a, align 4 + %fpfpext = fpext float %4 to double call void (ptr, ...) @printf(ptr @.str, double %fpfpext) br label %loop.cond @@ -115,245 +115,245 @@ loop.exit: ; preds = %loop.cond br label %loop.cond2 loop.cond2: ; preds = %loop.body4, %loop.exit - %6 = load i64, ptr %.anon1, align 8 - %gt3 = icmp ugt i64 %6, 0 - br i1 %gt3, label %loop.body4, label %loop.exit8 + %5 = load i64, ptr %.anon1, align 8 + %gt3 = icmp ugt i64 %5, 0 + br i1 %gt3, label %loop.body4, label %loop.exit9 loop.body4: ; preds = %loop.cond2 - %7 = load i64, ptr %.anon1, align 8 - %sub5 = sub i64 %7, 1 + %6 = load i64, ptr %.anon1, align 8 + %sub5 = sub i64 %6, 1 store i64 %sub5, ptr %.anon1, align 8 - %8 = load i64, ptr %.anon1, align 8 - %9 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %8 - store ptr %9, ptr %a6, align 8 + %7 = load i64, ptr %.anon1, align 8 + %ptroffset7 = getelementptr inbounds [4 x i8], ptr %foo, i64 %7 + store ptr %ptroffset7, ptr %a6, align 8 + %8 = load ptr, ptr %a6, align 8 + %9 = load float, ptr %8, align 4 + %fmul = fmul float %9, 2.000000e+00 + store float %fmul, ptr %8, align 4 %10 = load ptr, ptr %a6, align 8 %11 = load float, ptr %10, align 4 - %fmul = fmul float %11, 2.000000e+00 - store float %fmul, ptr %10, align 4 - %12 = load ptr, ptr %a6, align 8 - %13 = load float, ptr %12, align 4 - %fpfpext7 = fpext float %13 to double - call void (ptr, ...) @printf(ptr @.str.1, double %fpfpext7) + %fpfpext8 = fpext float %11 to double + call void (ptr, ...) @printf(ptr @.str.1, double %fpfpext8) br label %loop.cond2 -loop.exit8: ; preds = %loop.cond2 - store i64 3, ptr %.anon9, align 8 - br label %loop.cond10 - -loop.cond10: ; preds = %loop.body12, %loop.exit8 - %14 = load i64, ptr %.anon9, align 8 - %gt11 = icmp ugt i64 %14, 0 - br i1 %gt11, label %loop.body12, label %loop.exit16 - -loop.body12: ; preds = %loop.cond10 - %15 = load i64, ptr %.anon9, align 8 - %sub13 = sub i64 %15, 1 - store i64 %sub13, ptr %.anon9, align 8 - %16 = load i64, ptr %.anon9, align 8 - %17 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %16 - store ptr %17, ptr %a14, align 8 - %18 = load ptr, ptr %a14, align 8 - %19 = load float, ptr %18, align 4 - %fpfpext15 = fpext float %19 to double - call void (ptr, ...) @printf(ptr @.str.2, double %fpfpext15) - br label %loop.cond10 - -loop.exit16: ; preds = %loop.cond10 - store i64 3, ptr %.anon17, align 8 - br label %loop.cond18 - -loop.cond18: ; preds = %loop.body20, %loop.exit16 - %20 = load i64, ptr %.anon17, align 8 - %gt19 = icmp ugt i64 %20, 0 - br i1 %gt19, label %loop.body20, label %loop.exit24 - -loop.body20: ; preds = %loop.cond18 - %21 = load i64, ptr %.anon17, align 8 - %sub21 = sub i64 %21, 1 - store i64 %sub21, ptr %.anon17, align 8 - %22 = load i64, ptr %.anon17, align 8 - store i64 %22, ptr %i, align 8 - %23 = load i64, ptr %.anon17, align 8 - %24 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %23 - %25 = load float, ptr %24, align 4 - store float %25, ptr %a22, align 4 - %26 = load float, ptr %a22, align 4 - %fpfpext23 = fpext float %26 to double - %27 = load i64, ptr %i, align 8 - call void (ptr, ...) @printf(ptr @.str.3, i64 %27, double %fpfpext23) - br label %loop.cond18 - -loop.exit24: ; preds = %loop.cond18 - store i64 3, ptr %.anon25, align 8 - br label %loop.cond26 - -loop.cond26: ; preds = %loop.body28, %loop.exit24 - %28 = load i64, ptr %.anon25, align 8 - %gt27 = icmp ugt i64 %28, 0 - br i1 %gt27, label %loop.body28, label %loop.exit33 - -loop.body28: ; preds = %loop.cond26 - %29 = load i64, ptr %.anon25, align 8 - %sub29 = sub i64 %29, 1 - store i64 %sub29, ptr %.anon25, align 8 - %30 = load i64, ptr %.anon25, align 8 - %trunc = trunc i64 %30 to i8 - store i8 %trunc, ptr %i30, align 1 - %31 = load i64, ptr %.anon25, align 8 - %32 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %31 - %33 = load float, ptr %32, align 4 - %fpfpext32 = fpext float %33 to double - store double %fpfpext32, ptr %a31, align 8 - %34 = load i8, ptr %i30, align 1 - %zext = zext i8 %34 to i32 - %35 = load double, ptr %a31, align 8 - call void (ptr, ...) @printf(ptr @.str.4, i32 %zext, double %35) - br label %loop.cond26 - -loop.exit33: ; preds = %loop.cond26 - store i64 3, ptr %.anon34, align 8 - br label %loop.cond35 - -loop.cond35: ; preds = %loop.body37, %loop.exit33 - %36 = load i64, ptr %.anon34, align 8 - %gt36 = icmp ugt i64 %36, 0 - br i1 %gt36, label %loop.body37, label %loop.exit41 - -loop.body37: ; preds = %loop.cond35 - %37 = load i64, ptr %.anon34, align 8 - %sub38 = sub i64 %37, 1 - store i64 %sub38, ptr %.anon34, align 8 - %38 = load i64, ptr %.anon34, align 8 - %39 = getelementptr inbounds [3 x float], ptr %foo, i64 0, i64 %38 - %40 = load float, ptr %39, align 4 - %fpfpext40 = fpext float %40 to double - store double %fpfpext40, ptr %a39, align 8 - %41 = load double, ptr %a39, align 8 - call void (ptr, ...) @printf(ptr @.str.5, double %41) - br label %loop.cond35 - -loop.exit41: ; preds = %loop.cond35 - store i64 3, ptr %.anon42, align 8 - br label %loop.cond43 - -loop.cond43: ; preds = %loop.body45, %loop.exit41 - %42 = load i64, ptr %.anon42, align 8 - %gt44 = icmp ugt i64 %42, 0 - br i1 %gt44, label %loop.body45, label %loop.exit49 - -loop.body45: ; preds = %loop.cond43 - %43 = load i64, ptr %.anon42, align 8 - %sub46 = sub i64 %43, 1 - store i64 %sub46, ptr %.anon42, align 8 - %44 = load <3 x float>, ptr %foo2, align 16 - %45 = load i64, ptr %.anon42, align 8 - %46 = extractelement <3 x float> %44, i64 %45 - store float %46, ptr %a47, align 4 - %47 = load float, ptr %a47, align 4 - %fpfpext48 = fpext float %47 to double - call void (ptr, ...) @printf(ptr @.str.6, double %fpfpext48) - br label %loop.cond43 - -loop.exit49: ; preds = %loop.cond43 - store i64 3, ptr %.anon50, align 8 - br label %loop.cond51 - -loop.cond51: ; preds = %loop.body53, %loop.exit49 - %48 = load i64, ptr %.anon50, align 8 - %gt52 = icmp ugt i64 %48, 0 - br i1 %gt52, label %loop.body53, label %loop.exit58 - -loop.body53: ; preds = %loop.cond51 - %49 = load i64, ptr %.anon50, align 8 - %sub54 = sub i64 %49, 1 - store i64 %sub54, ptr %.anon50, align 8 - %50 = load i64, ptr %.anon50, align 8 - %51 = getelementptr inbounds <3 x float>, ptr %foo2, i64 0, i64 %50 - store ptr %51, ptr %a55, align 8 - %52 = load ptr, ptr %a55, align 8 - %53 = load float, ptr %52, align 4 - %fmul56 = fmul float %53, 2.000000e+00 - store float %fmul56, ptr %52, align 4 - %54 = load ptr, ptr %a55, align 8 - %55 = load float, ptr %54, align 4 - %fpfpext57 = fpext float %55 to double - call void (ptr, ...) @printf(ptr @.str.7, double %fpfpext57) - br label %loop.cond51 - -loop.exit58: ; preds = %loop.cond51 - store i64 3, ptr %.anon59, align 8 - br label %loop.cond60 - -loop.cond60: ; preds = %loop.body62, %loop.exit58 - %56 = load i64, ptr %.anon59, align 8 - %gt61 = icmp ugt i64 %56, 0 - br i1 %gt61, label %loop.body62, label %loop.exit67 - -loop.body62: ; preds = %loop.cond60 - %57 = load i64, ptr %.anon59, align 8 - %sub63 = sub i64 %57, 1 - store i64 %sub63, ptr %.anon59, align 8 - %58 = load i64, ptr %.anon59, align 8 - store i64 %58, ptr %i64, align 8 - %59 = load <3 x float>, ptr %foo2, align 16 - %60 = load i64, ptr %.anon59, align 8 - %61 = extractelement <3 x float> %59, i64 %60 - store float %61, ptr %a65, align 4 - %62 = load float, ptr %a65, align 4 - %fpfpext66 = fpext float %62 to double - %63 = load i64, ptr %i64, align 8 - call void (ptr, ...) @printf(ptr @.str.8, i64 %63, double %fpfpext66) - br label %loop.cond60 - -loop.exit67: ; preds = %loop.cond60 - store i64 3, ptr %.anon68, align 8 - br label %loop.cond69 - -loop.cond69: ; preds = %loop.body71, %loop.exit67 - %64 = load i64, ptr %.anon68, align 8 - %gt70 = icmp ugt i64 %64, 0 - br i1 %gt70, label %loop.body71, label %loop.exit78 - -loop.body71: ; preds = %loop.cond69 - %65 = load i64, ptr %.anon68, align 8 - %sub72 = sub i64 %65, 1 - store i64 %sub72, ptr %.anon68, align 8 - %66 = load i64, ptr %.anon68, align 8 - %trunc74 = trunc i64 %66 to i8 - store i8 %trunc74, ptr %i73, align 1 +loop.exit9: ; preds = %loop.cond2 + store i64 3, ptr %.anon10, align 8 + br label %loop.cond11 + +loop.cond11: ; preds = %loop.body13, %loop.exit9 + %12 = load i64, ptr %.anon10, align 8 + %gt12 = icmp ugt i64 %12, 0 + br i1 %gt12, label %loop.body13, label %loop.exit18 + +loop.body13: ; preds = %loop.cond11 + %13 = load i64, ptr %.anon10, align 8 + %sub14 = sub i64 %13, 1 + store i64 %sub14, ptr %.anon10, align 8 + %14 = load i64, ptr %.anon10, align 8 + %ptroffset16 = getelementptr inbounds [4 x i8], ptr %foo, i64 %14 + store ptr %ptroffset16, ptr %a15, align 8 + %15 = load ptr, ptr %a15, align 8 + %16 = load float, ptr %15, align 4 + %fpfpext17 = fpext float %16 to double + call void (ptr, ...) @printf(ptr @.str.2, double %fpfpext17) + br label %loop.cond11 + +loop.exit18: ; preds = %loop.cond11 + store i64 3, ptr %.anon19, align 8 + br label %loop.cond20 + +loop.cond20: ; preds = %loop.body22, %loop.exit18 + %17 = load i64, ptr %.anon19, align 8 + %gt21 = icmp ugt i64 %17, 0 + br i1 %gt21, label %loop.body22, label %loop.exit27 + +loop.body22: ; preds = %loop.cond20 + %18 = load i64, ptr %.anon19, align 8 + %sub23 = sub i64 %18, 1 + store i64 %sub23, ptr %.anon19, align 8 + %19 = load i64, ptr %.anon19, align 8 + store i64 %19, ptr %i, align 8 + %20 = load i64, ptr %.anon19, align 8 + %ptroffset25 = getelementptr inbounds [4 x i8], ptr %foo, i64 %20 + %21 = load float, ptr %ptroffset25, align 4 + store float %21, ptr %a24, align 4 + %22 = load float, ptr %a24, align 4 + %fpfpext26 = fpext float %22 to double + %23 = load i64, ptr %i, align 8 + call void (ptr, ...) @printf(ptr @.str.3, i64 %23, double %fpfpext26) + br label %loop.cond20 + +loop.exit27: ; preds = %loop.cond20 + store i64 3, ptr %.anon28, align 8 + br label %loop.cond29 + +loop.cond29: ; preds = %loop.body31, %loop.exit27 + %24 = load i64, ptr %.anon28, align 8 + %gt30 = icmp ugt i64 %24, 0 + br i1 %gt30, label %loop.body31, label %loop.exit37 + +loop.body31: ; preds = %loop.cond29 + %25 = load i64, ptr %.anon28, align 8 + %sub32 = sub i64 %25, 1 + store i64 %sub32, ptr %.anon28, align 8 + %26 = load i64, ptr %.anon28, align 8 + %trunc = trunc i64 %26 to i8 + store i8 %trunc, ptr %i33, align 1 + %27 = load i64, ptr %.anon28, align 8 + %ptroffset35 = getelementptr inbounds [4 x i8], ptr %foo, i64 %27 + %28 = load float, ptr %ptroffset35, align 4 + %fpfpext36 = fpext float %28 to double + store double %fpfpext36, ptr %a34, align 8 + %29 = load i8, ptr %i33, align 1 + %zext = zext i8 %29 to i32 + %30 = load double, ptr %a34, align 8 + call void (ptr, ...) @printf(ptr @.str.4, i32 %zext, double %30) + br label %loop.cond29 + +loop.exit37: ; preds = %loop.cond29 + store i64 3, ptr %.anon38, align 8 + br label %loop.cond39 + +loop.cond39: ; preds = %loop.body41, %loop.exit37 + %31 = load i64, ptr %.anon38, align 8 + %gt40 = icmp ugt i64 %31, 0 + br i1 %gt40, label %loop.body41, label %loop.exit46 + +loop.body41: ; preds = %loop.cond39 + %32 = load i64, ptr %.anon38, align 8 + %sub42 = sub i64 %32, 1 + store i64 %sub42, ptr %.anon38, align 8 + %33 = load i64, ptr %.anon38, align 8 + %ptroffset44 = getelementptr inbounds [4 x i8], ptr %foo, i64 %33 + %34 = load float, ptr %ptroffset44, align 4 + %fpfpext45 = fpext float %34 to double + store double %fpfpext45, ptr %a43, align 8 + %35 = load double, ptr %a43, align 8 + call void (ptr, ...) @printf(ptr @.str.5, double %35) + br label %loop.cond39 + +loop.exit46: ; preds = %loop.cond39 + store i64 3, ptr %.anon47, align 8 + br label %loop.cond48 + +loop.cond48: ; preds = %loop.body50, %loop.exit46 + %36 = load i64, ptr %.anon47, align 8 + %gt49 = icmp ugt i64 %36, 0 + br i1 %gt49, label %loop.body50, label %loop.exit54 + +loop.body50: ; preds = %loop.cond48 + %37 = load i64, ptr %.anon47, align 8 + %sub51 = sub i64 %37, 1 + store i64 %sub51, ptr %.anon47, align 8 + %38 = load <3 x float>, ptr %foo2, align 16 + %39 = load i64, ptr %.anon47, align 8 + %40 = extractelement <3 x float> %38, i64 %39 + store float %40, ptr %a52, align 4 + %41 = load float, ptr %a52, align 4 + %fpfpext53 = fpext float %41 to double + call void (ptr, ...) @printf(ptr @.str.6, double %fpfpext53) + br label %loop.cond48 + +loop.exit54: ; preds = %loop.cond48 + store i64 3, ptr %.anon55, align 8 + br label %loop.cond56 + +loop.cond56: ; preds = %loop.body58, %loop.exit54 + %42 = load i64, ptr %.anon55, align 8 + %gt57 = icmp ugt i64 %42, 0 + br i1 %gt57, label %loop.body58, label %loop.exit64 + +loop.body58: ; preds = %loop.cond56 + %43 = load i64, ptr %.anon55, align 8 + %sub59 = sub i64 %43, 1 + store i64 %sub59, ptr %.anon55, align 8 + %44 = load i64, ptr %.anon55, align 8 + %ptroffset61 = getelementptr inbounds [4 x i8], ptr %foo2, i64 %44 + store ptr %ptroffset61, ptr %a60, align 8 + %45 = load ptr, ptr %a60, align 8 + %46 = load float, ptr %45, align 4 + %fmul62 = fmul float %46, 2.000000e+00 + store float %fmul62, ptr %45, align 4 + %47 = load ptr, ptr %a60, align 8 + %48 = load float, ptr %47, align 4 + %fpfpext63 = fpext float %48 to double + call void (ptr, ...) @printf(ptr @.str.7, double %fpfpext63) + br label %loop.cond56 + +loop.exit64: ; preds = %loop.cond56 + store i64 3, ptr %.anon65, align 8 + br label %loop.cond66 + +loop.cond66: ; preds = %loop.body68, %loop.exit64 + %49 = load i64, ptr %.anon65, align 8 + %gt67 = icmp ugt i64 %49, 0 + br i1 %gt67, label %loop.body68, label %loop.exit73 + +loop.body68: ; preds = %loop.cond66 + %50 = load i64, ptr %.anon65, align 8 + %sub69 = sub i64 %50, 1 + store i64 %sub69, ptr %.anon65, align 8 + %51 = load i64, ptr %.anon65, align 8 + store i64 %51, ptr %i70, align 8 + %52 = load <3 x float>, ptr %foo2, align 16 + %53 = load i64, ptr %.anon65, align 8 + %54 = extractelement <3 x float> %52, i64 %53 + store float %54, ptr %a71, align 4 + %55 = load float, ptr %a71, align 4 + %fpfpext72 = fpext float %55 to double + %56 = load i64, ptr %i70, align 8 + call void (ptr, ...) @printf(ptr @.str.8, i64 %56, double %fpfpext72) + br label %loop.cond66 + +loop.exit73: ; preds = %loop.cond66 + store i64 3, ptr %.anon74, align 8 + br label %loop.cond75 + +loop.cond75: ; preds = %loop.body77, %loop.exit73 + %57 = load i64, ptr %.anon74, align 8 + %gt76 = icmp ugt i64 %57, 0 + br i1 %gt76, label %loop.body77, label %loop.exit84 + +loop.body77: ; preds = %loop.cond75 + %58 = load i64, ptr %.anon74, align 8 + %sub78 = sub i64 %58, 1 + store i64 %sub78, ptr %.anon74, align 8 + %59 = load i64, ptr %.anon74, align 8 + %trunc80 = trunc i64 %59 to i8 + store i8 %trunc80, ptr %i79, align 1 + %60 = load <3 x float>, ptr %foo2, align 16 + %61 = load i64, ptr %.anon74, align 8 + %62 = extractelement <3 x float> %60, i64 %61 + %fpfpext82 = fpext float %62 to double + store double %fpfpext82, ptr %a81, align 8 + %63 = load i8, ptr %i79, align 1 + %zext83 = zext i8 %63 to i32 + %64 = load double, ptr %a81, align 8 + call void (ptr, ...) @printf(ptr @.str.9, i32 %zext83, double %64) + br label %loop.cond75 + +loop.exit84: ; preds = %loop.cond75 + store i64 3, ptr %.anon85, align 8 + br label %loop.cond86 + +loop.cond86: ; preds = %loop.body88, %loop.exit84 + %65 = load i64, ptr %.anon85, align 8 + %gt87 = icmp ugt i64 %65, 0 + br i1 %gt87, label %loop.body88, label %loop.exit92 + +loop.body88: ; preds = %loop.cond86 + %66 = load i64, ptr %.anon85, align 8 + %sub89 = sub i64 %66, 1 + store i64 %sub89, ptr %.anon85, align 8 %67 = load <3 x float>, ptr %foo2, align 16 - %68 = load i64, ptr %.anon68, align 8 + %68 = load i64, ptr %.anon85, align 8 %69 = extractelement <3 x float> %67, i64 %68 - %fpfpext76 = fpext float %69 to double - store double %fpfpext76, ptr %a75, align 8 - %70 = load i8, ptr %i73, align 1 - %zext77 = zext i8 %70 to i32 - %71 = load double, ptr %a75, align 8 - call void (ptr, ...) @printf(ptr @.str.9, i32 %zext77, double %71) - br label %loop.cond69 - -loop.exit78: ; preds = %loop.cond69 - store i64 3, ptr %.anon79, align 8 - br label %loop.cond80 - -loop.cond80: ; preds = %loop.body82, %loop.exit78 - %72 = load i64, ptr %.anon79, align 8 - %gt81 = icmp ugt i64 %72, 0 - br i1 %gt81, label %loop.body82, label %loop.exit86 - -loop.body82: ; preds = %loop.cond80 - %73 = load i64, ptr %.anon79, align 8 - %sub83 = sub i64 %73, 1 - store i64 %sub83, ptr %.anon79, align 8 - %74 = load <3 x float>, ptr %foo2, align 16 - %75 = load i64, ptr %.anon79, align 8 - %76 = extractelement <3 x float> %74, i64 %75 - %fpfpext85 = fpext float %76 to double - store double %fpfpext85, ptr %a84, align 8 - %77 = load double, ptr %a84, align 8 - call void (ptr, ...) @printf(ptr @.str.10, double %77) - br label %loop.cond80 - -loop.exit86: ; preds = %loop.cond80 + %fpfpext91 = fpext float %69 to double + store double %fpfpext91, ptr %a90, align 8 + %70 = load double, ptr %a90, align 8 + call void (ptr, ...) @printf(ptr @.str.10, double %70) + br label %loop.cond86 + +loop.exit92: ; preds = %loop.cond86 ret void } diff --git a/test/test_suite/statements/foreach_r_custom.c3t b/test/test_suite/statements/foreach_r_custom.c3t index 711679c92..c55f39bad 100644 --- a/test/test_suite/statements/foreach_r_custom.c3t +++ b/test/test_suite/statements/foreach_r_custom.c3t @@ -42,36 +42,32 @@ entry: %f = alloca i32, align 4 %index = alloca i64, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %i, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %1 = insertvalue %"int[]" undef, ptr %i, 0 - %2 = insertvalue %"int[]" %1, i64 3, 1 - store %"int[]" %2, ptr %0, align 8 - %3 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %4 = getelementptr inbounds %"int[]", ptr %3, i32 0, i32 1 - %5 = load i64, ptr %4, align 8 - store i64 %5, ptr %.anon, align 8 + %0 = insertvalue %"int[]" undef, ptr %i, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + store %"int[]" %1, ptr %x, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + %2 = load i64, ptr %ptradd, align 8 + store i64 %2, ptr %.anon, align 8 br label %loop.cond loop.cond: ; preds = %entry - %6 = load i64, ptr %.anon, align 8 - %gt = icmp ugt i64 %6, 0 + %3 = load i64, ptr %.anon, align 8 + %gt = icmp ugt i64 %3, 0 br i1 %gt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %7 = load i64, ptr %.anon, align 8 - %sub = sub i64 %7, 1 + %4 = load i64, ptr %.anon, align 8 + %sub = sub i64 %4, 1 store i64 %sub, ptr %.anon, align 8 - %8 = load i64, ptr %.anon, align 8 - store i64 %8, ptr %index, align 8 - %9 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %10 = getelementptr inbounds %"int[]", ptr %9, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - %12 = load i64, ptr %index, align 8 - %ptroffset = getelementptr inbounds i32, ptr %11, i64 %12 - %13 = load i32, ptr %ptroffset, align 4 - store i32 %13, ptr %f, align 4 - %14 = load i32, ptr %f, align 4 - %15 = call i32 (ptr, ...) @printf(ptr @.str, i32 %14) + %5 = load i64, ptr %.anon, align 8 + store i64 %5, ptr %index, align 8 + %6 = load ptr, ptr %x, align 8 + %7 = load i64, ptr %index, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %6, i64 %7 + %8 = load i32, ptr %ptroffset, align 4 + store i32 %8, ptr %f, align 4 + %9 = load i32, ptr %f, align 4 + %10 = call i32 (ptr, ...) @printf(ptr @.str, i32 %9) br label %loop.body1 loop.body1: ; preds = %loop.body @@ -81,10 +77,10 @@ loop.exit: ; preds = %loop.body1, %loop.c ret void } - +; Function Attrs: declare i32 @printf(ptr, ...) #0 - +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 { entry: call void @test.main() diff --git a/test/test_suite/statements/foreach_r_custom_macro.c3t b/test/test_suite/statements/foreach_r_custom_macro.c3t index 52d6933ad..466359243 100644 --- a/test/test_suite/statements/foreach_r_custom_macro.c3t +++ b/test/test_suite/statements/foreach_r_custom_macro.c3t @@ -41,36 +41,32 @@ entry: %f = alloca i32, align 4 %index = alloca i64, align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %i, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %1 = insertvalue %"int[]" undef, ptr %i, 0 - %2 = insertvalue %"int[]" %1, i64 3, 1 - store %"int[]" %2, ptr %0, align 8 - %3 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %4 = getelementptr inbounds %"int[]", ptr %3, i32 0, i32 1 - %5 = load i64, ptr %4, align 8 - store i64 %5, ptr %.anon, align 8 + %0 = insertvalue %"int[]" undef, ptr %i, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + store %"int[]" %1, ptr %x, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 8 + %2 = load i64, ptr %ptradd, align 8 + store i64 %2, ptr %.anon, align 8 br label %loop.cond loop.cond: ; preds = %entry - %6 = load i64, ptr %.anon, align 8 - %gt = icmp ugt i64 %6, 0 + %3 = load i64, ptr %.anon, align 8 + %gt = icmp ugt i64 %3, 0 br i1 %gt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %7 = load i64, ptr %.anon, align 8 - %sub = sub i64 %7, 1 + %4 = load i64, ptr %.anon, align 8 + %sub = sub i64 %4, 1 store i64 %sub, ptr %.anon, align 8 - %8 = load i64, ptr %.anon, align 8 - store i64 %8, ptr %index, align 8 - %9 = getelementptr inbounds %Foo, ptr %x, i32 0, i32 0 - %10 = getelementptr inbounds %"int[]", ptr %9, i32 0, i32 0 - %11 = load ptr, ptr %10, align 8 - %12 = load i64, ptr %index, align 8 - %ptroffset = getelementptr inbounds i32, ptr %11, i64 %12 - %13 = load i32, ptr %ptroffset, align 4 - store i32 %13, ptr %f, align 4 - %14 = load i32, ptr %f, align 4 - %15 = call i32 (ptr, ...) @printf(ptr @.str, i32 %14) + %5 = load i64, ptr %.anon, align 8 + store i64 %5, ptr %index, align 8 + %6 = load ptr, ptr %x, align 8 + %7 = load i64, ptr %index, align 8 + %ptroffset = getelementptr inbounds [4 x i8], ptr %6, i64 %7 + %8 = load i32, ptr %ptroffset, align 4 + store i32 %8, ptr %f, align 4 + %9 = load i32, ptr %f, align 4 + %10 = call i32 (ptr, ...) @printf(ptr @.str, i32 %9) br label %loop.body1 loop.body1: ; preds = %loop.body @@ -80,10 +76,10 @@ loop.exit: ; preds = %loop.body1, %loop.c ret void } - +; Function Attrs: declare i32 @printf(ptr, ...) #0 - +; Function Attrs: define i32 @main(i32 %0, ptr %1) #0 { entry: call void @test.main() diff --git a/test/test_suite/statements/various_switching.c3t b/test/test_suite/statements/various_switching.c3t index 975a43cf1..489991d3d 100644 --- a/test/test_suite/statements/various_switching.c3t +++ b/test/test_suite/statements/various_switching.c3t @@ -79,8 +79,8 @@ entry: %a = alloca i32, align 4 %b = alloca i32, align 4 %zy = alloca i32, align 4 - %switch25 = alloca i32, align 4 - %switch35 = alloca i8, align 1 + %switch27 = alloca i32, align 4 + %switch37 = alloca i8, align 1 store i64 ptrtoint (ptr @"mymodule.ByeErr$BAR" to i64), ptr %x.f, align 8 store i64 ptrtoint (ptr @"$ct.int" to i64), ptr %z, align 8 br label %testblock @@ -151,145 +151,145 @@ check_subtype: ; preds = %parent_type_block, parent_type_block: ; preds = %check_subtype %6 = inttoptr i64 %5 to ptr - %7 = getelementptr inbounds %.introspect, ptr %6, i32 0, i32 1 - %typeid.parent = load i64, ptr %7, align 8 - %8 = icmp eq i64 %typeid.parent, 0 - br i1 %8, label %result_block, label %check_subtype + %ptradd = getelementptr inbounds i8, ptr %6, i64 8 + %typeid.parent = load i64, ptr %ptradd, align 8 + %7 = icmp eq i64 %typeid.parent, 0 + br i1 %7, label %result_block, label %check_subtype result_block: ; preds = %parent_type_block, %check_subtype - %9 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] - br i1 %9, label %switch.case7, label %next_if8 + %8 = phi i1 [ false, %parent_type_block ], [ true, %check_subtype ] + br i1 %8, label %switch.case7, label %next_if8 switch.case7: ; preds = %result_block call void (ptr, ...) @printf(ptr @.str.5) - br label %switch.exit24 + br label %switch.exit26 next_if8: ; preds = %result_block br label %check_subtype9 check_subtype9: ; preds = %parent_type_block11, %next_if8 - %10 = phi i64 [ %4, %next_if8 ], [ %typeid.parent12, %parent_type_block11 ] - %eq10 = icmp eq i64 ptrtoint (ptr @"$ct.bool" to i64), %10 - br i1 %eq10, label %result_block13, label %parent_type_block11 + %9 = phi i64 [ %4, %next_if8 ], [ %typeid.parent13, %parent_type_block11 ] + %eq10 = icmp eq i64 ptrtoint (ptr @"$ct.bool" to i64), %9 + br i1 %eq10, label %result_block14, label %parent_type_block11 parent_type_block11: ; preds = %check_subtype9 - %11 = inttoptr i64 %10 to ptr - %12 = getelementptr inbounds %.introspect, ptr %11, i32 0, i32 1 - %typeid.parent12 = load i64, ptr %12, align 8 - %13 = icmp eq i64 %typeid.parent12, 0 - br i1 %13, label %result_block13, label %check_subtype9 + %10 = inttoptr i64 %9 to ptr + %ptradd12 = getelementptr inbounds i8, ptr %10, i64 8 + %typeid.parent13 = load i64, ptr %ptradd12, align 8 + %11 = icmp eq i64 %typeid.parent13, 0 + br i1 %11, label %result_block14, label %check_subtype9 -result_block13: ; preds = %parent_type_block11, %check_subtype9 - %14 = phi i1 [ false, %parent_type_block11 ], [ true, %check_subtype9 ] - br i1 %14, label %switch.case14, label %next_if15 +result_block14: ; preds = %parent_type_block11, %check_subtype9 + %12 = phi i1 [ false, %parent_type_block11 ], [ true, %check_subtype9 ] + br i1 %12, label %switch.case15, label %next_if16 -switch.case14: ; preds = %result_block13 - br label %switch.case21 +switch.case15: ; preds = %result_block14 + br label %switch.case23 -next_if15: ; preds = %result_block13 - br label %check_subtype16 +next_if16: ; preds = %result_block14 + br label %check_subtype17 -check_subtype16: ; preds = %parent_type_block18, %next_if15 - %15 = phi i64 [ %4, %next_if15 ], [ %typeid.parent19, %parent_type_block18 ] - %eq17 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %15 - br i1 %eq17, label %result_block20, label %parent_type_block18 +check_subtype17: ; preds = %parent_type_block19, %next_if16 + %13 = phi i64 [ %4, %next_if16 ], [ %typeid.parent21, %parent_type_block19 ] + %eq18 = icmp eq i64 ptrtoint (ptr @"$ct.double" to i64), %13 + br i1 %eq18, label %result_block22, label %parent_type_block19 -parent_type_block18: ; preds = %check_subtype16 - %16 = inttoptr i64 %15 to ptr - %17 = getelementptr inbounds %.introspect, ptr %16, i32 0, i32 1 - %typeid.parent19 = load i64, ptr %17, align 8 - %18 = icmp eq i64 %typeid.parent19, 0 - br i1 %18, label %result_block20, label %check_subtype16 +parent_type_block19: ; preds = %check_subtype17 + %14 = inttoptr i64 %13 to ptr + %ptradd20 = getelementptr inbounds i8, ptr %14, i64 8 + %typeid.parent21 = load i64, ptr %ptradd20, align 8 + %15 = icmp eq i64 %typeid.parent21, 0 + br i1 %15, label %result_block22, label %check_subtype17 -result_block20: ; preds = %parent_type_block18, %check_subtype16 - %19 = phi i1 [ false, %parent_type_block18 ], [ true, %check_subtype16 ] - br i1 %19, label %switch.case21, label %next_if22 +result_block22: ; preds = %parent_type_block19, %check_subtype17 + %16 = phi i1 [ false, %parent_type_block19 ], [ true, %check_subtype17 ] + br i1 %16, label %switch.case23, label %next_if24 -switch.case21: ; preds = %result_block20, %switch.case14 - br label %switch.default23 +switch.case23: ; preds = %result_block22, %switch.case15 + br label %switch.default25 -next_if22: ; preds = %result_block20 - br label %switch.default23 +next_if24: ; preds = %result_block22 + br label %switch.default25 -switch.default23: ; preds = %next_if22, %switch.case21 +switch.default25: ; preds = %next_if24, %switch.case23 call void (ptr, ...) @printf(ptr @.str.6) - br label %switch.exit24 + br label %switch.exit26 -switch.exit24: ; preds = %switch.default23, %switch.case7 +switch.exit26: ; preds = %switch.default25, %switch.case7 store i32 1, ptr %a, align 4 store i32 2, ptr %b, align 4 - %20 = load i32, ptr %b, align 4 - %21 = load i32, ptr %a, align 4 - %add = add i32 %20, %21 + %17 = load i32, ptr %b, align 4 + %18 = load i32, ptr %a, align 4 + %add = add i32 %17, %18 store i32 %add, ptr %zy, align 4 - %22 = load i32, ptr %zy, align 4 - store i32 %22, ptr %switch25, align 4 - br label %switch.entry26 + %19 = load i32, ptr %zy, align 4 + store i32 %19, ptr %switch27, align 4 + br label %switch.entry28 -switch.entry26: ; preds = %switch.exit24 - %23 = load i32, ptr %switch25, align 4 - %24 = load i32, ptr %a, align 4 - %eq27 = icmp eq i32 %24, %23 - br i1 %eq27, label %switch.case28, label %next_if29 +switch.entry28: ; preds = %switch.exit26 + %20 = load i32, ptr %switch27, align 4 + %21 = load i32, ptr %a, align 4 + %eq29 = icmp eq i32 %21, %20 + br i1 %eq29, label %switch.case30, label %next_if31 -switch.case28: ; preds = %switch.entry26 +switch.case30: ; preds = %switch.entry28 call void (ptr, ...) @printf(ptr @.str.7) - br label %switch.exit34 + br label %switch.exit36 -next_if29: ; preds = %switch.entry26 - %25 = load i32, ptr %b, align 4 - %eq30 = icmp eq i32 %25, %23 - br i1 %eq30, label %switch.case31, label %next_if32 +next_if31: ; preds = %switch.entry28 + %22 = load i32, ptr %b, align 4 + %eq32 = icmp eq i32 %22, %20 + br i1 %eq32, label %switch.case33, label %next_if34 -switch.case31: ; preds = %next_if29 +switch.case33: ; preds = %next_if31 call void (ptr, ...) @printf(ptr @.str.8) - br label %switch.exit34 + br label %switch.exit36 -next_if32: ; preds = %next_if29 - br label %switch.default33 +next_if34: ; preds = %next_if31 + br label %switch.default35 -switch.default33: ; preds = %next_if32 +switch.default35: ; preds = %next_if34 call void (ptr, ...) @printf(ptr @.str.9) - br label %switch.exit34 + br label %switch.exit36 -switch.exit34: ; preds = %switch.default33, %switch.case31, %switch.case28 - store i8 1, ptr %switch35, align 1 - br label %switch.entry36 +switch.exit36: ; preds = %switch.default35, %switch.case33, %switch.case30 + store i8 1, ptr %switch37, align 1 + br label %switch.entry38 -switch.entry36: ; preds = %switch.exit34 - %26 = load i8, ptr %switch35, align 1 - %27 = trunc i8 %26 to i1 - %28 = load i32, ptr %a, align 4 - %lt = icmp slt i32 %28, 0 - %eq37 = icmp eq i1 %lt, %27 - br i1 %eq37, label %switch.case38, label %next_if39 +switch.entry38: ; preds = %switch.exit36 + %23 = load i8, ptr %switch37, align 1 + %24 = trunc i8 %23 to i1 + %25 = load i32, ptr %a, align 4 + %lt = icmp slt i32 %25, 0 + %eq39 = icmp eq i1 %lt, %24 + br i1 %eq39, label %switch.case40, label %next_if41 -switch.case38: ; preds = %switch.entry36 +switch.case40: ; preds = %switch.entry38 call void (ptr, ...) @printf(ptr @.str.10) - br label %switch.exit45 + br label %switch.exit47 -next_if39: ; preds = %switch.entry36 - %29 = load i32, ptr %a, align 4 - %eq40 = icmp eq i32 %29, 1 - %eq41 = icmp eq i1 %eq40, %27 - br i1 %eq41, label %switch.case42, label %next_if43 +next_if41: ; preds = %switch.entry38 + %26 = load i32, ptr %a, align 4 + %eq42 = icmp eq i32 %26, 1 + %eq43 = icmp eq i1 %eq42, %24 + br i1 %eq43, label %switch.case44, label %next_if45 -switch.case42: ; preds = %next_if39 +switch.case44: ; preds = %next_if41 call void (ptr, ...) @printf(ptr @.str.11) - br label %switch.exit45 + br label %switch.exit47 -next_if43: ; preds = %next_if39 - br label %switch.default44 +next_if45: ; preds = %next_if41 + br label %switch.default46 -switch.default44: ; preds = %next_if43 +switch.default46: ; preds = %next_if45 call void (ptr, ...) @printf(ptr @.str.12) - br label %switch.exit45 + br label %switch.exit47 -switch.exit45: ; preds = %switch.default44, %switch.case42, %switch.case38 +switch.exit47: ; preds = %switch.default46, %switch.case44, %switch.case40 ret void } - +; Function Attrs: define void @mymodule.main() #0 { entry: call void @mymodule.test() diff --git a/test/test_suite/stdlib/map.c3t b/test/test_suite/stdlib/map.c3t index bafafc3f8..3dd5ad8d5 100644 --- a/test/test_suite/stdlib/map.c3t +++ b/test/test_suite/stdlib/map.c3t @@ -21,7 +21,7 @@ fn String Foo.to_new_string(Foo* foo, Allocator* allocator = mem::heap()) @dynam fn void main() { IntFooMap map; - map.init_new(); + map.new_init(); io::printfn("Map size: %d", map.count); map.set(1, Foo { 1, null }); io::printfn("Map size: %d", map.count); @@ -33,7 +33,7 @@ fn void main() map.set(7, Foo { 4, null }); io::printfn("Values: %s", map.value_new_list()); IntDoubleMap map2; - map2.init_new(); + map2.new_init(); map2.set(4, 1.3); io::printfn("Map find: %s", map2.has_value(1.3)); io::printfn("Map find: %s", map2.has_value(1.2)); @@ -43,7 +43,7 @@ fn void main() @pool() { IntDoubleMap map3; - map3.init_new(); + map3.new_init(); map3.set(5, 3.2); map3.set(7, 5.2); io::printfn("%s", map3.key_new_list()); @@ -60,227 +60,208 @@ entry: %retparam = alloca i64, align 8 %result = alloca %"char[]", align 8 store i64 %1, ptr %allocator, align 8 - %ptroffset = getelementptr inbounds ptr, ptr %allocator, i64 1 - store ptr %2, ptr %ptroffset, align 8 - %3 = getelementptr inbounds { i64, ptr }, ptr %allocator, i32 0, i32 0 - %lo = load i64, ptr %3, align 8 - %4 = getelementptr inbounds { i64, ptr }, ptr %allocator, i32 0, i32 1 - %hi = load ptr, ptr %4, align 8 - %5 = call ptr @std.core.dstring.new_with_capacity(i64 128, i64 %lo, ptr %hi) - store ptr %5, ptr %s, align 8 - %6 = getelementptr inbounds %Foo, ptr %0, i32 0, i32 0 - %7 = insertvalue %"any*" undef, ptr %6, 0 - %8 = insertvalue %"any*" %7, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %9 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %8, ptr %9, align 16 - %10 = getelementptr inbounds %Foo, ptr %0, i32 0, i32 1 - %11 = insertvalue %"any*" undef, ptr %10, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.p$void" to i64), 1 - %13 = getelementptr inbounds [2 x %"any*"], ptr %varargslots, i64 0, i64 1 - store %"any*" %12, ptr %13, align 16 - %14 = call i64 @std.core.dstring.DString.appendf(ptr %retparam, ptr %s, ptr @.str.14, i64 8, ptr %varargslots, i64 2) - %15 = load ptr, ptr %s, align 8 - %16 = call { ptr, i64 } @std.core.dstring.DString.str_view(ptr %15) - store { ptr, i64 } %16, ptr %result, align 8 - %17 = load { ptr, i64 }, ptr %result, align 8 - ret { ptr, i64 } %17 + %ptradd = getelementptr inbounds i8, ptr %allocator, i64 8 + store ptr %2, ptr %ptradd, align 8 + %lo = load i64, ptr %allocator, align 8 + %ptradd1 = getelementptr inbounds i8, ptr %allocator, i64 8 + %hi = load ptr, ptr %ptradd1, align 8 + %3 = call ptr @std.core.dstring.new_with_capacity(i64 128, i64 %lo, ptr %hi) + store ptr %3, ptr %s, align 8 + %4 = insertvalue %"any*" undef, ptr %0, 0 + %5 = insertvalue %"any*" %4, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %5, ptr %varargslots, align 16 + %ptradd2 = getelementptr inbounds i8, ptr %0, i64 8 + %6 = insertvalue %"any*" undef, ptr %ptradd2, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.p$void" to i64), 1 + %ptradd3 = getelementptr inbounds i8, ptr %varargslots, i64 16 + store %"any*" %7, ptr %ptradd3, align 16 + %8 = call i64 @std.core.dstring.DString.appendf(ptr %retparam, ptr %s, ptr @.str.14, i64 8, ptr %varargslots, i64 2) + %9 = load ptr, ptr %s, align 8 + %10 = call { ptr, i64 } @std.core.dstring.DString.str_view(ptr %9) + store { ptr, i64 } %10, ptr %result, align 8 + %11 = load { ptr, i64 }, ptr %result, align 8 + ret { ptr, i64 } %11 } - +; Function Attrs: define void @test.main() #0 { entry: %map = alloca %HashMap, align 8 %varargslots = alloca [1 x %"any*"], align 16 %retparam = alloca i64, align 8 %literal = alloca %Foo, align 8 - %varargslots3 = alloca [1 x %"any*"], align 16 - %retparam4 = alloca i64, align 8 - %literal5 = alloca %Foo, align 8 - %varargslots8 = alloca [1 x %"any*"], align 16 - %retparam9 = alloca i64, align 8 - %varargslots10 = alloca [1 x %"any*"], align 16 - %retparam11 = alloca %Foo, align 8 - %retparam12 = alloca i64, align 8 - %varargslots15 = alloca [1 x %"any*"], align 16 - %taddr = alloca i8, align 1 + %varargslots4 = alloca [1 x %"any*"], align 16 + %retparam6 = alloca i64, align 8 + %literal7 = alloca %Foo, align 8 + %varargslots11 = alloca [1 x %"any*"], align 16 + %retparam13 = alloca i64, align 8 + %varargslots14 = alloca [1 x %"any*"], align 16 + %retparam15 = alloca %Foo, align 8 %retparam16 = alloca i64, align 8 %varargslots19 = alloca [1 x %"any*"], align 16 - %taddr20 = alloca i8, align 1 - %retparam21 = alloca i64, align 8 - %literal24 = alloca %Foo, align 8 - %varargslots27 = alloca [1 x %"any*"], align 16 + %taddr = alloca i8, align 1 + %retparam20 = alloca i64, align 8 + %varargslots23 = alloca [1 x %"any*"], align 16 + %taddr24 = alloca i8, align 1 + %retparam25 = alloca i64, align 8 + %literal28 = alloca %Foo, align 8 + %varargslots32 = alloca [1 x %"any*"], align 16 %result = alloca %"Foo[]", align 8 - %retparam30 = alloca i64, align 8 + %retparam35 = alloca i64, align 8 %map2 = alloca %HashMap.0, align 8 - %varargslots35 = alloca [1 x %"any*"], align 16 - %taddr36 = alloca i8, align 1 - %retparam37 = alloca i64, align 8 %varargslots40 = alloca [1 x %"any*"], align 16 %taddr41 = alloca i8, align 1 %retparam42 = alloca i64, align 8 %varargslots45 = alloca [1 x %"any*"], align 16 - %result48 = alloca %"int[]", align 8 - %retparam49 = alloca i64, align 8 - %varargslots52 = alloca [1 x %"any*"], align 16 - %result55 = alloca %"double[]", align 8 - %retparam56 = alloca i64, align 8 + %taddr46 = alloca i8, align 1 + %retparam47 = alloca i64, align 8 + %varargslots50 = alloca [1 x %"any*"], align 16 + %result53 = alloca %"int[]", align 8 + %retparam54 = alloca i64, align 8 + %varargslots57 = alloca [1 x %"any*"], align 16 + %result60 = alloca %"double[]", align 8 + %retparam61 = alloca i64, align 8 %current = alloca ptr, align 8 %mark = alloca i64, align 8 %map3 = alloca %HashMap.0, align 8 - %varargslots61 = alloca [1 x %"any*"], align 16 - %result64 = alloca %"int[]", align 8 - %retparam65 = alloca i64, align 8 + %varargslots67 = alloca [1 x %"any*"], align 16 + %result70 = alloca %"int[]", align 8 + %retparam71 = alloca i64, align 8 call void @llvm.memset.p0.i64(ptr align 8 %map, i8 0, i64 48, i1 false) %lo = load i64, ptr @std.core.mem.thread_allocator, align 8 - %hi = load ptr, ptr getelementptr inbounds ({ i64, ptr }, ptr @std.core.mem.thread_allocator, i32 0, i32 1), align 8 - %0 = call ptr @"std.collections.map$int$test.Foo$.HashMap.init_new"(ptr %map, i32 16, float 7.500000e-01, i64 %lo, ptr %hi) - %1 = getelementptr inbounds %HashMap, ptr %map, i32 0, i32 2 - %2 = insertvalue %"any*" undef, ptr %1, 0 - %3 = insertvalue %"any*" %2, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %4 = getelementptr inbounds [1 x %"any*"], ptr %varargslots, i64 0, i64 0 - store %"any*" %3, ptr %4, align 16 - %5 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 12, ptr %varargslots, i64 1) + %hi = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.thread_allocator, i64 8), align 8 + %0 = call ptr @"std.collections.map$int$test.Foo$.HashMap.new_init"(ptr %map, i32 16, float 7.500000e-01, i64 %lo, ptr %hi) + %ptradd = getelementptr inbounds i8, ptr %map, i64 32 + %1 = insertvalue %"any*" undef, ptr %ptradd, 0 + %2 = insertvalue %"any*" %1, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %2, ptr %varargslots, align 16 + %3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 12, ptr %varargslots, i64 1) call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal, ptr align 8 @.__const, i32 16, i1 false) - %6 = getelementptr inbounds { i64, ptr }, ptr %literal, i32 0, i32 0 - %lo1 = load i64, ptr %6, align 8 - %7 = getelementptr inbounds { i64, ptr }, ptr %literal, i32 0, i32 1 - %hi2 = load ptr, ptr %7, align 8 - %8 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i64 %lo1, ptr %hi2) - %9 = getelementptr inbounds %HashMap, ptr %map, i32 0, i32 2 - %10 = insertvalue %"any*" undef, ptr %9, 0 - %11 = insertvalue %"any*" %10, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %12 = getelementptr inbounds [1 x %"any*"], ptr %varargslots3, i64 0, i64 0 - store %"any*" %11, ptr %12, align 16 - %13 = call i64 @std.io.printfn(ptr %retparam4, ptr @.str.1, i64 12, ptr %varargslots3, i64 1) - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal5, ptr align 8 @.__const.2, i32 16, i1 false) - %14 = getelementptr inbounds { i64, ptr }, ptr %literal5, i32 0, i32 0 - %lo6 = load i64, ptr %14, align 8 - %15 = getelementptr inbounds { i64, ptr }, ptr %literal5, i32 0, i32 1 - %hi7 = load ptr, ptr %15, align 8 - %16 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i64 %lo6, ptr %hi7) - %17 = getelementptr inbounds %HashMap, ptr %map, i32 0, i32 2 - %18 = insertvalue %"any*" undef, ptr %17, 0 - %19 = insertvalue %"any*" %18, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 - %20 = getelementptr inbounds [1 x %"any*"], ptr %varargslots8, i64 0, i64 0 - store %"any*" %19, ptr %20, align 16 - %21 = call i64 @std.io.printfn(ptr %retparam9, ptr @.str.3, i64 12, ptr %varargslots8, i64 1) - %22 = call i64 @"std.collections.map$int$test.Foo$.HashMap.get"(ptr %retparam11, ptr %map, i32 1) - %not_err = icmp eq i64 %22, 0 - %23 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %23, label %after_check, label %after_check14 + %lo1 = load i64, ptr %literal, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %literal, i64 8 + %hi3 = load ptr, ptr %ptradd2, align 8 + %4 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i64 %lo1, ptr %hi3) + %ptradd5 = getelementptr inbounds i8, ptr %map, i64 32 + %5 = insertvalue %"any*" undef, ptr %ptradd5, 0 + %6 = insertvalue %"any*" %5, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %6, ptr %varargslots4, align 16 + %7 = call i64 @std.io.printfn(ptr %retparam6, ptr @.str.1, i64 12, ptr %varargslots4, i64 1) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal7, ptr align 8 @.__const.2, i32 16, i1 false) + %lo8 = load i64, ptr %literal7, align 8 + %ptradd9 = getelementptr inbounds i8, ptr %literal7, i64 8 + %hi10 = load ptr, ptr %ptradd9, align 8 + %8 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 1, i64 %lo8, ptr %hi10) + %ptradd12 = getelementptr inbounds i8, ptr %map, i64 32 + %9 = insertvalue %"any*" undef, ptr %ptradd12, 0 + %10 = insertvalue %"any*" %9, i64 ptrtoint (ptr @"$ct.uint" to i64), 1 + store %"any*" %10, ptr %varargslots11, align 16 + %11 = call i64 @std.io.printfn(ptr %retparam13, ptr @.str.3, i64 12, ptr %varargslots11, i64 1) + %12 = call i64 @"std.collections.map$int$test.Foo$.HashMap.get"(ptr %retparam15, ptr %map, i32 1) + %not_err = icmp eq i64 %12, 0 + %13 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %13, label %after_check, label %after_check18 after_check: ; preds = %entry - %24 = getelementptr inbounds %Foo, ptr %retparam11, i32 0, i32 0 - %25 = insertvalue %"any*" undef, ptr %24, 0 - %26 = insertvalue %"any*" %25, i64 ptrtoint (ptr @"$ct.int" to i64), 1 - %27 = getelementptr inbounds [1 x %"any*"], ptr %varargslots10, i64 0, i64 0 - store %"any*" %26, ptr %27, align 16 - %28 = call i64 @std.io.printfn(ptr %retparam12, ptr @.str.4, i64 7, ptr %varargslots10, i64 1) - %not_err13 = icmp eq i64 %28, 0 - %29 = call i1 @llvm.expect.i1(i1 %not_err13, i1 true) - br i1 %29, label %after_check14, label %after_check14 + %14 = insertvalue %"any*" undef, ptr %retparam15, 0 + %15 = insertvalue %"any*" %14, i64 ptrtoint (ptr @"$ct.int" to i64), 1 + store %"any*" %15, ptr %varargslots14, align 16 + %16 = call i64 @std.io.printfn(ptr %retparam16, ptr @.str.4, i64 7, ptr %varargslots14, i64 1) + %not_err17 = icmp eq i64 %16, 0 + %17 = call i1 @llvm.expect.i1(i1 %not_err17, i1 true) + br i1 %17, label %after_check18, label %after_check18 -after_check14: ; preds = %entry, %after_check, %after_check - %30 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 1) - store i8 %30, ptr %taddr, align 1 - %31 = insertvalue %"any*" undef, ptr %taddr, 0 - %32 = insertvalue %"any*" %31, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %33 = getelementptr inbounds [1 x %"any*"], ptr %varargslots15, i64 0, i64 0 - store %"any*" %32, ptr %33, align 16 - %34 = call i64 @std.io.printfn(ptr %retparam16, ptr @.str.5, i64 9, ptr %varargslots15, i64 1) - %35 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 2) - store i8 %35, ptr %taddr20, align 1 - %36 = insertvalue %"any*" undef, ptr %taddr20, 0 - %37 = insertvalue %"any*" %36, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %38 = getelementptr inbounds [1 x %"any*"], ptr %varargslots19, i64 0, i64 0 - store %"any*" %37, ptr %38, align 16 - %39 = call i64 @std.io.printfn(ptr %retparam21, ptr @.str.6, i64 9, ptr %varargslots19, i64 1) - call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal24, ptr align 8 @.__const.7, i32 16, i1 false) - %40 = getelementptr inbounds { i64, ptr }, ptr %literal24, i32 0, i32 0 - %lo25 = load i64, ptr %40, align 8 - %41 = getelementptr inbounds { i64, ptr }, ptr %literal24, i32 0, i32 1 - %hi26 = load ptr, ptr %41, align 8 - %42 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 7, i64 %lo25, ptr %hi26) - %lo28 = load i64, ptr @std.core.mem.thread_allocator, align 8 - %hi29 = load ptr, ptr getelementptr inbounds ({ i64, ptr }, ptr @std.core.mem.thread_allocator, i32 0, i32 1), align 8 - %43 = call { ptr, i64 } @"std.collections.map$int$test.Foo$.HashMap.value_new_list"(ptr %map, i64 %lo28, ptr %hi29) - store { ptr, i64 } %43, ptr %result, align 8 - %44 = insertvalue %"any*" undef, ptr %result, 0 - %45 = insertvalue %"any*" %44, i64 ptrtoint (ptr @"$ct.sa$test.Foo" to i64), 1 - %46 = getelementptr inbounds [1 x %"any*"], ptr %varargslots27, i64 0, i64 0 - store %"any*" %45, ptr %46, align 16 - %47 = call i64 @std.io.printfn(ptr %retparam30, ptr @.str.8, i64 10, ptr %varargslots27, i64 1) - call void @llvm.memset.p0.i64(ptr align 8 %map2, i8 0, i64 48, i1 false) +after_check18: ; preds = %entry, %after_check, %after_check + %18 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 1) + store i8 %18, ptr %taddr, align 1 + %19 = insertvalue %"any*" undef, ptr %taddr, 0 + %20 = insertvalue %"any*" %19, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %20, ptr %varargslots19, align 16 + %21 = call i64 @std.io.printfn(ptr %retparam20, ptr @.str.5, i64 9, ptr %varargslots19, i64 1) + %22 = call i8 @"std.collections.map$int$test.Foo$.HashMap.has_key"(ptr %map, i32 2) + store i8 %22, ptr %taddr24, align 1 + %23 = insertvalue %"any*" undef, ptr %taddr24, 0 + %24 = insertvalue %"any*" %23, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %24, ptr %varargslots23, align 16 + %25 = call i64 @std.io.printfn(ptr %retparam25, ptr @.str.6, i64 9, ptr %varargslots23, i64 1) + call void @llvm.memcpy.p0.p0.i32(ptr align 8 %literal28, ptr align 8 @.__const.7, i32 16, i1 false) + %lo29 = load i64, ptr %literal28, align 8 + %ptradd30 = getelementptr inbounds i8, ptr %literal28, i64 8 + %hi31 = load ptr, ptr %ptradd30, align 8 + %26 = call i8 @"std.collections.map$int$test.Foo$.HashMap.set"(ptr %map, i32 7, i64 %lo29, ptr %hi31) %lo33 = load i64, ptr @std.core.mem.thread_allocator, align 8 - %hi34 = load ptr, ptr getelementptr inbounds ({ i64, ptr }, ptr @std.core.mem.thread_allocator, i32 0, i32 1), align 8 - %48 = call ptr @"std.collections.map$int$double$.HashMap.init_new"(ptr %map2, i32 16, float 7.500000e-01, i64 %lo33, ptr %hi34) - %49 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 4, double 1.300000e+00) - %50 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.300000e+00) - store i8 %50, ptr %taddr36, align 1 - %51 = insertvalue %"any*" undef, ptr %taddr36, 0 - %52 = insertvalue %"any*" %51, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %53 = getelementptr inbounds [1 x %"any*"], ptr %varargslots35, i64 0, i64 0 - store %"any*" %52, ptr %53, align 16 - %54 = call i64 @std.io.printfn(ptr %retparam37, ptr @.str.9, i64 12, ptr %varargslots35, i64 1) - %55 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.200000e+00) - store i8 %55, ptr %taddr41, align 1 - %56 = insertvalue %"any*" undef, ptr %taddr41, 0 - %57 = insertvalue %"any*" %56, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 - %58 = getelementptr inbounds [1 x %"any*"], ptr %varargslots40, i64 0, i64 0 - store %"any*" %57, ptr %58, align 16 - %59 = call i64 @std.io.printfn(ptr %retparam42, ptr @.str.10, i64 12, ptr %varargslots40, i64 1) - %60 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 100, double 3.400000e+00) - %lo46 = load i64, ptr @std.core.mem.thread_allocator, align 8 - %hi47 = load ptr, ptr getelementptr inbounds ({ i64, ptr }, ptr @std.core.mem.thread_allocator, i32 0, i32 1), align 8 - %61 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_new_list"(ptr %map2, i64 %lo46, ptr %hi47) - store { ptr, i64 } %61, ptr %result48, align 8 - %62 = insertvalue %"any*" undef, ptr %result48, 0 - %63 = insertvalue %"any*" %62, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 - %64 = getelementptr inbounds [1 x %"any*"], ptr %varargslots45, i64 0, i64 0 - store %"any*" %63, ptr %64, align 16 - %65 = call i64 @std.io.printfn(ptr %retparam49, ptr @.str.11, i64 2, ptr %varargslots45, i64 1) - %lo53 = load i64, ptr @std.core.mem.thread_allocator, align 8 - %hi54 = load ptr, ptr getelementptr inbounds ({ i64, ptr }, ptr @std.core.mem.thread_allocator, i32 0, i32 1), align 8 - %66 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.value_new_list"(ptr %map2, i64 %lo53, ptr %hi54) - store { ptr, i64 } %66, ptr %result55, align 8 - %67 = insertvalue %"any*" undef, ptr %result55, 0 - %68 = insertvalue %"any*" %67, i64 ptrtoint (ptr @"$ct.sa$double" to i64), 1 - %69 = getelementptr inbounds [1 x %"any*"], ptr %varargslots52, i64 0, i64 0 - store %"any*" %68, ptr %69, align 16 - %70 = call i64 @std.io.printfn(ptr %retparam56, ptr @.str.12, i64 2, ptr %varargslots52, i64 1) - %71 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 - %not = icmp eq ptr %71, null + %hi34 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.thread_allocator, i64 8), align 8 + %27 = call { ptr, i64 } @"std.collections.map$int$test.Foo$.HashMap.value_new_list"(ptr %map, i64 %lo33, ptr %hi34) + store { ptr, i64 } %27, ptr %result, align 8 + %28 = insertvalue %"any*" undef, ptr %result, 0 + %29 = insertvalue %"any*" %28, i64 ptrtoint (ptr @"$ct.sa$test.Foo" to i64), 1 + store %"any*" %29, ptr %varargslots32, align 16 + %30 = call i64 @std.io.printfn(ptr %retparam35, ptr @.str.8, i64 10, ptr %varargslots32, i64 1) + call void @llvm.memset.p0.i64(ptr align 8 %map2, i8 0, i64 48, i1 false) + %lo38 = load i64, ptr @std.core.mem.thread_allocator, align 8 + %hi39 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.thread_allocator, i64 8), align 8 + %31 = call ptr @"std.collections.map$int$double$.HashMap.new_init"(ptr %map2, i32 16, float 7.500000e-01, i64 %lo38, ptr %hi39) + %32 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 4, double 1.300000e+00) + %33 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.300000e+00) + store i8 %33, ptr %taddr41, align 1 + %34 = insertvalue %"any*" undef, ptr %taddr41, 0 + %35 = insertvalue %"any*" %34, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %35, ptr %varargslots40, align 16 + %36 = call i64 @std.io.printfn(ptr %retparam42, ptr @.str.9, i64 12, ptr %varargslots40, i64 1) + %37 = call i8 @"std.collections.map$int$double$.HashMap.has_value"(ptr %map2, double 1.200000e+00) + store i8 %37, ptr %taddr46, align 1 + %38 = insertvalue %"any*" undef, ptr %taddr46, 0 + %39 = insertvalue %"any*" %38, i64 ptrtoint (ptr @"$ct.bool" to i64), 1 + store %"any*" %39, ptr %varargslots45, align 16 + %40 = call i64 @std.io.printfn(ptr %retparam47, ptr @.str.10, i64 12, ptr %varargslots45, i64 1) + %41 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map2, i32 100, double 3.400000e+00) + %lo51 = load i64, ptr @std.core.mem.thread_allocator, align 8 + %hi52 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.thread_allocator, i64 8), align 8 + %42 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_new_list"(ptr %map2, i64 %lo51, ptr %hi52) + store { ptr, i64 } %42, ptr %result53, align 8 + %43 = insertvalue %"any*" undef, ptr %result53, 0 + %44 = insertvalue %"any*" %43, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 + store %"any*" %44, ptr %varargslots50, align 16 + %45 = call i64 @std.io.printfn(ptr %retparam54, ptr @.str.11, i64 2, ptr %varargslots50, i64 1) + %lo58 = load i64, ptr @std.core.mem.thread_allocator, align 8 + %hi59 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.thread_allocator, i64 8), align 8 + %46 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.value_new_list"(ptr %map2, i64 %lo58, ptr %hi59) + store { ptr, i64 } %46, ptr %result60, align 8 + %47 = insertvalue %"any*" undef, ptr %result60, 0 + %48 = insertvalue %"any*" %47, i64 ptrtoint (ptr @"$ct.sa$double" to i64), 1 + store %"any*" %48, ptr %varargslots57, align 16 + %49 = call i64 @std.io.printfn(ptr %retparam61, ptr @.str.12, i64 2, ptr %varargslots57, i64 1) + %50 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 + %not = icmp eq ptr %50, null br i1 %not, label %if.then, label %if.exit -if.then: ; preds = %after_check14 +if.then: ; preds = %after_check18 call void @std.core.mem.init_default_temp_allocators() br label %if.exit -if.exit: ; preds = %if.then, %after_check14 - %72 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 - store ptr %72, ptr %current, align 8 - %73 = load ptr, ptr %current, align 8 - %74 = getelementptr inbounds %TempAllocator, ptr %73, i32 0, i32 2 - %75 = load i64, ptr %74, align 8 - store i64 %75, ptr %mark, align 8 +if.exit: ; preds = %if.then, %after_check18 + %51 = load ptr, ptr @std.core.mem.thread_temp_allocator, align 8 + store ptr %51, ptr %current, align 8 + %52 = load ptr, ptr %current, align 8 + %ptradd64 = getelementptr inbounds i8, ptr %52, i64 24 + %53 = load i64, ptr %ptradd64, align 8 + store i64 %53, ptr %mark, align 8 call void @llvm.memset.p0.i64(ptr align 8 %map3, i8 0, i64 48, i1 false) - %lo59 = load i64, ptr @std.core.mem.thread_allocator, align 8 - %hi60 = load ptr, ptr getelementptr inbounds ({ i64, ptr }, ptr @std.core.mem.thread_allocator, i32 0, i32 1), align 8 - %76 = call ptr @"std.collections.map$int$double$.HashMap.init_new"(ptr %map3, i32 16, float 7.500000e-01, i64 %lo59, ptr %hi60) - %77 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 5, double 3.200000e+00) - %78 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 7, double 5.200000e+00) - %lo62 = load i64, ptr @std.core.mem.thread_allocator, align 8 - %hi63 = load ptr, ptr getelementptr inbounds ({ i64, ptr }, ptr @std.core.mem.thread_allocator, i32 0, i32 1), align 8 - %79 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_new_list"(ptr %map3, i64 %lo62, ptr %hi63) - store { ptr, i64 } %79, ptr %result64, align 8 - %80 = insertvalue %"any*" undef, ptr %result64, 0 - %81 = insertvalue %"any*" %80, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 - %82 = getelementptr inbounds [1 x %"any*"], ptr %varargslots61, i64 0, i64 0 - store %"any*" %81, ptr %82, align 16 - %83 = call i64 @std.io.printfn(ptr %retparam65, ptr @.str.13, i64 2, ptr %varargslots61, i64 1) - %84 = load ptr, ptr %current, align 8 - %85 = load i64, ptr %mark, align 8 - call void @std.core.mem.allocator.TempAllocator.reset(ptr %84, i64 %85) + %lo65 = load i64, ptr @std.core.mem.thread_allocator, align 8 + %hi66 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.thread_allocator, i64 8), align 8 + %54 = call ptr @"std.collections.map$int$double$.HashMap.new_init"(ptr %map3, i32 16, float 7.500000e-01, i64 %lo65, ptr %hi66) + %55 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 5, double 3.200000e+00) + %56 = call i8 @"std.collections.map$int$double$.HashMap.set"(ptr %map3, i32 7, double 5.200000e+00) + %lo68 = load i64, ptr @std.core.mem.thread_allocator, align 8 + %hi69 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.thread_allocator, i64 8), align 8 + %57 = call { ptr, i64 } @"std.collections.map$int$double$.HashMap.key_new_list"(ptr %map3, i64 %lo68, ptr %hi69) + store { ptr, i64 } %57, ptr %result70, align 8 + %58 = insertvalue %"any*" undef, ptr %result70, 0 + %59 = insertvalue %"any*" %58, i64 ptrtoint (ptr @"$ct.sa$int" to i64), 1 + store %"any*" %59, ptr %varargslots67, align 16 + %60 = call i64 @std.io.printfn(ptr %retparam71, ptr @.str.13, i64 2, ptr %varargslots67, i64 1) + %61 = load ptr, ptr %current, align 8 + %62 = load i64, ptr %mark, align 8 + call void @std.core.mem.allocator.TempAllocator.reset(ptr %61, i64 %62) ret void } define internal void @.static_initialize.0() { diff --git a/test/test_suite/struct/nested_struct_init.c3t b/test/test_suite/struct/nested_struct_init.c3t index ab82f76c9..c67162466 100644 --- a/test/test_suite/struct/nested_struct_init.c3t +++ b/test/test_suite/struct/nested_struct_init.c3t @@ -48,29 +48,24 @@ fn void main() @.__const.8 = private unnamed_addr constant %Matrix2x2_b { %.anon.1 { [4 x float] [float 1.000000e+00, float 2.000000e+00, float 3.000000e+00, float 4.000000e+00] } }, align 4 @.str = private unnamed_addr constant [13 x i8] c"%f %f %f %f\0A\00", align 1 - +; Function Attrs: define void @foo.main() #0 { entry: %m = alloca %Matrix2x2, align 4 %m2 = alloca %Matrix2x2_b, align 4 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %m, ptr align 4 @.__const, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %m2, ptr align 4 @.__const.8, i32 16, i1 false) - %0 = getelementptr inbounds %Matrix2x2, ptr %m, i32 0, i32 0 - %1 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 0 - %2 = load float, ptr %1, align 4 - %fpfpext = fpext float %2 to double - %3 = getelementptr inbounds %Matrix2x2, ptr %m, i32 0, i32 0 - %4 = getelementptr inbounds [4 x float], ptr %3, i64 0, i64 1 - %5 = load float, ptr %4, align 4 - %fpfpext1 = fpext float %5 to double - %6 = getelementptr inbounds %Matrix2x2, ptr %m, i32 0, i32 0 - %7 = getelementptr inbounds %.anon.0, ptr %6, i32 0, i32 2 - %8 = load float, ptr %7, align 4 - %fpfpext2 = fpext float %8 to double - %9 = getelementptr inbounds %Matrix2x2, ptr %m, i32 0, i32 0 - %10 = getelementptr inbounds [4 x float], ptr %9, i64 0, i64 3 - %11 = load float, ptr %10, align 4 - %fpfpext3 = fpext float %11 to double - %12 = call i32 (ptr, ...) @printf(ptr @.str, double %fpfpext, double %fpfpext1, double %fpfpext2, double %fpfpext3) + %0 = load float, ptr %m, align 4 + %fpfpext = fpext float %0 to double + %ptradd = getelementptr inbounds i8, ptr %m, i64 4 + %1 = load float, ptr %ptradd, align 4 + %fpfpext1 = fpext float %1 to double + %ptradd2 = getelementptr inbounds i8, ptr %m, i64 8 + %2 = load float, ptr %ptradd2, align 4 + %fpfpext3 = fpext float %2 to double + %ptradd4 = getelementptr inbounds i8, ptr %m, i64 12 + %3 = load float, ptr %ptradd4, align 4 + %fpfpext5 = fpext float %3 to double + %4 = call i32 (ptr, ...) @printf(ptr @.str, double %fpfpext, double %fpfpext1, double %fpfpext3, double %fpfpext5) ret void } diff --git a/test/test_suite/struct/nested_struct_union_init.c3t b/test/test_suite/struct/nested_struct_union_init.c3t index e669bc45e..9798c1d0b 100644 --- a/test/test_suite/struct/nested_struct_union_init.c3t +++ b/test/test_suite/struct/nested_struct_union_init.c3t @@ -67,43 +67,36 @@ entry: %x = alloca %Matrix3x3, align 4 %m = alloca %Matrix2x2, align 4 %m2 = alloca %Matrix2x2_b, align 4 - %0 = getelementptr inbounds %Matrix3x3, ptr %x, i32 0, i32 0 - %1 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 0 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %1, ptr align 4 @.__const, i32 4, i1 false) - %2 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 1 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %2, ptr align 4 @.__const.16, i32 4, i1 false) - %3 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 2 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %3, ptr align 4 @.__const.17, i32 4, i1 false) - %4 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 3 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %4, ptr align 4 @.__const.18, i32 4, i1 false) - %5 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 4 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %5, ptr align 4 @.__const.19, i32 4, i1 false) - %6 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 5 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %6, ptr align 4 @.__const.20, i32 4, i1 false) - %7 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 6 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %7, ptr align 4 @.__const.21, i32 4, i1 false) - %8 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 7 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %8, ptr align 4 @.__const.22, i32 4, i1 false) - %9 = getelementptr inbounds %.anon.0, ptr %0, i32 0, i32 8 - call void @llvm.memcpy.p0.p0.i32(ptr align 4 %9, ptr align 4 @.__const.23, i32 4, i1 false) + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 4, i1 false) + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd, ptr align 4 @.__const.16, i32 4, i1 false) + %ptradd1 = getelementptr inbounds i8, ptr %x, i64 8 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd1, ptr align 4 @.__const.17, i32 4, i1 false) + %ptradd2 = getelementptr inbounds i8, ptr %x, i64 12 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd2, ptr align 4 @.__const.18, i32 4, i1 false) + %ptradd3 = getelementptr inbounds i8, ptr %x, i64 16 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd3, ptr align 4 @.__const.19, i32 4, i1 false) + %ptradd4 = getelementptr inbounds i8, ptr %x, i64 20 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd4, ptr align 4 @.__const.20, i32 4, i1 false) + %ptradd5 = getelementptr inbounds i8, ptr %x, i64 24 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd5, ptr align 4 @.__const.21, i32 4, i1 false) + %ptradd6 = getelementptr inbounds i8, ptr %x, i64 28 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd6, ptr align 4 @.__const.22, i32 4, i1 false) + %ptradd7 = getelementptr inbounds i8, ptr %x, i64 32 + call void @llvm.memcpy.p0.p0.i32(ptr align 4 %ptradd7, ptr align 4 @.__const.23, i32 4, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %m, ptr align 4 @.__const.24, i32 16, i1 false) call void @llvm.memcpy.p0.p0.i32(ptr align 4 %m2, ptr align 4 @.__const.25, i32 16, i1 false) - %10 = getelementptr inbounds %Matrix3x3, ptr %x, i32 0, i32 0 - %11 = getelementptr inbounds %.anon.0, ptr %10, i32 0, i32 0 - %12 = load float, ptr %11, align 4 - %fpfpext = fpext float %12 to double - %13 = getelementptr inbounds %Matrix3x3, ptr %x, i32 0, i32 0 - %14 = getelementptr inbounds [9 x float], ptr %13, i64 0, i64 1 - %15 = load float, ptr %14, align 4 - %fpfpext1 = fpext float %15 to double - %16 = getelementptr inbounds %Matrix3x3, ptr %x, i32 0, i32 0 - %17 = getelementptr inbounds %.anon.0, ptr %16, i32 0, i32 3 - %18 = load float, ptr %17, align 4 - %fpfpext2 = fpext float %18 to double - %19 = getelementptr inbounds %Matrix3x3, ptr %x, i32 0, i32 0 - %20 = getelementptr inbounds [9 x float], ptr %19, i64 0, i64 3 - %21 = load float, ptr %20, align 4 - %fpfpext3 = fpext float %21 to double - %22 = call i32 (ptr, ...) @printf(ptr @.str, double %fpfpext, double %fpfpext1, double %fpfpext2, double %fpfpext3) + %0 = load float, ptr %x, align 4 + %fpfpext = fpext float %0 to double + %ptradd8 = getelementptr inbounds i8, ptr %x, i64 4 + %1 = load float, ptr %ptradd8, align 4 + %fpfpext9 = fpext float %1 to double + %ptradd10 = getelementptr inbounds i8, ptr %x, i64 12 + %2 = load float, ptr %ptradd10, align 4 + %fpfpext11 = fpext float %2 to double + %ptradd12 = getelementptr inbounds i8, ptr %x, i64 12 + %3 = load float, ptr %ptradd12, align 4 + %fpfpext13 = fpext float %3 to double + %4 = call i32 (ptr, ...) @printf(ptr @.str, double %fpfpext, double %fpfpext9, double %fpfpext11, double %fpfpext13) ret void } diff --git a/test/test_suite/struct/struct_codegen_fam.c3t b/test/test_suite/struct/struct_codegen_fam.c3t index d44fe97fb..d7fda8dc5 100644 --- a/test/test_suite/struct/struct_codegen_fam.c3t +++ b/test/test_suite/struct/struct_codegen_fam.c3t @@ -24,7 +24,7 @@ fn void test(Bar b) define void @foo.test(ptr byval(%Bar) align 8 %0) #0 { entry: - %1 = getelementptr inbounds %Bar, ptr %0, i32 0, i32 2 - %2 = getelementptr inbounds [0 x i32], ptr %1, i64 0, i64 1 + %ptradd = getelementptr inbounds i8, ptr %0, i64 8 + %ptradd1 = getelementptr inbounds i8, ptr %ptradd, i64 4 ret void } \ No newline at end of file diff --git a/test/test_suite/struct/struct_pack_and_align.c3t b/test/test_suite/struct/struct_pack_and_align.c3t index c73fdd1e3..db00f4275 100644 --- a/test/test_suite/struct/struct_pack_and_align.c3t +++ b/test/test_suite/struct/struct_pack_and_align.c3t @@ -85,17 +85,17 @@ Foo6 foo6 = { 1, 2, 3 }; @struct2.foo5 = local_unnamed_addr global %Foo5 { i32 1, [12 x i8] undef, i8 2, [15 x i8] undef }, align 16 @struct2.foo6 = local_unnamed_addr global %Foo6 { i32 1, i16 2, i16 3 }, align 1 +; Function Attrs: define i32 @struct2.test5(i8 signext %0) #0 { entry: %y = alloca %Foo5, align 16 call void @llvm.memset.p0.i64(ptr align 16 %y, i8 0, i64 32, i1 false) - %1 = getelementptr inbounds %Foo5, ptr %y, i32 0, i32 2 - store i8 %0, ptr %1, align 16 - %2 = getelementptr inbounds %Foo5, ptr %y, i32 0, i32 2 - %3 = load i8, ptr %2, align 16 - %sext = sext i8 %3 to i32 - %4 = getelementptr inbounds %Foo5, ptr %y, i32 0, i32 0 - %5 = load i32, ptr %4, align 16 - %add = add i32 %sext, %5 + %ptradd = getelementptr inbounds i8, ptr %y, i64 16 + store i8 %0, ptr %ptradd, align 16 + %ptradd1 = getelementptr inbounds i8, ptr %y, i64 16 + %1 = load i8, ptr %ptradd1, align 16 + %sext = sext i8 %1 to i32 + %2 = load i32, ptr %y, align 16 + %add = add i32 %sext, %2 ret i32 %add } diff --git a/test/test_suite/subarrays/slice_comparison.c3t b/test/test_suite/subarrays/slice_comparison.c3t index 017abab2c..5e6edee7c 100644 --- a/test/test_suite/subarrays/slice_comparison.c3t +++ b/test/test_suite/subarrays/slice_comparison.c3t @@ -62,10 +62,10 @@ subarray_loop_start: ; preds = %subarray_loop_compa br i1 %lt, label %subarray_loop_comparison, label %subarray_cmp_exit subarray_loop_comparison: ; preds = %subarray_loop_start - %ptroffset = getelementptr inbounds i8, ptr %2, i64 %3 - %ptroffset1 = getelementptr inbounds i8, ptr @.str.2, i64 %3 - %4 = load i8, ptr %ptroffset, align 1 - %5 = load i8, ptr %ptroffset1, align 1 + %ptradd = getelementptr inbounds i8, ptr %2, i64 %3 + %ptradd1 = getelementptr inbounds i8, ptr @.str.2, i64 %3 + %4 = load i8, ptr %ptradd, align 1 + %5 = load i8, ptr %ptradd1, align 1 %eq2 = icmp eq i8 %4, %5 %6 = add i64 %3, 1 store i64 %6, ptr %cmp.idx, align 8 @@ -99,10 +99,10 @@ subarray_loop_start6: ; preds = %subarray_loop_compa br i1 %lt7, label %subarray_loop_comparison8, label %subarray_cmp_exit12 subarray_loop_comparison8: ; preds = %subarray_loop_start6 - %ptroffset9 = getelementptr inbounds i8, ptr %11, i64 %13 - %ptroffset10 = getelementptr inbounds i8, ptr %12, i64 %13 - %14 = load i8, ptr %ptroffset9, align 1 - %15 = load i8, ptr %ptroffset10, align 1 + %ptradd9 = getelementptr inbounds i8, ptr %11, i64 %13 + %ptradd10 = getelementptr inbounds i8, ptr %12, i64 %13 + %14 = load i8, ptr %ptradd9, align 1 + %15 = load i8, ptr %ptradd10, align 1 %eq11 = icmp eq i8 %14, %15 %16 = add i64 %13, 1 store i64 %16, ptr %cmp.idx5, align 8 @@ -137,10 +137,10 @@ subarray_loop_start19: ; preds = %subarray_loop_compa br i1 %lt20, label %subarray_loop_comparison21, label %subarray_cmp_exit25 subarray_loop_comparison21: ; preds = %subarray_loop_start19 - %ptroffset22 = getelementptr inbounds i8, ptr @.str.5, i64 %20 - %ptroffset23 = getelementptr inbounds i8, ptr %19, i64 %20 - %21 = load i8, ptr %ptroffset22, align 1 - %22 = load i8, ptr %ptroffset23, align 1 + %ptradd22 = getelementptr inbounds i8, ptr @.str.5, i64 %20 + %ptradd23 = getelementptr inbounds i8, ptr %19, i64 %20 + %21 = load i8, ptr %ptradd22, align 1 + %22 = load i8, ptr %ptradd23, align 1 %eq24 = icmp eq i8 %21, %22 %23 = add i64 %20, 1 store i64 %23, ptr %cmp.idx18, align 8 @@ -170,10 +170,10 @@ subarray_loop_start30: ; preds = %subarray_loop_compa br i1 %lt31, label %subarray_loop_comparison32, label %subarray_cmp_exit36 subarray_loop_comparison32: ; preds = %subarray_loop_start30 - %ptroffset33 = getelementptr inbounds i8, ptr @.str.7, i64 %26 - %ptroffset34 = getelementptr inbounds i8, ptr %25, i64 %26 - %27 = load i8, ptr %ptroffset33, align 1 - %28 = load i8, ptr %ptroffset34, align 1 + %ptradd33 = getelementptr inbounds i8, ptr @.str.7, i64 %26 + %ptradd34 = getelementptr inbounds i8, ptr %25, i64 %26 + %27 = load i8, ptr %ptradd33, align 1 + %28 = load i8, ptr %ptradd34, align 1 %eq35 = icmp eq i8 %27, %28 %29 = add i64 %26, 1 store i64 %29, ptr %cmp.idx29, align 8 @@ -203,10 +203,10 @@ subarray_loop_start43: ; preds = %subarray_loop_compa br i1 %lt44, label %subarray_loop_comparison45, label %subarray_cmp_exit49 subarray_loop_comparison45: ; preds = %subarray_loop_start43 - %ptroffset46 = getelementptr inbounds i8, ptr @.str.9, i64 %32 - %ptroffset47 = getelementptr inbounds i8, ptr %31, i64 %32 - %33 = load i8, ptr %ptroffset46, align 1 - %34 = load i8, ptr %ptroffset47, align 1 + %ptradd46 = getelementptr inbounds i8, ptr @.str.9, i64 %32 + %ptradd47 = getelementptr inbounds i8, ptr %31, i64 %32 + %33 = load i8, ptr %ptradd46, align 1 + %34 = load i8, ptr %ptradd47, align 1 %eq48 = icmp eq i8 %33, %34 %35 = add i64 %32, 1 store i64 %35, ptr %cmp.idx42, align 8 diff --git a/test/test_suite/subarrays/slice_offset.c3t b/test/test_suite/subarrays/slice_offset.c3t index 37c881979..55203e904 100644 --- a/test/test_suite/subarrays/slice_offset.c3t +++ b/test/test_suite/subarrays/slice_offset.c3t @@ -11,9 +11,9 @@ entry: %x = alloca [3 x i32], align 4 %y = alloca %"int[]", align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - %1 = insertvalue %"int[]" undef, ptr %0, 0 - %2 = insertvalue %"int[]" %1, i64 2, 1 - store %"int[]" %2, ptr %y, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + %0 = insertvalue %"int[]" undef, ptr %ptradd, 0 + %1 = insertvalue %"int[]" %0, i64 2, 1 + store %"int[]" %1, ptr %y, align 8 ret void } diff --git a/test/test_suite/subarrays/slice_offset_neg_end.c3t b/test/test_suite/subarrays/slice_offset_neg_end.c3t index b7592bb09..e36abf9be 100644 --- a/test/test_suite/subarrays/slice_offset_neg_end.c3t +++ b/test/test_suite/subarrays/slice_offset_neg_end.c3t @@ -12,9 +12,9 @@ entry: %x = alloca [3 x i32], align 4 %y = alloca %"int[]", align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - %1 = insertvalue %"int[]" undef, ptr %0, 0 - %2 = insertvalue %"int[]" %1, i64 2, 1 - store %"int[]" %2, ptr %y, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + %0 = insertvalue %"int[]" undef, ptr %ptradd, 0 + %1 = insertvalue %"int[]" %0, i64 2, 1 + store %"int[]" %1, ptr %y, align 8 ret void } diff --git a/test/test_suite/subarrays/slice_offset_neg_start.c3t b/test/test_suite/subarrays/slice_offset_neg_start.c3t index cc03293be..5414d6e86 100644 --- a/test/test_suite/subarrays/slice_offset_neg_start.c3t +++ b/test/test_suite/subarrays/slice_offset_neg_start.c3t @@ -11,9 +11,9 @@ entry: %x = alloca [3 x i32], align 4 %y = alloca %"int[]", align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 1 - %1 = insertvalue %"int[]" undef, ptr %0, 0 - %2 = insertvalue %"int[]" %1, i64 1, 1 - store %"int[]" %2, ptr %y, align 8 + %ptradd = getelementptr inbounds i8, ptr %x, i64 4 + %0 = insertvalue %"int[]" undef, ptr %ptradd, 0 + %1 = insertvalue %"int[]" %0, i64 1, 1 + store %"int[]" %1, ptr %y, align 8 ret void } diff --git a/test/test_suite/subarrays/slice_start.c3t b/test/test_suite/subarrays/slice_start.c3t index c81549952..6acea276a 100644 --- a/test/test_suite/subarrays/slice_start.c3t +++ b/test/test_suite/subarrays/slice_start.c3t @@ -11,9 +11,8 @@ entry: %x = alloca [3 x i32], align 4 %y = alloca %"int[]", align 8 call void @llvm.memcpy.p0.p0.i32(ptr align 4 %x, ptr align 4 @.__const, i32 12, i1 false) - %0 = getelementptr inbounds [3 x i32], ptr %x, i64 0, i64 0 - %1 = insertvalue %"int[]" undef, ptr %0, 0 - %2 = insertvalue %"int[]" %1, i64 3, 1 - store %"int[]" %2, ptr %y, align 8 + %0 = insertvalue %"int[]" undef, ptr %x, 0 + %1 = insertvalue %"int[]" %0, i64 3, 1 + store %"int[]" %1, ptr %y, align 8 ret void } \ No newline at end of file diff --git a/test/test_suite/switch/switch_in_defer_macro.c3t b/test/test_suite/switch/switch_in_defer_macro.c3t index bf2cf218c..db6e3cab4 100644 --- a/test/test_suite/switch/switch_in_defer_macro.c3t +++ b/test/test_suite/switch/switch_in_defer_macro.c3t @@ -282,7 +282,7 @@ fn String! Lexer.parse_string(&self, char quote) @private char c = self.read_char_for_string()!; if (c == quote) return ""; DString str; - str.init_new(8, self.allocator); + str.new_init(8, self.allocator); char prev; while (true) { @@ -352,7 +352,7 @@ fn void! Lexer.parse_comment(&self, String end) @private { // Find the end token and accumulate the data in between. DString acc; - acc.init_new(8, self.allocator); + acc.new_init(8, self.allocator); char[] buf = self.buf[:end.len]; while (true) { @@ -393,7 +393,7 @@ macro Lexer.unread(self, n) @private fn String! Lexer.parse_ident(&self) @private { DString str; - str.init_new(8, self.allocator); + str.new_init(8, self.allocator); while (true) { char! c = self.reader.read_byte(); @@ -492,7 +492,7 @@ struct TrieNode fn void Trie.init(&self, usz initial_capacity = 8, Allocator* using = mem::heap()) { *self = {}; - self.nodes.init_new(initial_capacity, .allocator = using); + self.nodes.new_init(initial_capacity, .allocator = using); self.nodes.push(TrieNode{}); } @@ -534,7 +534,7 @@ fn void! Trie.del(&self, char[] key) return; } TriePath path; - path.init_new(8, self.nodes.allocator); + path.new_init(8, self.nodes.allocator); defer path.free(); path.push(0); self.nodes[0].del(self, key, path)!; @@ -711,7 +711,7 @@ fn void test() @"$ct.std.io.ByteReader" = linkonce global %.introspect { i8 10, i64 0, ptr null, i64 24, i64 0, i64 2, [0 x i64] zeroinitializer }, align 8 @std.core.mem.thread_allocator = external thread_local global %"any*", align 8 - +; Function Attrs: define zeroext i8 @lexer_test.is_ident_char(i64 %0, i8 zeroext %1) #0 { entry: %eq = icmp eq i64 0, %0 @@ -745,7 +745,7 @@ or.phi: ; preds = %and.phi2, %and.phi ret i8 %6 } - +; Function Attrs: define i64 @lexer_test.lex_uint() #0 { entry: %tcases = alloca %"UintTest[]", align 8 @@ -757,85 +757,81 @@ entry: %error_var = alloca i64, align 8 %taddr = alloca %"any*", align 8 %kind = alloca i8, align 1 - %error_var6 = alloca i64, align 8 + %error_var8 = alloca i64, align 8 %retparam = alloca i8, align 1 store %"UintTest[]" zeroinitializer, ptr %tcases, align 8 - %0 = getelementptr inbounds %"UintTest[]", ptr %tcases, i32 0, i32 1 - %1 = load i64, ptr %0, align 8 - store i64 %1, ptr %.anon, align 8 + %ptradd = getelementptr inbounds i8, ptr %tcases, i64 8 + %0 = load i64, ptr %ptradd, align 8 + store i64 %0, ptr %.anon, align 8 store i64 0, ptr %.anon1, align 8 br label %loop.cond -loop.cond: ; preds = %noerr_block11, %entry - %2 = load i64, ptr %.anon1, align 8 - %3 = load i64, ptr %.anon, align 8 - %lt = icmp ult i64 %2, %3 +loop.cond: ; preds = %noerr_block13, %entry + %1 = load i64, ptr %.anon1, align 8 + %2 = load i64, ptr %.anon, align 8 + %lt = icmp ult i64 %1, %2 br i1 %lt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %4 = getelementptr inbounds %"UintTest[]", ptr %tcases, i32 0, i32 0 - %5 = load ptr, ptr %4, align 8 - %6 = load i64, ptr %.anon1, align 8 - %ptroffset = getelementptr inbounds %UintTest, ptr %5, i64 %6 + %3 = load ptr, ptr %tcases, align 8 + %4 = load i64, ptr %.anon1, align 8 + %ptroffset = getelementptr inbounds [24 x i8], ptr %3, i64 %4 call void @llvm.memcpy.p0.p0.i32(ptr align 8 %tc, ptr align 8 %ptroffset, i32 24, i1 false) call void @llvm.memset.p0.i64(ptr align 8 %br, i8 0, i64 24, i1 false) call void @llvm.memset.p0.i64(ptr align 8 %lex, i8 0, i64 128, i1 false) - %7 = getelementptr inbounds %UintTest, ptr %tc, i32 0, i32 0 - %8 = getelementptr inbounds %"char[]", ptr %7, i32 0, i32 0 - %lo = load ptr, ptr %8, align 8 - %9 = getelementptr inbounds %"char[]", ptr %7, i32 0, i32 1 - %hi = load i64, ptr %9, align 8 - %10 = call ptr @std.io.ByteReader.init(ptr %br, ptr %lo, i64 %hi) - %11 = insertvalue %"any*" undef, ptr %10, 0 - %12 = insertvalue %"any*" %11, i64 ptrtoint (ptr @"$ct.std.io.ByteReader" to i64), 1 - store %"any*" %12, ptr %taddr, align 8 - %13 = getelementptr inbounds { i64, ptr }, ptr %taddr, i32 0, i32 0 - %lo2 = load i64, ptr %13, align 8 - %14 = getelementptr inbounds { i64, ptr }, ptr %taddr, i32 0, i32 1 - %hi3 = load ptr, ptr %14, align 8 - %lo4 = load i64, ptr @std.core.mem.thread_allocator, align 8 - %hi5 = load ptr, ptr getelementptr inbounds ({ i64, ptr }, ptr @std.core.mem.thread_allocator, i32 0, i32 1), align 8 - %15 = call i64 @"lexer$lexer_test.Token$lexer_test.Comment$.Lexer.init"(ptr %lex, i64 %lo2, ptr %hi3, ptr @lexer_test.is_ident_char, i64 %lo4, ptr %hi5) - %not_err = icmp eq i64 %15, 0 - %16 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) - br i1 %16, label %after_check, label %assign_optional + %lo = load ptr, ptr %tc, align 8 + %ptradd2 = getelementptr inbounds i8, ptr %tc, i64 8 + %hi = load i64, ptr %ptradd2, align 8 + %5 = call ptr @std.io.ByteReader.init(ptr %br, ptr %lo, i64 %hi) + %6 = insertvalue %"any*" undef, ptr %5, 0 + %7 = insertvalue %"any*" %6, i64 ptrtoint (ptr @"$ct.std.io.ByteReader" to i64), 1 + store %"any*" %7, ptr %taddr, align 8 + %lo3 = load i64, ptr %taddr, align 8 + %ptradd4 = getelementptr inbounds i8, ptr %taddr, i64 8 + %hi5 = load ptr, ptr %ptradd4, align 8 + %lo6 = load i64, ptr @std.core.mem.thread_allocator, align 8 + %hi7 = load ptr, ptr getelementptr inbounds (i8, ptr @std.core.mem.thread_allocator, i64 8), align 8 + %8 = call i64 @"lexer$lexer_test.Token$lexer_test.Comment$.Lexer.init"(ptr %lex, i64 %lo3, ptr %hi5, ptr @lexer_test.is_ident_char, i64 %lo6, ptr %hi7) + %not_err = icmp eq i64 %8, 0 + %9 = call i1 @llvm.expect.i1(i1 %not_err, i1 true) + br i1 %9, label %after_check, label %assign_optional assign_optional: ; preds = %loop.body - store i64 %15, ptr %error_var, align 8 + store i64 %8, ptr %error_var, align 8 br label %guard_block after_check: ; preds = %loop.body br label %noerr_block guard_block: ; preds = %assign_optional - %17 = load i64, ptr %error_var, align 8 - ret i64 %17 + %10 = load i64, ptr %error_var, align 8 + ret i64 %10 noerr_block: ; preds = %after_check - %18 = call i64 @"lexer$lexer_test.Token$lexer_test.Comment$.Lexer.next"(ptr %retparam, ptr %lex) - %not_err7 = icmp eq i64 %18, 0 - %19 = call i1 @llvm.expect.i1(i1 %not_err7, i1 true) - br i1 %19, label %after_check9, label %assign_optional8 - -assign_optional8: ; preds = %noerr_block - store i64 %18, ptr %error_var6, align 8 - br label %guard_block10 - -after_check9: ; preds = %noerr_block - br label %noerr_block11 - -guard_block10: ; preds = %assign_optional8 - %20 = load i64, ptr %error_var6, align 8 - ret i64 %20 - -noerr_block11: ; preds = %after_check9 - %21 = load i8, ptr %retparam, align 1 - store i8 %21, ptr %kind, align 1 - %22 = load i8, ptr %kind, align 1 - %eq = icmp eq i8 %22, 1 + %11 = call i64 @"lexer$lexer_test.Token$lexer_test.Comment$.Lexer.next"(ptr %retparam, ptr %lex) + %not_err9 = icmp eq i64 %11, 0 + %12 = call i1 @llvm.expect.i1(i1 %not_err9, i1 true) + br i1 %12, label %after_check11, label %assign_optional10 + +assign_optional10: ; preds = %noerr_block + store i64 %11, ptr %error_var8, align 8 + br label %guard_block12 + +after_check11: ; preds = %noerr_block + br label %noerr_block13 + +guard_block12: ; preds = %assign_optional10 + %13 = load i64, ptr %error_var8, align 8 + ret i64 %13 + +noerr_block13: ; preds = %after_check11 + %14 = load i8, ptr %retparam, align 1 + store i8 %14, ptr %kind, align 1 + %15 = load i8, ptr %kind, align 1 + %eq = icmp eq i8 %15, 1 call void @llvm.assume(i1 %eq) - %23 = load i64, ptr %.anon1, align 8 - %add = add i64 %23, 1 + %16 = load i64, ptr %.anon1, align 8 + %add = add i64 %16, 1 store i64 %add, ptr %.anon1, align 8 br label %loop.cond diff --git a/test/test_suite/vector/gather_scatter.c3t b/test/test_suite/vector/gather_scatter.c3t index 74b174b16..6b229cbed 100644 --- a/test/test_suite/vector/gather_scatter.c3t +++ b/test/test_suite/vector/gather_scatter.c3t @@ -18,14 +18,14 @@ fn void main() /* #expect: foo.ll - %6 = load <2 x ptr>, ptr %ptrvec, align 16 - %7 = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %6, i32 4, <2 x i1> , <2 x i32> ) + %4 = load <2 x ptr>, ptr %ptrvec, align 16 + %5 = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %4, i32 4, <2 x i1> , <2 x i32> ) - %11 = load <2 x ptr>, ptr %ptrvec1, align 16 - %12 = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %11, i32 4, <2 x i1> , <2 x i32> ) + %9 = load <2 x ptr>, ptr %ptrvec1, align 16 + %10 = call <2 x i32> @llvm.masked.gather.v2i32.v2p0(<2 x ptr> %9, i32 4, <2 x i1> , <2 x i32> ) - %16 = load <2 x ptr>, ptr %ptrvec3, align 16 - call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> %16, i32 4, <2 x i1> ) + %14 = load <2 x ptr>, ptr %ptrvec3, align 16 + call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> %14, i32 4, <2 x i1> ) - %38 = load <2 x ptr>, ptr %ptrvec12, align 16 - call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> %38, i32 4, <2 x i1> ) + %26 = load <2 x ptr>, ptr %ptrvec20, align 16 + call void @llvm.masked.scatter.v2i32.v2p0(<2 x i32> , <2 x ptr> %26, i32 4, <2 x i1> ) diff --git a/test/test_suite/vector/vector_init_regression.c3t b/test/test_suite/vector/vector_init_regression.c3t index 639e49bc6..5e389ac21 100644 --- a/test/test_suite/vector/vector_init_regression.c3t +++ b/test/test_suite/vector/vector_init_regression.c3t @@ -95,8 +95,8 @@ entry: %b = alloca [4 x <4 x float>], align 16 %.anon = alloca i64, align 8 %v = alloca <4 x float>, align 16 - %.anon85 = alloca i64, align 8 - %v89 = alloca <4 x float>, align 16 + %.anon90 = alloca i64, align 8 + %v94 = alloca <4 x float>, align 16 store float 0x3FE921CAC0000000, ptr %radians, align 4 store <3 x float> , ptr %axis, align 16 %0 = load float, ptr %radians, align 4 @@ -115,302 +115,300 @@ entry: %9 = extractelement <3 x float> %8, i64 2 store float %9, ptr %z, align 4 call void @llvm.memset.p0.i64(ptr align 16 %a, i8 0, i64 64, i1 false) - %10 = getelementptr inbounds [4 x <4 x float>], ptr %a, i64 0, i64 0 - %11 = load float, ptr %cosr, align 4 + %10 = load float, ptr %cosr, align 4 + %11 = load float, ptr %x, align 4 %12 = load float, ptr %x, align 4 - %13 = load float, ptr %x, align 4 - %fmul = fmul reassoc arcp contract float %12, %13 - %14 = load float, ptr %cosr, align 4 - %fpfpext = fpext float %14 to double + %fmul = fmul reassoc arcp contract float %11, %12 + %13 = load float, ptr %cosr, align 4 + %fpfpext = fpext float %13 to double %fsub = fsub reassoc arcp contract double 1.000000e+00, %fpfpext %fpfptrunc = fptrunc double %fsub to float - %15 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul, float %fpfptrunc, float %11) - %16 = insertelement <4 x float> undef, float %15, i64 0 - %17 = load float, ptr %x, align 4 - %18 = load float, ptr %y, align 4 - %fmul1 = fmul reassoc arcp contract float %17, %18 - %19 = load float, ptr %cosr, align 4 - %fpfpext2 = fpext float %19 to double + %14 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul, float %fpfptrunc, float %10) + %15 = insertelement <4 x float> undef, float %14, i64 0 + %16 = load float, ptr %x, align 4 + %17 = load float, ptr %y, align 4 + %fmul1 = fmul reassoc arcp contract float %16, %17 + %18 = load float, ptr %cosr, align 4 + %fpfpext2 = fpext float %18 to double %fsub3 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext2 %fpfptrunc4 = fptrunc double %fsub3 to float - %20 = load float, ptr %z, align 4 - %21 = load float, ptr %sinr, align 4 - %fmul5 = fmul reassoc arcp contract float %20, %21 - %22 = fneg reassoc arcp contract float %fmul5 - %23 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul1, float %fpfptrunc4, float %22) - %24 = insertelement <4 x float> %16, float %23, i64 1 - %25 = load float, ptr %x, align 4 - %26 = load float, ptr %z, align 4 - %fmul6 = fmul reassoc arcp contract float %25, %26 - %27 = load float, ptr %cosr, align 4 - %fpfpext7 = fpext float %27 to double + %19 = load float, ptr %z, align 4 + %20 = load float, ptr %sinr, align 4 + %fmul5 = fmul reassoc arcp contract float %19, %20 + %21 = fneg reassoc arcp contract float %fmul5 + %22 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul1, float %fpfptrunc4, float %21) + %23 = insertelement <4 x float> %15, float %22, i64 1 + %24 = load float, ptr %x, align 4 + %25 = load float, ptr %z, align 4 + %fmul6 = fmul reassoc arcp contract float %24, %25 + %26 = load float, ptr %cosr, align 4 + %fpfpext7 = fpext float %26 to double %fsub8 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext7 %fpfptrunc9 = fptrunc double %fsub8 to float - %28 = load float, ptr %y, align 4 - %29 = load float, ptr %sinr, align 4 - %fmul10 = fmul reassoc arcp contract float %28, %29 - %30 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul6, float %fpfptrunc9, float %fmul10) - %31 = insertelement <4 x float> %24, float %30, i64 2 - %32 = insertelement <4 x float> %31, float 0.000000e+00, i64 3 - store <4 x float> %32, ptr %10, align 16 - %33 = getelementptr inbounds [4 x <4 x float>], ptr %a, i64 0, i64 1 - %34 = load float, ptr %y, align 4 - %35 = load float, ptr %x, align 4 - %fmul11 = fmul reassoc arcp contract float %34, %35 - %36 = load float, ptr %cosr, align 4 - %fpfpext12 = fpext float %36 to double + %27 = load float, ptr %y, align 4 + %28 = load float, ptr %sinr, align 4 + %fmul10 = fmul reassoc arcp contract float %27, %28 + %29 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul6, float %fpfptrunc9, float %fmul10) + %30 = insertelement <4 x float> %23, float %29, i64 2 + %31 = insertelement <4 x float> %30, float 0.000000e+00, i64 3 + store <4 x float> %31, ptr %a, align 16 + %ptradd = getelementptr inbounds i8, ptr %a, i64 16 + %32 = load float, ptr %y, align 4 + %33 = load float, ptr %x, align 4 + %fmul11 = fmul reassoc arcp contract float %32, %33 + %34 = load float, ptr %cosr, align 4 + %fpfpext12 = fpext float %34 to double %fsub13 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext12 %fpfptrunc14 = fptrunc double %fsub13 to float - %37 = load float, ptr %z, align 4 - %38 = load float, ptr %sinr, align 4 - %fmul15 = fmul reassoc arcp contract float %37, %38 - %39 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul11, float %fpfptrunc14, float %fmul15) - %40 = insertelement <4 x float> undef, float %39, i64 0 - %41 = load float, ptr %cosr, align 4 - %42 = load float, ptr %y, align 4 - %43 = load float, ptr %y, align 4 - %fmul16 = fmul reassoc arcp contract float %42, %43 - %44 = load float, ptr %cosr, align 4 - %fpfpext17 = fpext float %44 to double + %35 = load float, ptr %z, align 4 + %36 = load float, ptr %sinr, align 4 + %fmul15 = fmul reassoc arcp contract float %35, %36 + %37 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul11, float %fpfptrunc14, float %fmul15) + %38 = insertelement <4 x float> undef, float %37, i64 0 + %39 = load float, ptr %cosr, align 4 + %40 = load float, ptr %y, align 4 + %41 = load float, ptr %y, align 4 + %fmul16 = fmul reassoc arcp contract float %40, %41 + %42 = load float, ptr %cosr, align 4 + %fpfpext17 = fpext float %42 to double %fsub18 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext17 %fpfptrunc19 = fptrunc double %fsub18 to float - %45 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul16, float %fpfptrunc19, float %41) - %46 = insertelement <4 x float> %40, float %45, i64 1 - %47 = load float, ptr %y, align 4 - %48 = load float, ptr %z, align 4 - %fmul20 = fmul reassoc arcp contract float %47, %48 - %49 = load float, ptr %cosr, align 4 - %fpfpext21 = fpext float %49 to double + %43 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul16, float %fpfptrunc19, float %39) + %44 = insertelement <4 x float> %38, float %43, i64 1 + %45 = load float, ptr %y, align 4 + %46 = load float, ptr %z, align 4 + %fmul20 = fmul reassoc arcp contract float %45, %46 + %47 = load float, ptr %cosr, align 4 + %fpfpext21 = fpext float %47 to double %fsub22 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext21 %fpfptrunc23 = fptrunc double %fsub22 to float - %50 = load float, ptr %x, align 4 - %51 = load float, ptr %sinr, align 4 - %fmul24 = fmul reassoc arcp contract float %50, %51 - %52 = fneg reassoc arcp contract float %fmul24 - %53 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul20, float %fpfptrunc23, float %52) - %54 = insertelement <4 x float> %46, float %53, i64 2 - %55 = insertelement <4 x float> %54, float 0.000000e+00, i64 3 - store <4 x float> %55, ptr %33, align 16 - %56 = getelementptr inbounds [4 x <4 x float>], ptr %a, i64 0, i64 2 - %57 = load float, ptr %z, align 4 - %58 = load float, ptr %x, align 4 - %fmul25 = fmul reassoc arcp contract float %57, %58 - %59 = load float, ptr %cosr, align 4 - %fpfpext26 = fpext float %59 to double - %fsub27 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext26 - %fpfptrunc28 = fptrunc double %fsub27 to float - %60 = load float, ptr %y, align 4 - %61 = load float, ptr %sinr, align 4 - %fmul29 = fmul reassoc arcp contract float %60, %61 - %62 = fneg reassoc arcp contract float %fmul29 - %63 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul25, float %fpfptrunc28, float %62) - %64 = insertelement <4 x float> undef, float %63, i64 0 - %65 = load float, ptr %z, align 4 - %66 = load float, ptr %y, align 4 - %fmul30 = fmul reassoc arcp contract float %65, %66 - %67 = load float, ptr %cosr, align 4 - %fpfpext31 = fpext float %67 to double - %fsub32 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext31 - %fpfptrunc33 = fptrunc double %fsub32 to float - %68 = load float, ptr %x, align 4 - %69 = load float, ptr %sinr, align 4 - %fmul34 = fmul reassoc arcp contract float %68, %69 - %70 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul30, float %fpfptrunc33, float %fmul34) - %71 = insertelement <4 x float> %64, float %70, i64 1 + %48 = load float, ptr %x, align 4 + %49 = load float, ptr %sinr, align 4 + %fmul24 = fmul reassoc arcp contract float %48, %49 + %50 = fneg reassoc arcp contract float %fmul24 + %51 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul20, float %fpfptrunc23, float %50) + %52 = insertelement <4 x float> %44, float %51, i64 2 + %53 = insertelement <4 x float> %52, float 0.000000e+00, i64 3 + store <4 x float> %53, ptr %ptradd, align 16 + %ptradd25 = getelementptr inbounds i8, ptr %a, i64 32 + %54 = load float, ptr %z, align 4 + %55 = load float, ptr %x, align 4 + %fmul26 = fmul reassoc arcp contract float %54, %55 + %56 = load float, ptr %cosr, align 4 + %fpfpext27 = fpext float %56 to double + %fsub28 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext27 + %fpfptrunc29 = fptrunc double %fsub28 to float + %57 = load float, ptr %y, align 4 + %58 = load float, ptr %sinr, align 4 + %fmul30 = fmul reassoc arcp contract float %57, %58 + %59 = fneg reassoc arcp contract float %fmul30 + %60 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul26, float %fpfptrunc29, float %59) + %61 = insertelement <4 x float> undef, float %60, i64 0 + %62 = load float, ptr %z, align 4 + %63 = load float, ptr %y, align 4 + %fmul31 = fmul reassoc arcp contract float %62, %63 + %64 = load float, ptr %cosr, align 4 + %fpfpext32 = fpext float %64 to double + %fsub33 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext32 + %fpfptrunc34 = fptrunc double %fsub33 to float + %65 = load float, ptr %x, align 4 + %66 = load float, ptr %sinr, align 4 + %fmul35 = fmul reassoc arcp contract float %65, %66 + %67 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul31, float %fpfptrunc34, float %fmul35) + %68 = insertelement <4 x float> %61, float %67, i64 1 + %69 = load float, ptr %cosr, align 4 + %70 = load float, ptr %z, align 4 + %71 = load float, ptr %z, align 4 + %fmul36 = fmul reassoc arcp contract float %70, %71 %72 = load float, ptr %cosr, align 4 - %73 = load float, ptr %z, align 4 - %74 = load float, ptr %z, align 4 - %fmul35 = fmul reassoc arcp contract float %73, %74 - %75 = load float, ptr %cosr, align 4 - %fpfpext36 = fpext float %75 to double - %fsub37 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext36 - %fpfptrunc38 = fptrunc double %fsub37 to float - %76 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul35, float %fpfptrunc38, float %72) - %77 = insertelement <4 x float> %71, float %76, i64 2 - %78 = insertelement <4 x float> %77, float 0.000000e+00, i64 3 - store <4 x float> %78, ptr %56, align 16 - %79 = getelementptr inbounds [4 x <4 x float>], ptr %a, i64 0, i64 3 - store <4 x float> , ptr %79, align 16 - %80 = getelementptr inbounds [4 x <4 x float>], ptr %b, i64 0, i64 0 - %81 = load float, ptr %cosr, align 4 + %fpfpext37 = fpext float %72 to double + %fsub38 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext37 + %fpfptrunc39 = fptrunc double %fsub38 to float + %73 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul36, float %fpfptrunc39, float %69) + %74 = insertelement <4 x float> %68, float %73, i64 2 + %75 = insertelement <4 x float> %74, float 0.000000e+00, i64 3 + store <4 x float> %75, ptr %ptradd25, align 16 + %ptradd40 = getelementptr inbounds i8, ptr %a, i64 48 + store <4 x float> , ptr %ptradd40, align 16 + %76 = load float, ptr %cosr, align 4 + %77 = load float, ptr %x, align 4 + %78 = load float, ptr %x, align 4 + %fmul41 = fmul reassoc arcp contract float %77, %78 + %79 = load float, ptr %cosr, align 4 + %fpfpext42 = fpext float %79 to double + %fsub43 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext42 + %fpfptrunc44 = fptrunc double %fsub43 to float + %80 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul41, float %fpfptrunc44, float %76) + %81 = insertelement <4 x float> undef, float %80, i64 0 %82 = load float, ptr %x, align 4 - %83 = load float, ptr %x, align 4 - %fmul39 = fmul reassoc arcp contract float %82, %83 + %83 = load float, ptr %y, align 4 + %fmul45 = fmul reassoc arcp contract float %82, %83 %84 = load float, ptr %cosr, align 4 - %fpfpext40 = fpext float %84 to double - %fsub41 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext40 - %fpfptrunc42 = fptrunc double %fsub41 to float - %85 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul39, float %fpfptrunc42, float %81) - %86 = insertelement <4 x float> undef, float %85, i64 0 - %87 = load float, ptr %x, align 4 - %88 = load float, ptr %y, align 4 - %fmul43 = fmul reassoc arcp contract float %87, %88 - %89 = load float, ptr %cosr, align 4 - %fpfpext44 = fpext float %89 to double - %fsub45 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext44 - %fpfptrunc46 = fptrunc double %fsub45 to float - %90 = load float, ptr %z, align 4 - %91 = load float, ptr %sinr, align 4 - %fmul47 = fmul reassoc arcp contract float %90, %91 - %92 = fneg reassoc arcp contract float %fmul47 - %93 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul43, float %fpfptrunc46, float %92) - %94 = insertelement <4 x float> %86, float %93, i64 1 - %95 = load float, ptr %x, align 4 - %96 = load float, ptr %z, align 4 - %fmul48 = fmul reassoc arcp contract float %95, %96 - %97 = load float, ptr %cosr, align 4 - %fpfpext49 = fpext float %97 to double - %fsub50 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext49 - %fpfptrunc51 = fptrunc double %fsub50 to float + %fpfpext46 = fpext float %84 to double + %fsub47 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext46 + %fpfptrunc48 = fptrunc double %fsub47 to float + %85 = load float, ptr %z, align 4 + %86 = load float, ptr %sinr, align 4 + %fmul49 = fmul reassoc arcp contract float %85, %86 + %87 = fneg reassoc arcp contract float %fmul49 + %88 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul45, float %fpfptrunc48, float %87) + %89 = insertelement <4 x float> %81, float %88, i64 1 + %90 = load float, ptr %x, align 4 + %91 = load float, ptr %z, align 4 + %fmul50 = fmul reassoc arcp contract float %90, %91 + %92 = load float, ptr %cosr, align 4 + %fpfpext51 = fpext float %92 to double + %fsub52 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext51 + %fpfptrunc53 = fptrunc double %fsub52 to float + %93 = load float, ptr %y, align 4 + %94 = load float, ptr %sinr, align 4 + %fmul54 = fmul reassoc arcp contract float %93, %94 + %95 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul50, float %fpfptrunc53, float %fmul54) + %96 = insertelement <4 x float> %89, float %95, i64 2 + %97 = insertelement <4 x float> %96, float 0.000000e+00, i64 3 + store <4 x float> %97, ptr %b, align 16 + %ptradd55 = getelementptr inbounds i8, ptr %b, i64 16 %98 = load float, ptr %y, align 4 - %99 = load float, ptr %sinr, align 4 - %fmul52 = fmul reassoc arcp contract float %98, %99 - %100 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul48, float %fpfptrunc51, float %fmul52) - %101 = insertelement <4 x float> %94, float %100, i64 2 - %102 = insertelement <4 x float> %101, float 0.000000e+00, i64 3 - store <4 x float> %102, ptr %80, align 16 - %103 = getelementptr inbounds [4 x <4 x float>], ptr %b, i64 0, i64 1 - %104 = load float, ptr %y, align 4 - %105 = load float, ptr %x, align 4 - %fmul53 = fmul reassoc arcp contract float %104, %105 - %106 = load float, ptr %cosr, align 4 - %fpfpext54 = fpext float %106 to double - %fsub55 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext54 - %fpfptrunc56 = fptrunc double %fsub55 to float - %107 = load float, ptr %z, align 4 - %108 = load float, ptr %sinr, align 4 - %fmul57 = fmul reassoc arcp contract float %107, %108 - %109 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul53, float %fpfptrunc56, float %fmul57) - %110 = insertelement <4 x float> undef, float %109, i64 0 - %111 = load float, ptr %cosr, align 4 - %112 = load float, ptr %y, align 4 - %113 = load float, ptr %y, align 4 - %fmul58 = fmul reassoc arcp contract float %112, %113 - %114 = load float, ptr %cosr, align 4 - %fpfpext59 = fpext float %114 to double - %fsub60 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext59 - %fpfptrunc61 = fptrunc double %fsub60 to float - %115 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul58, float %fpfptrunc61, float %111) - %116 = insertelement <4 x float> %110, float %115, i64 1 - %117 = load float, ptr %y, align 4 - %118 = load float, ptr %z, align 4 - %fmul62 = fmul reassoc arcp contract float %117, %118 - %119 = load float, ptr %cosr, align 4 - %fpfpext63 = fpext float %119 to double - %fsub64 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext63 - %fpfptrunc65 = fptrunc double %fsub64 to float - %120 = load float, ptr %x, align 4 - %121 = load float, ptr %sinr, align 4 - %fmul66 = fmul reassoc arcp contract float %120, %121 - %122 = fneg reassoc arcp contract float %fmul66 - %123 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul62, float %fpfptrunc65, float %122) - %124 = insertelement <4 x float> %116, float %123, i64 2 - %125 = insertelement <4 x float> %124, float 0.000000e+00, i64 3 - store <4 x float> %125, ptr %103, align 16 - %126 = getelementptr inbounds [4 x <4 x float>], ptr %b, i64 0, i64 2 - %127 = load float, ptr %z, align 4 - %128 = load float, ptr %x, align 4 - %fmul67 = fmul reassoc arcp contract float %127, %128 - %129 = load float, ptr %cosr, align 4 - %fpfpext68 = fpext float %129 to double - %fsub69 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext68 - %fpfptrunc70 = fptrunc double %fsub69 to float - %130 = load float, ptr %y, align 4 - %131 = load float, ptr %sinr, align 4 - %fmul71 = fmul reassoc arcp contract float %130, %131 - %132 = fneg reassoc arcp contract float %fmul71 - %133 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul67, float %fpfptrunc70, float %132) - %134 = insertelement <4 x float> undef, float %133, i64 0 - %135 = load float, ptr %z, align 4 - %136 = load float, ptr %y, align 4 - %fmul72 = fmul reassoc arcp contract float %135, %136 - %137 = load float, ptr %cosr, align 4 - %fpfpext73 = fpext float %137 to double - %fsub74 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext73 - %fpfptrunc75 = fptrunc double %fsub74 to float - %138 = load float, ptr %x, align 4 - %139 = load float, ptr %sinr, align 4 - %fmul76 = fmul reassoc arcp contract float %138, %139 - %140 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul72, float %fpfptrunc75, float %fmul76) - %141 = insertelement <4 x float> %134, float %140, i64 1 - %142 = load float, ptr %cosr, align 4 - %143 = load float, ptr %z, align 4 - %144 = load float, ptr %z, align 4 - %fmul77 = fmul reassoc arcp contract float %143, %144 - %145 = load float, ptr %cosr, align 4 - %fpfpext78 = fpext float %145 to double - %fsub79 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext78 - %fpfptrunc80 = fptrunc double %fsub79 to float - %146 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul77, float %fpfptrunc80, float %142) - %147 = insertelement <4 x float> %141, float %146, i64 2 - %148 = insertelement <4 x float> %147, float 0.000000e+00, i64 3 - store <4 x float> %148, ptr %126, align 16 - %149 = getelementptr inbounds [4 x <4 x float>], ptr %b, i64 0, i64 3 - store <4 x float> , ptr %149, align 16 + %99 = load float, ptr %x, align 4 + %fmul56 = fmul reassoc arcp contract float %98, %99 + %100 = load float, ptr %cosr, align 4 + %fpfpext57 = fpext float %100 to double + %fsub58 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext57 + %fpfptrunc59 = fptrunc double %fsub58 to float + %101 = load float, ptr %z, align 4 + %102 = load float, ptr %sinr, align 4 + %fmul60 = fmul reassoc arcp contract float %101, %102 + %103 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul56, float %fpfptrunc59, float %fmul60) + %104 = insertelement <4 x float> undef, float %103, i64 0 + %105 = load float, ptr %cosr, align 4 + %106 = load float, ptr %y, align 4 + %107 = load float, ptr %y, align 4 + %fmul61 = fmul reassoc arcp contract float %106, %107 + %108 = load float, ptr %cosr, align 4 + %fpfpext62 = fpext float %108 to double + %fsub63 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext62 + %fpfptrunc64 = fptrunc double %fsub63 to float + %109 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul61, float %fpfptrunc64, float %105) + %110 = insertelement <4 x float> %104, float %109, i64 1 + %111 = load float, ptr %y, align 4 + %112 = load float, ptr %z, align 4 + %fmul65 = fmul reassoc arcp contract float %111, %112 + %113 = load float, ptr %cosr, align 4 + %fpfpext66 = fpext float %113 to double + %fsub67 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext66 + %fpfptrunc68 = fptrunc double %fsub67 to float + %114 = load float, ptr %x, align 4 + %115 = load float, ptr %sinr, align 4 + %fmul69 = fmul reassoc arcp contract float %114, %115 + %116 = fneg reassoc arcp contract float %fmul69 + %117 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul65, float %fpfptrunc68, float %116) + %118 = insertelement <4 x float> %110, float %117, i64 2 + %119 = insertelement <4 x float> %118, float 0.000000e+00, i64 3 + store <4 x float> %119, ptr %ptradd55, align 16 + %ptradd70 = getelementptr inbounds i8, ptr %b, i64 32 + %120 = load float, ptr %z, align 4 + %121 = load float, ptr %x, align 4 + %fmul71 = fmul reassoc arcp contract float %120, %121 + %122 = load float, ptr %cosr, align 4 + %fpfpext72 = fpext float %122 to double + %fsub73 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext72 + %fpfptrunc74 = fptrunc double %fsub73 to float + %123 = load float, ptr %y, align 4 + %124 = load float, ptr %sinr, align 4 + %fmul75 = fmul reassoc arcp contract float %123, %124 + %125 = fneg reassoc arcp contract float %fmul75 + %126 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul71, float %fpfptrunc74, float %125) + %127 = insertelement <4 x float> undef, float %126, i64 0 + %128 = load float, ptr %z, align 4 + %129 = load float, ptr %y, align 4 + %fmul76 = fmul reassoc arcp contract float %128, %129 + %130 = load float, ptr %cosr, align 4 + %fpfpext77 = fpext float %130 to double + %fsub78 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext77 + %fpfptrunc79 = fptrunc double %fsub78 to float + %131 = load float, ptr %x, align 4 + %132 = load float, ptr %sinr, align 4 + %fmul80 = fmul reassoc arcp contract float %131, %132 + %133 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul76, float %fpfptrunc79, float %fmul80) + %134 = insertelement <4 x float> %127, float %133, i64 1 + %135 = load float, ptr %cosr, align 4 + %136 = load float, ptr %z, align 4 + %137 = load float, ptr %z, align 4 + %fmul81 = fmul reassoc arcp contract float %136, %137 + %138 = load float, ptr %cosr, align 4 + %fpfpext82 = fpext float %138 to double + %fsub83 = fsub reassoc arcp contract double 1.000000e+00, %fpfpext82 + %fpfptrunc84 = fptrunc double %fsub83 to float + %139 = call reassoc arcp contract float @llvm.fmuladd.f32(float %fmul81, float %fpfptrunc84, float %135) + %140 = insertelement <4 x float> %134, float %139, i64 2 + %141 = insertelement <4 x float> %140, float 0.000000e+00, i64 3 + store <4 x float> %141, ptr %ptradd70, align 16 + %ptradd85 = getelementptr inbounds i8, ptr %b, i64 48 + store <4 x float> , ptr %ptradd85, align 16 store i64 0, ptr %.anon, align 8 br label %loop.cond loop.cond: ; preds = %loop.body, %entry - %150 = load i64, ptr %.anon, align 8 - %gt = icmp ugt i64 4, %150 + %142 = load i64, ptr %.anon, align 8 + %gt = icmp ugt i64 4, %142 br i1 %gt, label %loop.body, label %loop.exit loop.body: ; preds = %loop.cond - %151 = load i64, ptr %.anon, align 8 - %152 = getelementptr inbounds [4 x <4 x float>], ptr %a, i64 0, i64 %151 - %153 = load <4 x float>, ptr %152, align 16 - store <4 x float> %153, ptr %v, align 16 - %154 = load <4 x float>, ptr %v, align 16 - %155 = extractelement <4 x float> %154, i64 0 - %fpfpext81 = fpext float %155 to double - %156 = load <4 x float>, ptr %v, align 16 - %157 = extractelement <4 x float> %156, i64 1 - %fpfpext82 = fpext float %157 to double - %158 = load <4 x float>, ptr %v, align 16 - %159 = extractelement <4 x float> %158, i64 2 - %fpfpext83 = fpext float %159 to double - %160 = load <4 x float>, ptr %v, align 16 - %161 = extractelement <4 x float> %160, i64 3 - %fpfpext84 = fpext float %161 to double - %162 = call i32 (ptr, ...) @printf(ptr @.str, double %fpfpext81, double %fpfpext82, double %fpfpext83, double %fpfpext84) - %163 = load i64, ptr %.anon, align 8 - %add = add i64 %163, 1 + %143 = load i64, ptr %.anon, align 8 + %ptroffset = getelementptr inbounds [16 x i8], ptr %a, i64 %143 + %144 = load <4 x float>, ptr %ptroffset, align 16 + store <4 x float> %144, ptr %v, align 16 + %145 = load <4 x float>, ptr %v, align 16 + %146 = extractelement <4 x float> %145, i64 0 + %fpfpext86 = fpext float %146 to double + %147 = load <4 x float>, ptr %v, align 16 + %148 = extractelement <4 x float> %147, i64 1 + %fpfpext87 = fpext float %148 to double + %149 = load <4 x float>, ptr %v, align 16 + %150 = extractelement <4 x float> %149, i64 2 + %fpfpext88 = fpext float %150 to double + %151 = load <4 x float>, ptr %v, align 16 + %152 = extractelement <4 x float> %151, i64 3 + %fpfpext89 = fpext float %152 to double + %153 = call i32 (ptr, ...) @printf(ptr @.str, double %fpfpext86, double %fpfpext87, double %fpfpext88, double %fpfpext89) + %154 = load i64, ptr %.anon, align 8 + %add = add i64 %154, 1 store i64 %add, ptr %.anon, align 8 br label %loop.cond loop.exit: ; preds = %loop.cond - %164 = call i32 (ptr, ...) @printf(ptr @.str.1) - store i64 0, ptr %.anon85, align 8 - br label %loop.cond86 + %155 = call i32 (ptr, ...) @printf(ptr @.str.1) + store i64 0, ptr %.anon90, align 8 + br label %loop.cond91 -loop.cond86: ; preds = %loop.body88, %loop.exit - %165 = load i64, ptr %.anon85, align 8 - %gt87 = icmp ugt i64 4, %165 - br i1 %gt87, label %loop.body88, label %loop.exit95 +loop.cond91: ; preds = %loop.body93, %loop.exit + %156 = load i64, ptr %.anon90, align 8 + %gt92 = icmp ugt i64 4, %156 + br i1 %gt92, label %loop.body93, label %loop.exit101 -loop.body88: ; preds = %loop.cond86 - %166 = load i64, ptr %.anon85, align 8 - %167 = getelementptr inbounds [4 x <4 x float>], ptr %b, i64 0, i64 %166 - %168 = load <4 x float>, ptr %167, align 16 - store <4 x float> %168, ptr %v89, align 16 - %169 = load <4 x float>, ptr %v89, align 16 - %170 = extractelement <4 x float> %169, i64 0 - %fpfpext90 = fpext float %170 to double - %171 = load <4 x float>, ptr %v89, align 16 - %172 = extractelement <4 x float> %171, i64 1 - %fpfpext91 = fpext float %172 to double - %173 = load <4 x float>, ptr %v89, align 16 - %174 = extractelement <4 x float> %173, i64 2 - %fpfpext92 = fpext float %174 to double - %175 = load <4 x float>, ptr %v89, align 16 - %176 = extractelement <4 x float> %175, i64 3 - %fpfpext93 = fpext float %176 to double - %177 = call i32 (ptr, ...) @printf(ptr @.str.2, double %fpfpext90, double %fpfpext91, double %fpfpext92, double %fpfpext93) - %178 = load i64, ptr %.anon85, align 8 - %add94 = add i64 %178, 1 - store i64 %add94, ptr %.anon85, align 8 - br label %loop.cond86 +loop.body93: ; preds = %loop.cond91 + %157 = load i64, ptr %.anon90, align 8 + %ptroffset95 = getelementptr inbounds [16 x i8], ptr %b, i64 %157 + %158 = load <4 x float>, ptr %ptroffset95, align 16 + store <4 x float> %158, ptr %v94, align 16 + %159 = load <4 x float>, ptr %v94, align 16 + %160 = extractelement <4 x float> %159, i64 0 + %fpfpext96 = fpext float %160 to double + %161 = load <4 x float>, ptr %v94, align 16 + %162 = extractelement <4 x float> %161, i64 1 + %fpfpext97 = fpext float %162 to double + %163 = load <4 x float>, ptr %v94, align 16 + %164 = extractelement <4 x float> %163, i64 2 + %fpfpext98 = fpext float %164 to double + %165 = load <4 x float>, ptr %v94, align 16 + %166 = extractelement <4 x float> %165, i64 3 + %fpfpext99 = fpext float %166 to double + %167 = call i32 (ptr, ...) @printf(ptr @.str.2, double %fpfpext96, double %fpfpext97, double %fpfpext98, double %fpfpext99) + %168 = load i64, ptr %.anon90, align 8 + %add100 = add i64 %168, 1 + store i64 %add100, ptr %.anon90, align 8 + br label %loop.cond91 -loop.exit95: ; preds = %loop.cond86 +loop.exit101: ; preds = %loop.cond91 ret void } \ No newline at end of file diff --git a/test/test_suite/vector/vector_ops2.c3t b/test/test_suite/vector/vector_ops2.c3t index d5ec15a6a..c98b66e2f 100644 --- a/test/test_suite/vector/vector_ops2.c3t +++ b/test/test_suite/vector/vector_ops2.c3t @@ -40,15 +40,16 @@ entry: %4 = call <4 x float> @llvm.fabs.v4f32(<4 x float> %3) %5 = call float @llvm.vector.reduce.fmin.v4f32(<4 x float> %4) %zero = fcmp ueq float %5, 0.000000e+00 - br i1 %zero, label %panic, label %checkok - -panic: ; preds = %entry - %6 = load ptr, ptr @std.core.builtin.panic, align 8 - call void %6(ptr @.panic_msg, i64 17, ptr @.file, i64 14, ptr @.func, i64 5, i32 9) - unreachable + %6 = call i1 @llvm.expect.i1(i1 %zero, i1 false) + br i1 %6, label %panic, label %checkok checkok: ; preds = %entry %fdiv = fdiv <4 x float> %2, %3 store <4 x float> %fdiv, ptr %w, align 16 ret void + +panic: ; preds = %entry + %7 = load ptr, ptr @std.core.builtin.panic, align 8 + call void %7(ptr @.panic_msg, i64 17, ptr @.file, i64 14, ptr @.func, i64 5, i32 9) + unreachable } diff --git a/test/unit/stdlib/collections/bitset.c3 b/test/unit/stdlib/collections/bitset.c3 index 181138a42..323780d8c 100644 --- a/test/unit/stdlib/collections/bitset.c3 +++ b/test/unit/stdlib/collections/bitset.c3 @@ -24,7 +24,7 @@ fn void! set_get() assert(bs.cardinality() == 2); List found; - found.init_temp(); + found.temp_init(); foreach (i, x : bs) { switch (i) @@ -50,7 +50,7 @@ def GrowableBitSet = GrowableBitSet(); fn void! growable_set_get() { GrowableBitSet bs; - bs.init_temp(); + bs.temp_init(); assert(bs.cardinality() == 0, "Invalid cardinality"); assert(!bs.get(0), "Get was true"); @@ -68,7 +68,7 @@ fn void! growable_set_get() assert(bs.len() == 2001, "Len should be 2001"); List found; - found.init_temp(); + found.temp_init(); foreach (i, x : bs) { switch (i) diff --git a/test/unit/stdlib/collections/copy_map.c3 b/test/unit/stdlib/collections/copy_map.c3 index 3b1502a21..610948571 100644 --- a/test/unit/stdlib/collections/copy_map.c3 +++ b/test/unit/stdlib/collections/copy_map.c3 @@ -10,7 +10,7 @@ fn void! copy_map() @test mem::@scoped(&alloc) { HashMap() x; - x.init_new(); + x.new_init(); DString y; y.append("hello"); x.set(y.str_view(), 123); diff --git a/test/unit/stdlib/collections/map.c3 b/test/unit/stdlib/collections/map.c3 index d226d567e..c03c84f93 100644 --- a/test/unit/stdlib/collections/map.c3 +++ b/test/unit/stdlib/collections/map.c3 @@ -17,7 +17,7 @@ fn void map() { Map m; assert(!m.is_initialized()); - m.init_temp(); + m.temp_init(); assert(m.is_initialized()); assert(m.is_empty()); assert(m.len() == 0); @@ -41,7 +41,7 @@ fn void map() } List list; - list.init_temp(); + list.temp_init(); m.@each(;String key, usz value) { list.push({key, value}); diff --git a/test/unit/stdlib/io/bufferstream.c3 b/test/unit/stdlib/io/bufferstream.c3 index 3dd6b835d..bf818eb9f 100644 --- a/test/unit/stdlib/io/bufferstream.c3 +++ b/test/unit/stdlib/io/bufferstream.c3 @@ -27,7 +27,7 @@ fn void! readbuffer() reader_buf.init(&src, buf[..]); ByteWriter bw; - bw.init_temp(); + bw.temp_init(); usz n = io::copy_to(&reader_buf, &bw)!; @@ -39,7 +39,7 @@ fn void! readbuffer() fn void! writebuffer_large() { ByteWriter out; - out.init_temp(); + out.temp_init(); char[16] buf; WriteBuffer write_buf; write_buf.init(&out, buf[..]); @@ -56,7 +56,7 @@ fn void! writebuffer() ByteReader br; br.init(DATA); ByteWriter out; - out.init_temp(); + out.temp_init(); char[3] buf; WriteBuffer write_buf; write_buf.init(&out, buf[..]); diff --git a/test/unit/stdlib/io/bytebuffer.c3 b/test/unit/stdlib/io/bytebuffer.c3 index 1577848d8..88c4b505f 100644 --- a/test/unit/stdlib/io/bytebuffer.c3 +++ b/test/unit/stdlib/io/bytebuffer.c3 @@ -4,7 +4,7 @@ import std::io; fn void! write_read() { ByteBuffer buffer; - buffer.init_new(0)!; + buffer.new_init(0)!; buffer.write("hello")!; diff --git a/test/unit/stdlib/io/bytestream.c3 b/test/unit/stdlib/io/bytestream.c3 index b87e910fd..a375390b5 100644 --- a/test/unit/stdlib/io/bytestream.c3 +++ b/test/unit/stdlib/io/bytestream.c3 @@ -12,7 +12,7 @@ fn void! bytestream() usz len = s.read(&buffer)!; assert((String)buffer[:len] == "abc"); ByteWriter w; - w.init_new(); + w.new_init(); OutStream* ws = &w; ws.write("helloworld")!; assert(w.str_view() == "helloworld"); @@ -43,7 +43,7 @@ fn void! bytewriter_read_from() InStream* s = &r; ByteWriter bw; - bw.init_temp(); + bw.temp_init(); bw.read_from(s)!; assert(bw.str_view() == data); diff --git a/test/unit/stdlib/io/dstringstream.c3 b/test/unit/stdlib/io/dstringstream.c3 index 5eee234f6..8dadc019e 100644 --- a/test/unit/stdlib/io/dstringstream.c3 +++ b/test/unit/stdlib/io/dstringstream.c3 @@ -3,7 +3,7 @@ module std::io @test; fn void! test_writing() { DString foo; - foo.init_new(); + foo.new_init(); OutStream* s = &foo; s.write("hello")!!; s.write_byte('-')!!; diff --git a/test/unit/stdlib/io/varint.c3 b/test/unit/stdlib/io/varint.c3 index 8e4326924..180e6749b 100644 --- a/test/unit/stdlib/io/varint.c3 +++ b/test/unit/stdlib/io/varint.c3 @@ -4,7 +4,7 @@ import std::io; fn void! write_read() { ByteBuffer buf; - buf.init_temp(16)!; + buf.temp_init(16)!; usz n; uint x; uint y; @@ -45,7 +45,7 @@ fn void! samples() foreach (tc : tcases) { ByteWriter bw; - bw.init_temp(); + bw.temp_init(); usz n = io::write_varint(&bw, tc.in)!; assert(n == tc.bytes.len, "got %d; want %d", n, tc.bytes.len); char[] bytes = bw.bytes[:bw.index]; diff --git a/test/unit/stdlib/sort/quicksort.c3 b/test/unit/stdlib/sort/quicksort.c3 index 63108690c..c4ae10c10 100644 --- a/test/unit/stdlib/sort/quicksort.c3 +++ b/test/unit/stdlib/sort/quicksort.c3 @@ -76,7 +76,7 @@ def List = List(); fn void quicksort_list() { List list; - list.init_temp(); + list.temp_init(); list.add_array({ 2, 1, 3}); sort::quicksort(list, &sort::cmp_int_value); assert(check::int_sort(list.array_view()));