search for: extractvalu

Displaying 20 results from an estimated 211 matches for "extractvalu".

Did you mean: extractvalue
2013 Mar 30
2
[LLVMdev] Missed optimisation opportunities?
...mantics for primitive values. Similar to the values in a database table, any value could be null, even for non-pointer types. For example a boolean variable could be true, false, or null. To model this behaviour, I'm passing an {i1, [type]} around for every numeric type. And using insertvalue / extractvalue all over the place. So when compiling this simple CS example; function long fib (long al_x) long ll_i=0, ll_ret=0, ll_last=0, ll_last2=1 if isnull(al_x) then return al_x end if ll_i=1 do while ll_i<=al_x ll_ret=ll_last+ll_last2 ll_last2=ll_last ll_last=ll_ret ll_i++ loop...
2011 Dec 14
2
[LLVMdev] extractvalue and insertvalue on vector types
Hi, I'm working with some hand-written LLVM IR which llvm-as doesn't like, giving me the error "Invalid indices for extractvalue". However, as far as I can tell, the code is valid according to the Language Reference Manual. A cut-down example of the kind of code in question is: %struct.s = type {i32,i32,<2 x i32>} define void @entry(i32* %out) { %1 = extractvalue %struct.s {i32 1, i32 2, <2 x i32> <...
2017 Jan 02
2
Indices for extractvalue and insertvalue
Hi Can someone explain to me why we cant use uint64_t for extractvalue and insertvalue indices, while GEP on arrays can have indices of any integer type. Basically if I load an array with UINT_MAX+O (O>=2) elements, I can not extract its last element. Given this restriction I feel we have a bug here (uint64_t is passed as a unsigned). This cant happen because of...
2011 Dec 14
0
[LLVMdev] extractvalue and insertvalue on vector types
...gt; If I change the code such that the structure is defined with a > 2-element array instead of a 2-element vector: > %struct.s = type {i32,i32,[2 x i32]} > then llvm-as does not report an error, hence why I believe the problem > is specific to accessing vector components. correct, extractvalue doesn't work on vectors, you need to use to use extractelement for them. > According to the Language Reference Manual, I should be able to access > vector components with extractvalue: > > "The 'extractvalue' instruction extracts the value of a member field > from...
2010 Jul 13
1
[LLVMdev] const indices of extractvalue
Hi, The 'extractvalue' and 'insertvalue' instructions only allow constant indices. If I have an array with variable indices, I need to store it into memory, and then load its sub-elements via GEP. Why could 'extractvalue' not support variable indices like GEP? In general, in which case should sour...
2009 Feb 19
1
[LLVMdev] Improving performance with optimization passes
...wrong with the way you're using optimization passes. > The ideal result is probably: It is indeed so: ./opt -std-compile-opts test.bc | ./llvm-dis ; ModuleID = '<stdin>' define fastcc i32 @zsqr({ double, double }* nocapture, { double, double }) nounwind { entry: %2 = extractvalue { double, double } %1, 0 ; <double> [#uses=1] %3 = extractvalue { double, double } %1, 0 ; <double> [#uses=1] %4 = mul double %2, %3 ; <double> [#uses=1] %5 = extractvalue { double, double } %1, 1 ; <double> [#uses=1] %6 = extractvalue { double, double } %1, 1 ; &l...
2012 Dec 30
2
[LLVMdev] alignment issue, getting corrupt double values
I'm having an issue where a certain set of types and insert/extractvalue are producing the incorrect values. It appears as though extractvalue getting my sub-structure is not getting the correct data. I have these types: %outer = type { i32, %inner, i1 } %inner = type { double, i32 } The trouble is that when I have a value of type %outer then proceed to extract the...
2020 Apr 12
2
Optimization generate super long function definition
...instead. consider the store line: store [500 x i32] %x, [500 x i32]* %x. once I pass this function to opt -O1 -S --verify --verify-each, it generates code like this: define i32 @gl.qi([500 x i32] %x, i32 %i) local_unnamed_addr { entry: %0 = alloca [500 x i32], align 4 %x.fca.0.extract = extractvalue [500 x i32] %x, 0 %x.fca.1.extract = extractvalue [500 x i32] %x, 1 %x.fca.2.extract = extractvalue [500 x i32] %x, 2 %x.fca.3.extract = extractvalue [500 x i32] %x, 3 %x.fca.4.extract = extractvalue [500 x i32] %x, 4 %x.fca.5.extract = extractvalue [500 x i32] %x, 5 until 500. I put t...
2019 Jun 27
5
[RFC] ASM Goto With Output Constraints
...<https://llvm.org/docs/LangRef.html#call-instruction>) > allows return values. Since there can potentially be zero to many output > constraints, callbr would now return an aggregate which contains an > element for each output constraint. These values would then be extracted > via extractvalue. With our proposal, the above C example will be > converted to LLVM IR like this: > > define i32 @vogon(i32 %a, i32 %b) { > entry: > %0 = callbr { i32, i32 } asm sideeffect "poetry $0, $1", "=r,=r,X" > (i8* blockaddress(@vogon, %error)) >...
2014 Apr 26
3
[LLVMdev] Proposal: add intrinsics for safe division
...to be useful for the Language/ISA Matrix that LLVMers care about. At canonical IR level, the intrinsic is useful by eliminating control flow merges and representing divide-by-zero and/or signed overflow in a canonical form: %res = call {i32, i1} @llvm.safe.sdiv.i32(i32 %a, i32 %b) %bit = extractvalue {i32, i1} %res, 1 br i1 %bit, label %trap, label %continue trap: call ... unreachable continue: %div = extractvalue {i32, i1} %res, 0 The original proposal fails to achieve this because the common case of Java/Go would require a check in the slow-path to differentiate divide-by-z...
2010 May 19
2
[LLVMdev] Intrinsics and dead instruction/code elimination
...ple, lets consider the simple case of the llvm.*.with.overflow.* intrinsics. If I have some sequence (> 1) of llvm.*.with.overflow.* intrinsics, as in the form of: @global = global i32 0 define void @fun() { entry: %res1 = call {i32, i1} @llvm.*.with.overflow.i32(i32 %a, i32 %b) %sum1 = extractvalue {i32, i1} %res, 0 %obit1 = extractvalue {i32, i1} %res, 1 store i32 %obit1, i32* @global ... %res2 = call {i32, i1} @llvm.*.with.overflow.i32(i32 %a, i32 %b) %sum2 = extractvalue {i32, i1} %res, 0 %obit2 = extractvalue {i32, i1} %res, 1 store i32 %obit2, i32* @global } then I assume...
2019 Jul 02
2
RFC: Complex in LLVM
...lue >> declare float @llvm.creal.c32(c32 %Val) >> declare double @llvm.creal.c64(c64 %Val) > > What are your plans for the reverse? I assume we don't want the only > way to materialize a complex to be via memory so an insertvalue > equivalent (or maybe using insertvalue/extractvalue directly?) and a > literal value would probably be useful. Good points. Originally I put the creal/cimag intrinsics in the proposal when the layout of the complex type was left unspecified. After internal feedback, I changed it to an explicitly-specified layout (real followed by imaginary)....
2008 Jun 02
2
[LLVMdev] Plans considering first class structs and multiple return values
...be a bit easier. > Can you give some background about what kinds of things you're thinking > about for this? For example, when I have a function returning {i32, i32} and I want to add another i32 to that. If this was a function that simply returns two i32 values, any caller will only use extractvalue on the result to get the seperate values (since the struct as a whole has no meaning). In this case, I can make the function return {i32, i32, i32}, add an extra extractvalue in each caller and be done. If, on the other hand, the struct currently returns a complex number, for example (or any othe...
2012 Aug 22
1
[LLVMdev] RFC: optimizing integer overflow checks
...rn malloc(bytes); } $ clang -emit-llvm -S -o - t.c | opt -S -mem2reg -simplifycfg -overflow-idiom -simplifycfg -sink -overflow-combine -adce define i8* @malloc_array_1(i64 %n, i64 %size) nounwind uwtable ssp { entry: %0 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %n, i64 %size) %cmp = extractvalue { i64, i1 } %0, 1 br i1 %cmp, label %return, label %if.end if.end: ; preds = %entry %mul = extractvalue { i64, i1 } %0, 0 %call = call i8* @malloc(i64 %mul) br label %return return: ; preds = %entry, %if....
2012 Dec 30
0
[LLVMdev] alignment issue, getting corrupt double values
...o saw this issue before. Llvm seems have trouble returning general struct values from functions. One easy workaround is to use packed struct type. Hope this helps. -Peng On Sunday, December 30, 2012, edA-qa mort-ora-y wrote: > I'm having an issue where a certain set of types and insert/extractvalue > are producing the incorrect values. It appears as though extractvalue > getting my sub-structure is not getting the correct data. > > I have these types: > > %outer = type { i32, %inner, i1 } > %inner = type { double, i32 } > > The trouble is that when I have a value o...
2019 Jun 27
1
[RFC] ASM Goto With Output Constraints
....org/docs/LangRef.html#call-instruction>) >> allows return values. Since there can potentially be zero to many output >> constraints, callbr would now return an aggregate which contains an >> element for each output constraint. These values would then be extracted >> via extractvalue. With our proposal, the above C example will be >> converted to LLVM IR like this: >> >> define i32 @vogon(i32 %a, i32 %b) { >> entry: >> %0 = callbr { i32, i32 } asm sideeffect "poetry $0, $1", "=r,=r,X" >> (i8* blockaddress(@vogon,...
2014 Apr 26
2
[LLVMdev] Proposal: add intrinsics for safe division
...> corresponding IR with use of the intrinsics (here I omit types for > conciseness, assuming result type of the safe.sdiv intrinsic being {i32, > i1, i1}) : > > *** C/C-like *** > %div = sdiv %x, %y > > *** Java, Go *** > %divr = call %safe.sdiv(%x, %y) > %div = extractvalue %divr, 0 > %divbyzero_bit = extractvalue %divr, 1 > br i1 %divbyzero_bit, label %throw, label %normal > > *** JavaScript, with "|0" *** > %divr = call %safe.sdiv(%x, %y) > %div = extractvalue %divr, 0 > > *** JavaScript without "|0", Ruby and may...
2015 Mar 26
4
[LLVMdev] `llvm.$op.with.overflow`, InstCombine and ScalarEvolution
...dx, %sum call void @side_effect(i1 %to.optimize) %c = icmp ule i8 %idx.inc, %sum br i1 %c, label %loop, label %exit exit: ret void } ``` This happens because `-instcombine` does the following tranform: ``` entry: %uadd = call { i8, i1 } @llvm.uadd.with.overflow.i8(i8 %x, i8 %y) %0 = extractvalue { i8, i1 } %uadd, 0 %e = extractvalue { i8, i1 } %uadd, 1 br i1 %e, label %exit, label %loop.preheader ``` and ScalarEvolution can no longer see through the `extractvalue` of the call to `llvm.uadd.with.overflow.i8`. The right way to fix this depends on the intended purpose of the `llvm.$op....
2010 May 19
0
[LLVMdev] Intrinsics and dead instruction/code elimination
...llvm.*.with.overflow.* intrinsics. > > If I have some sequence (> 1) of llvm.*.with.overflow.* intrinsics, as in the form of: > > @global = global i32 0 > > define void @fun() { > entry: > %res1 = call {i32, i1} @llvm.*.with.overflow.i32(i32 %a, i32 %b) > %sum1 = extractvalue {i32, i1} %res, 0 > %obit1 = extractvalue {i32, i1} %res, 1 > store i32 %obit1, i32* @global > ... > %res2 = call {i32, i1} @llvm.*.with.overflow.i32(i32 %a, i32 %b) > %sum2 = extractvalue {i32, i1} %res, 0 > %obit2 = extractvalue {i32, i1} %res, 1 > store i32 %obit2, i...
2009 Nov 20
2
[LLVMdev] llc barfing
...ls? Here's the IR of my relevant functions: define fastcc i8* @"visit_array_aux<`Reference>"(%0, i32) { entry: %2 = load i32* @shadow_stack_depth ; <i32> [#uses=0] br label %start start: ; preds = %entry %3 = extractvalue %0 %0, 1 ; <i32> [#uses=1] %4 = icmp eq i32 %1, %3 ; <i1> [#uses=1] br i1 %4, label %pass, label %fail fail: ; preds = %start %5 = icmp sge i32 %1, 0 ; <i1> [#u...