Displaying 20 results from an estimated 7000 matches similar to: "In LLVM IR, how can I determine if a switch statement had an explicit default case?"
2011 Mar 31
0
[LLVMdev] signed/unsigned integers ?
On Wed, Mar 30, 2011 at 03:19, Julien Henry <Julien.Henry at imag.fr> wrote:
>
> Actually, I'm working on a static analyzer that computes invariants at
> each basicBlock: "In basicBlock B, what is the set of possible
> assignments for each live values ?"
> and I obtains results such as "In B, we have 0 <= x <= 42"
>
Well, you have to find that
2015 Jul 24
2
[LLVMdev] Transforming SwitchInst to BranchInst
Hi,
Are there some built-in LLVM transformation pass, or written library code
that transforms LLVM::SwitchInst into if-condition statements (LLVM::
BranchInst)?
The purpose of the transformation is that we have a legacy program analyzer
that includes an LLVM pass manipulating if-condition statements. Statements
of LLVM::SwithchInst should have been handled in the same manner but was
not done.
2011 Jul 31
3
[LLVMdev] SwitchInst::addCase with BlockAddress
I'm trying to figure out how to feed a blockaddress to a switch
condition AND destination (basically emulating an indirectbr via a
switch; I know it's not a good approach, I'm just experimenting).
Suppose I have the following:
SwitchInst *s = SwitchInst::Create(...);
BasicBlock *bb = ...;
PtrToIntInst k = new PtrToIntInst(BlockAddress::get(bb), <TYPE>, "", s);
2011 Mar 30
4
[LLVMdev] signed/unsigned integers ?
>> The compiler remembers for debugging purpose that x is defined as
>> unsigned, and y as signed, no ? I'm not familiar with LLVM debug info,
>> but maybe I can find this info there ?
>
> probably it can be extracted from debug info, but what if there is no debug
> info? Can you please explain what you intend to do with this information -
> then maybe we can
2011 Aug 01
0
[LLVMdev] SwitchInst::addCase with BlockAddress
On Sun, Jul 31, 2011 at 7:36 AM, Carlo Alberto Ferraris
<cafxx at strayorange.com> wrote:
> I'm trying to figure out how to feed a blockaddress to a switch condition
> AND destination (basically emulating an indirectbr via a switch; I know it's
> not a good approach, I'm just experimenting).
> Suppose I have the following:
>
> SwitchInst *s =
2018 Jul 15
2
llvm pass is very slow
Hi
I write a LLVM function pass. The pass will loop the basicblock in the
function, check the instruction's type with dyn_cast<switchinst>, print the
instruction and the basicblock's successors. I think it is not very complex.
My bitcode file is about 30M. My CPU is i7-7700(3.6GHz). It has been
running for 60 hours but it is still running. I am not sure whether this is
a normal
2012 Jul 20
2
[LLVMdev] Statistics for 'switch' instruction.
Hi all!
I collected some statistics for SwitchInst, based on our test-suite.
I found that efficiency is meaningful for parser-like applications only,
about 15-20% of cases may be reduced (see top 10 items in Raw sheet of
attached .xls file).
Below some numbers.
Total number of cases in all test-suite -- 11835.
Clusters possible to make -- 503
Clusters with size (H - L) + 1
2012 Feb 27
3
[LLVMdev] SwitchInst handling in backend
Hi,
if I want to know how switch instructions are handled in the backend, where do I have to look first?
I'm not familiar with the backend framework and I couldn't figure out the interface between the LLVM instruction 'SwitchInst' and whatever there is in the backend.
I would be very happy about every hint where I have to look to find the entry point of switch instructions in the
2010 Oct 07
2
[LLVMdev] [Q] x86 peephole deficiency
Hi all,
I am slowly working on a SwitchInst optimizer (http://llvm.org/PR8125)
and now I am running into a deficiency of the x86
peephole optimizer (or jump-threader?). Here is what I get:
andl $3, %edi
je .LBB0_4
# BB#2: # %nz
# in Loop: Header=BB0_1
Depth=1
cmpl $2, %edi
2018 Apr 09
2
How to get the case value from Machine Instruction
Hi, guys
I am interesting about how to get the switch case value form the Machine Instruction.
I know the switch will be converted to jump-table in the Machine Instruction.
And in the phase CodeGen , the case-value of SwitchInst can get esasly.
but it seems no case -value in Machine Instruction.
The MI as follows:
Frame Objects:
fi#0: size=1, align=0, at location [SP]
fi#1: size=4,
2018 Apr 09
0
How to get the case value from Machine Instruction
Some glitch in the emailer? I have received this message 3 times in a row!?
I think that by the time it gets as far as MI-level there is no reversible
method of determining the 'case' label at all. The reason I say this, is
that I have often seen optimisations that coalesce groups of values into
interesting logical tests and jump-tables are completely avoided. For
example, a simple
2018 Apr 10
1
How to get the case value from Machine Instruction
Thanks for your help.
Is there possible I can get the realily case value form the MI?
For the case in https://bugs.llvm.org/show_bug.cgi?id=34902.
as follows.
#############################
* GCC v7.1 generated assembly
#############################
** Options: -Os -marm -march=armv7-a
foo:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
sub
2007 Dec 07
2
[LLVMdev] isa<UnaryInstruction> borked in 2.1
Hi
I just had some code which filtered via isa<UnaryInstruction>. Strangely
enough not only the instructions which inherited UnaryInstructions but also:
GetElemPtrInst, SwitchInst , xor, shl
where true on isa<UnaryInstruction>. While the first two seem to be at least
semantically ok the latter seem somehow wrong?
I didn't find the place where the isa_impl templates where
2010 Oct 07
0
[LLVMdev] [Q] x86 peephole deficiency
On Oct 6, 2010, at 6:16 PM, Gabor Greif wrote:
> Hi all,
>
> I am slowly working on a SwitchInst optimizer (http://llvm.org/PR8125)
> and now I am running into a deficiency of the x86
> peephole optimizer (or jump-threader?). Here is what I get:
>
>
> andl $3, %edi
> je .LBB0_4
> # BB#2: # %nz
>
2006 May 17
0
[LLVMdev] Obfuscation with LLVM
Hi all,
I was trying to implement an obfuscation tool for C-code on the basis of
LLVM. I got a prototype of the simple obfuscation transformation which
converting control flow graph to something like a state machine. I am not
sure I will have time to work on extending further this tool with new
transformations like opaque predicates and decided to put here source code I
have by now with hope
2013 Sep 18
1
[LLVMdev] In llvm, how can I delete a whole branch elegantly?
Hi,
I am trying to prune some uninteresting llvm ir branches, corresponding
to the *if-else* condition in the source code. And here is the procedures:
1. Get the BasicBlock containing the BranchInst which has 2
successors(in order to keep consistent with the source code I am using the
llvm ir without any optimizations, so SelectInst/SwitchInst/PHINode is
absent), one of which should be
2012 May 21
2
[LLVMdev] VMKit build broken
Hi,
I just thought of trying vmkit and checked out the source
from the svn repo a few minutes back. The build is failing with the
following error.
llvm[4]: Compiling CGCleanup.cpp for Release+Asserts build
CGCleanup.cpp:507:36: error: no member named 'getCaseSuccessor' in
'llvm::SwitchInst'; did you mean 'getSuccessor'?
2009 Apr 23
5
[LLVMdev] metadata syntax
Duncan Sands wrote:
> Hi Nick,
>
>> I'm looking for input into the syntax for future metadata work. The plan
>> is to make MDNodes hold a list of WeakVHs which will allow us to track
>> metadata associated with values even through calls to
>> ReplaceAllUsesWith. It also means that you can refer to other Values in
>> the program, including instructions
2012 Nov 29
2
[LLVMdev] [cfe-dev] UB in TypeLoc casting
Moving to LLVM dev to discuss the possibility of extending the cast
infrastructure to handle this.
On Tue, Nov 20, 2012 at 5:51 PM, John McCall <rjmccall at apple.com> wrote:
> On Nov 18, 2012, at 5:05 PM, David Blaikie <dblaikie at gmail.com> wrote:
>> TypeLoc casting looks bogus.
>>
>> TypeLoc derived types return true from classof when the dynamic type
>>
2016 Feb 07
3
[PATCH] strlen -> strnlen optimization
This addition converts strlen() calls to strnlen() when the result is
compared to a constant. For example, the following:
strlen(s) < 5
Becomes:
strnlen(s, 5) < 5
That way, we don't have to walk through the entire string. There is the
added overhead of maintaining a counter when using strnlen(), but I
thought I'd start with the general case. It may make sense to only use
this