Displaying 20 results from an estimated 600 matches similar to: "[LLVMdev] Return Type of Call Function with nested bitcast"
2012 Jul 17
2
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
OK, at our end the following workaround seems to be sufficient:
// Check if function is called (needs -instcombine
pass).
Function* callee = call->getCalledFunction();
if (!callee)
{
// Could be also a function called inside a bitcast.
// So try to extract function
2012 Jul 17
0
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Hi Dmitry, it would be neater to use stripPointerCasts.
Ciao, Duncan.
> OK, at our end the following workaround seems to be sufficient:
>
> // Check if function is called (needs -instcombine pass).
> Function* callee = call->getCalledFunction();
> if (!callee)
> {
>
2012 Jul 17
1
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Thanks, Duncan, makes sense! I suppose you meant something like this:
Function* callee = dyn_cast<Function>(
call->getCalledValue()->stripPointerCasts());
if (!callee) continue;
- D.
2012/7/17 Duncan Sands <baldrick at free.fr>
> Hi Dmitry, it would be neater to use stripPointerCasts.
>
> Ciao, Duncan.
2019 Mar 12
3
Help with bitcast instruction
Hi Tim,
I'm still struggling on the instruction:
call void bitcast (void (%struct.png_struct_def.68*, i8*, i8*
(%struct.png_struct_def.68*, i64)*, void (%struct.png_struct_def.68*,
i8*)*)* @png_set_mem_fn to void (%struct.png_struct_def*, i8*, i8*
(%struct.png_struct_def*, i64)*, void (%struct.png_struct_def*,
i8*)*)*)(%struct.png_struct_def* %create_struct, i8* %mem_ptr, i8*
2015 Sep 08
2
CallInst::getCalledFunction returns null?
I was wondering if someone could explain why CallInst::getCalledFunc behaves
the way it does.
For simple, direct call instructions in my IR, that method behaves just as
one would expect.
However, for instructions like this:
%25 = call i32 (%struct._IO_FILE*, ...)* bitcast (i32 (...)* @close to i32
> (%struct._IO_FILE*, ...)*)(%struct._IO_FILE* %24), !dbg !695
getCalledFunc returns null.
I
2018 Sep 12
2
CallSiteBase::getCalledFunction and non-trivial calls
The immediate change I have in mind is in CallGraph; our implementation
of LowerCall in AMDGPU currently relies on the the callee arguments
being lowered before the call is lowered, and we simply do not support
indirect calls. However, we should be able to support these bitcast
calls, as they are effectively direct for our purposes, but the
CallGraph does not seem to consider them (it uses
2012 Nov 10
2
[LLVMdev] Inlining bitcast functions...
Spoke too soon... running the inst combine pass does seem to resolve the linker/inlining issue. But the resulting code fails to run correctly. I was expecting the same result that I get when running with unstripped modules, that is passing test runs. When it still failed, I guessed the failure mode to be the same, but it isn't.
Not sure WHAT to make of this...
2012 Nov 09
2
[LLVMdev] Inlining bitcast functions...
I've got a call instruction:
call void bitcast (void (%4 addrspace(1)*, <2 x i32>, <4 x float>)* @_Z12write_imagefPU3AS110_image2d_tDv2_iDv4_f to void (%9 addrspace(1)*, <2 x i32>, <4 x float>)*)(%9 addrspace(1)* %dstimg, <2 x i32> %28, <4 x float> %26) nounwind
%4 and %9 are both (stripped) opaque structs.
InlineFunction() does not inline this because
2012 Nov 09
0
[LLVMdev] Inlining bitcast functions...
On Fri, Nov 9, 2012 at 3:25 PM, Relph, Richard <Richard.Relph at amd.com> wrote:
> I've got a call instruction:
> call void bitcast (void (%4 addrspace(1)*, <2 x i32>, <4 x float>)* @_Z12write_imagefPU3AS110_image2d_tDv2_iDv4_f to void (%9 addrspace(1)*, <2 x i32>, <4 x float>)*)(%9 addrspace(1)* %dstimg, <2 x i32> %28, <4 x float> %26)
2015 Nov 13
5
How to efficiently extract the calledFunction from a complex CallInst?
Hi all,
Usually if we want to get the called Function we can directly use
CallInst->getCalledFunction(), however, today i encounter an unusual
CallInst as follows:
%call11 = call double (...)* bitcast (double ()* @quantum_frand to double
(...)*)()
the original C source involve type cast:
float u,v;
extern double quantum_frand();
u = 2 * quantum_frand() - 1;
v = 2 * quantum_frand() -
2013 Mar 11
2
[LLVMdev] How to detect all free() calls
Hi,
I'm trying to write a pass to detect all free()/delete() call instructions in LLVM IR.The method is as follows.
First I find Call Instructions: CallInst *CI=dyn_cast<CallInst>(&*i);
then see if the Function name matches:
name=CI->getCalledFunction()->getName(); if(name=="_ZdlPv"||name=="_ZdaPv"||name=="free")
2013 Mar 11
0
[LLVMdev] How to detect all free() calls
if you don't include stdlib.h, where free() is declared, you'll simply
get a default C function signature:
int free(...);
On Mon, Mar 11, 2013 at 1:56 AM, Jane <270611649 at qq.com> wrote:
> Thanks. isFreeCall() works well but for
> %call2 = call i32 bitcast (i32 (...)* @free to i32 (i8*)*)(i8* %call1)
> nounwind, !dbg !16
> So I tried to figure out when the above
2018 Sep 12
2
CallSiteBase::getCalledFunction and non-trivial calls
How does LLVM define "indirect call"? The documentation of
CallSiteBase::getCalledFunction claims it returns null for indirect
calls, but in practice it seems to return null for "non-trivial" calls.
For example, it returns null for a direct call to a bitcast'ed function:
%0 = call void bitcast (void (%struct.foo *)* @func to void (%struct.bar
*)*)(%struct.bar *qux)
By
2012 Jul 17
0
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
Hi Anton,
On 17/07/12 15:35, Anton Korobeynikov wrote:
>> actually there is a different fix, which is to not pay any attention to GCC
>> function types when generating calls (and function prototypes), and instead
>> do everything by querying GCC's CUMULATIVE_ARGS.
> I tried to do this during llvm-gcc times and it turned out that there
> might be different calls with
2016 Dec 15
1
How to get the value for casting in a bitcast instruction more efficiently?
Hi everyone,
This is a simple question but is there an efficient way to get the
value directly from a bitcast instruction?
<result> = bitcast <ty> <value> to <ty2>
For example, if i have
MemAddr
...
0x3d61238 %key = alloca [16 x i8], align 16
0x3d612a8 %plain_text = alloca [64 x i8], align 16
0x3d61318 %key1 = bitcast [16 x i8]* %key to i8*
...
The way i am using
2020 Jan 15
4
Finding callees of a function
I searched the doxygen documentation and could not find a solution to my
task:
In a ModulePass running at EP_OptimizerLast, if I have a function F like in:
bool Foo:runOnModule(Module &M) {
LLVMContext &C = M.getContext();
for (auto &F : M) {
// magic here
if I want to know from which function (callee) each function is called -
how can I do this?
(so that I e.g. have
2012 Jul 17
2
[LLVMdev] [DragonEgg] Why Fortran's "call flush()" is converted to "call void bitcast (void (...)* @_gfortran_flush_i4 to void (i8*)*)(i8* null) nounwind" ?
> actually there is a different fix, which is to not pay any attention to GCC
> function types when generating calls (and function prototypes), and instead
> do everything by querying GCC's CUMULATIVE_ARGS.
I tried to do this during llvm-gcc times and it turned out that there
might be different calls with different signatures in single module
e.g. function with N arguments is called
2013 Mar 11
2
[LLVMdev] How to detect all free() calls
Thanks. isFreeCall() works well but for
%call2 = call i32 bitcast (i32 (...)* @free to i32 (i8*)*)(i8* %call1) nounwind, !dbg !16
So I tried to figure out when the above instruction occurred.
When <stdlib.h> is included, free(buf2R1); turn into call void @free(i8* %call1) nounwind, !dbg !16
when I forget to include <stdlib.h>, free(buf2R1); turn into %call2 = call i32 bitcast (i32
2018 Dec 12
2
The bit pattern after stripPointerCasts()
Hi,
in a recent review [0], Florian Hahn helped me to realize something that
was rather surprising to me:
The widely popular and very useful function
llvm::Value::stripPointerCasts() can return a value with a different
bit pattern than the input.
Now, I think this should not be the case but I want the hear other
opinions. Before I go on, please not that there is at least one location
in
2018 Dec 14
2
The bit pattern after stripPointerCasts()
> On Dec 14, 2018, at 2:44 PM, Finkel, Hal J. <hfinkel at anl.gov> wrote:
>
> Do you have an opinion on which should be the default?
>
> -Hal
>
>
Not particularly. The current name sounds to me like it would strip any casts it possibly can. Maybe most uses should now be converted to a newly named stripTrivialPointerCasts?
-Matt
-------------- next part