Displaying 20 results from an estimated 300 matches similar to: "Fwd: I cannot change value of global variable in LLVM IR using IRBuilder"
2020 Jun 03
2
Fwd: I cannot change value of global variable in LLVM IR using IRBuilder
I don't think it's the same problem as you described. By printing I meant
calling printf function and passing my global variable as one of the
arguments.
My code:
Instruction* InstructionVisitor::incrementGlobalKey(Instruction* I) {
IRBuilder<> Builder(I->getContext());
Builder.SetInsertPoint(I->getNextNode());
GlobalVariable* key =
2013 Apr 07
1
[LLVMdev] How to get the Instruction where one function use the global variable.
Hi, all
I try to get the Instructions where one function use the global variable.
for (llvm::Module::global_iterator gvar_iter = M.global_begin(); gvar_iter != M.global_end(); gvar_iter++)
{
llvm::GlobalVariable *gvar = &*gvar_iter;
llvm::errs() << "const global var: " << gvar->getName() << "\n";
for (
2012 Nov 09
2
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hi Dmitry,
> I'm attaching a patch that should fix the issue mentioned above. It
> simply makes the same check seen in the same file for global
> variables:
>
> emitPTXAddressSpace(PTy->getAddressSpace(), O);
> if (GVar->getAlignment() == 0)
> O << " .align " << (int) TD->getPrefTypeAlignment(ETy);
> else
> O
2012 Nov 09
0
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hi Duncan,
You're right, global variables use preferred alignment. And - yes,
preferred alignment in this case is bigger: 8 instead of 4. NVIDIA's
prop. compiler gives 4. However, since CUDA 5.0 ptx modules are
linkable with each other, I think alignments for externally visible
functions and data should all follow ABI rules.
Is there a guide on making tests? I have ~5 pending patches
2013 Mar 05
4
[LLVMdev] Convert C variable to LLVM IR Variable
Hi everyone,
I am doing some work with LLVM IR, I need to use LLVM IR to do operation
on C variables.
Code emission is done by LLVM JIT.
That variable is C thread local , for example
__thread int* gvar;
I think some methods to convert that variable to LLVM IR,
(1) use external function
I know LLVM IR is able to call an external function, so I can write codes
that look like:
int* load()
2012 Nov 09
3
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hi Dmitry,
> You're right, global variables use preferred alignment. And - yes,
> preferred alignment in this case is bigger: 8 instead of 4. NVIDIA's
> prop. compiler gives 4. However, since CUDA 5.0 ptx modules are
> linkable with each other, I think alignments for externally visible
> functions and data should all follow ABI rules.
giving it an alignment of 8 does
2012 Nov 09
0
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Test cases exist under test/CodeGen/NVPTX (name changed in May). Now that
I'm back at NVIDIA, I'm going to be running through the bugzilla issues
(thanks Dmitry for the reports!). I have practically the exact same patch
here in my queue. :)
In this case, I would prefer ABI alignment for compatibility with the
vendor compiler. It should work either way, but I do need to audit the
2012 Nov 09
0
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Dear all,
I'm attaching a patch that should fix the issue mentioned above. It
simply makes the same check seen in the same file for global
variables:
emitPTXAddressSpace(PTy->getAddressSpace(), O);
if (GVar->getAlignment() == 0)
O << " .align " << (int) TD->getPrefTypeAlignment(ETy);
else
O << " .align " <<
2010 May 12
2
Reading R code help--Beginner
Hi, I am brand new to R and not familiar with the language, though I
have been reading the manuals and making some slow going progress. I am
working with some source code from a Global Vector Auto -Regressive
program written by Ranier Puhr from the R-forge group. I need help
interpreting the processes of the following code.
I am going to
post in parts since it's pretty long:
GVAR
2015 Jun 18
3
[LLVMdev] problem with replacing an instruction
I am trying to change this
define void @main(float* noalias %arg0, float* noalias %arg1, float*
noalias %arg2) {
entrypoint:
%0 = bitcast float* %arg1 to <4 x float>*
intothis
define void @main(float* noalias %arg0, float* noalias %arg1, float*
noalias %arg2) {
entrypoint:
%0 = getelementptr float* %arg1, i64 0
%1 = bitcast float* %0 to <4 x float>*
I must be close but
2012 Oct 02
0
[LLVMdev] [RFC] OpenMP Representation in LLVM IR
Not to distract, but the word, `procedurization' is not an English word.
It's just leaping out at me when it is either procedure(s) (noun) or
proceduralize (verb). Even processes would make sense. I couldn't help
myself because the word was distracting.
- Marc
P.S. Not that my vote counts, but I'm more in the camp of Hal whose
approach to tackling the parallelization
2007 Sep 22
4
[LLVMdev] RFC: Patch
Hi all,
I have a patch that would potentially help Objective-C 2. In the
"make_decl_llvm()" in llvm-backend.cpp, there is code to search
through the already generated global variables. Objective-C goes
through this code twice with the same identifier. The first time, is
to create meta-data for a "property". The second time is to add a
reference to that property into the
2017 Oct 14
2
Bug in replaceUsesOfWith: does not keep addrspace consistent in GEP
Hello,
Calling `replaceUsesOfWith` with a value in a different addrspace does not
keep the addrspace of a GEP consistent. Is this known? Is this a bug or
expected behaviour?
Minimal counterexample link
<https://gist.github.com/bollu/152ba5e1c20c03c7fc6d8c7b23ba828f>
Reproduced here:
#include <iostream>
#include "llvm/ADT/APFloat.h"
#include
2013 Dec 26
2
[LLVMdev] Arguments to IRBuilder CreateCall function
Hi,
I need to pass some arguments to CreateCall function (as Value *).
For example, I need to pass a 64 bit integer (with a value I calculate).
How can I convert the 64 bit integer to a value * in order to pass it?
Thanks a lot,
Tehila.
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2012 Sep 28
11
[LLVMdev] [RFC] OpenMP Representation in LLVM IR
Hi All,
We'd like to make a proposal for OpenMP representation in LLVM IR.
Our goal is to reach an agreement in the community on a simple,
complete and extensible representation of OpenMP language constructs
in LLVM IR. Hopefully, this would serve as a common ground and would
enable further development of OpenMP support both in Clang and LLVM
compiler toolchain.
We seek feedback on the
2011 Jan 12
4
[LLVMdev] How to define a global variable?
Hi,
I'm trying to define a mutable variable, outside functions. The code
below is trying to evaluate an expression much like "x = 1" at the
module level in Python. It appears that when it tries to JIT the
function there is an error because there is no storage allocated for
'x'. How do I do that?
thanks,
Rob
----- dumped IR -----
; ModuleID = 'repl-module'
%0 =
2008 Mar 25
2
[LLVMdev] llvm-gcc 4.2 assertion failed on linux x86_64
Hello,
Trying to get my machine building up-to-date, and a nightly going, i
ran into an assertion during the build of llvm-gcc 4.2:
$ make -j2
<snip!>
/home/chandlerc/code/compilers/build/llvm-gcc/./gcc/xgcc
-B/home/chandlerc/code/compilers/build/llvm-gcc/./gcc/
-B/home/chandlerc/code/compilers/install/llvm-gcc/x86_64-pc-linux-gnu/bin/
2012 Jul 11
2
[LLVMdev] [NVPTX] llc -march=nvptx64 -mcpu=sm_20 generates invalid zero align for device function params
Hello,
FYI, this is a bug http://llvm.org/bugs/show_bug.cgi?id=13324
When compiling the following code for sm_20, func params are by some reason
given with .align 0, which is invalid. Problem does not occur if compiled
for sm_10.
> cat test.ll
; ModuleID = '__kernelgen_main_module'
target datalayout = "e-p:64:64-i64:64:64-f64:64:64-n1:8:16:32:64"
target triple =
2007 Sep 22
0
[LLVMdev] RFC: Patch
On Sep 21, 2007, at 5:11 PM, Bill Wendling wrote:
>
> My question is, is this liable to break something else down the line?
> Should it be modified to call the getNamedGlobal method only if it's
> an Objective-C property? Is this even the correct method for an
> Objective-C property?
There is a bigger question here. One invariant that is useful is
that there is only a
2013 Jan 20
1
[LLVMdev] Get the value of a GlobalVariable
Hi,
I am executing a C program using JIT. When the program exits, the control
comes back to my program which initiates the JIT. Now, I want to read
the value(not the LLVM nomenclature) of a global variable (not the LLVM
nomenclature). I am able to get the global variable, using the following
command:
GlobalVariable *my_global = Mod->getNamedGlobal("MY_GLOBAL");
I want to know the