similar to: [LLVMdev] C infinite recursion mis-optimized?

Displaying 20 results from an estimated 30000 matches similar to: "[LLVMdev] C infinite recursion mis-optimized?"

2010 Feb 28
0
[LLVMdev] C infinite recursion mis-optimized?
Hi Isaac, > For fun, I made a recursive function, but LLVM optimized it wrong (if > I'm understanding C standards correctly). > > "void f() { f(); }"[see llvm-code in footnote 1] > was optimized to be equivalent to "void f() {}"[also 1]. I believe it > should either be equivalent in effect to "void f() { while(1){} }"[2], > which produces an
2010 Feb 28
1
[LLVMdev] C infinite recursion mis-optimized?
On 02/28/10 07:39, Duncan Sands wrote: > Hi Isaac, > >> For fun, I made a recursive function, but LLVM optimized it wrong (if >> I'm understanding C standards correctly). >> >> "void f() { f(); }"[see llvm-code in footnote 1] >> was optimized to be equivalent to "void f() {}"[also 1]. I believe it >> should either be equivalent in
2015 Jun 28
5
[LLVMdev] readonly and infinite loops
> You dropped some context... > A daemon program wouldn't be readonly. An infinite loop can be. Right. To prevent miscommunication, here is a quick analysis of a problematic (IMO) example: We start with ``` define void @infloop(i1 %c) { entry: br i1 %c, label %l, label %e l: br label %l e: ret void } define void @main_func() { entry: call void @infloop(i1 1) ret
2017 Jan 03
2
RFC: Allow readnone and readonly functions to throw exceptions
Hi Michael, On Mon, Jan 2, 2017 at 11:49 PM, Michael Kuperstein <michael.kuperstein at gmail.com> wrote: > This sounds right to me. > > IIUC, historically, readonly and readnone are meant to model the "pure" and > "const" GCC attributes. These attributes make pretty strong guarantees: > > "[a pure] function can be subject to common subexpression
2015 Jul 18
2
[LLVMdev] LICM for function calls
On 07/15/2015 07:05 PM, Hal Finkel wrote: > ----- Original Message ----- >> From: "Xin Tong" <trent.xin.tong at gmail.com> >> To: "Philip Reames" <listmail at philipreames.com> >> Cc: "Hal Finkel" <hfinkel at anl.gov>, llvmdev at cs.uiuc.edu >> Sent: Wednesday, July 15, 2015 6:35:11 PM >> Subject: Re: [LLVMdev] LICM
2017 Jan 03
4
RFC: Allow readnone and readonly functions to throw exceptions
LLVM today does not clearly specify if a function specified to not write to memory (i.e. readonly or readnone) is allowed to throw exceptions. LangRef is ambiguous on this issue. The normative statement is "[readnone/readonly functions] cannot unwind exceptions by calling the C++ exception throwing methods" which does not decide an answer for non C++ languages. It used to say (h/t
2015 Jul 15
2
[LLVMdev] LICM for function calls
i think attributes have taken control flow into account. I think readnone and nounwind functions are not safe to speculative execute because the function could run indefinitely, e.g. an infinite loop. -Xin On Tuesday, July 14, 2015, Philip Reames <listmail at philipreames.com> wrote: > On 07/14/2015 10:25 PM, Hal Finkel wrote: > >> ----- Original Message ----- >>
2015 Jun 27
2
[LLVMdev] readonly and infinite loops
Running -early-cse on declare void @rn() readnone nounwind define void @f() { entry: call void @rn() ret void } removes the call to @rn(). But @rn() could have had an infinite loop in it in which case @f() went from being a non-terminating program to an terminating no-op. Is this intentional? The only way I can see this transform being legal is if infinite loops are declared to have
2010 Oct 12
3
[LLVMdev] DCE and external function
> only if the compiler can prove that the called function has > no side effects (such as modifying some global variables or > causing the program to exit). can it prove if the function resides in a shared library? -- View this message in context: http://old.nabble.com/DCE-and-external-function-tp29932485p29942236.html Sent from the LLVM - Dev mailing list archive at Nabble.com.
2014 Mar 27
4
[LLVMdev] Named register variables GNU-style
On 27 March 2014 15:30, Rafael EspĂ­ndola <rafael.espindola at gmail.com> wrote: > For global ones, it should also codegen every non inline asm to use an > llvm intrinsic (llvm.read_register/llvm.write_register for example). That's my idea, yes. I'm not sure how Clang would transform the named registers into the intrinsic, but something along the lines of: i8* @SP =
2015 Jun 27
4
[LLVMdev] readonly and infinite loops
On Sat, Jun 27, 2015 at 2:16 PM, Nuno Lopes <nunoplopes at sapo.pt> wrote: > At least in C/C++ that's UB, yes. So you cannot map every turing machine to a valid C/C++ program then. :) Also, does this mean that "daemon" programs that run continuously till they're killed by the OS (using a mechanism that is not visible in C) are effectively undefined? -- Sanjoy >
2017 Jan 05
2
RFC: Allow readnone and readonly functions to throw exceptions
On 01/04/2017 10:35 PM, Sanjoy Das via llvm-dev wrote: > I just realized that there's an annoying corner case to this scheme -- > I can't DSE stores across readnone maythrow function calls because the > exception handler could read memory. That is, in: > > try { > *a = 10; > call void @readnone_mayunwind_fn(); > *a = 20; > } catch (...) { >
2011 Jun 23
2
[LLVMdev] type promotion i16 -> i32
Hello, I'm developing a llvm backend. It seems that, if i16 is not a legal type (no register can hold i16 types in RegisterInfo.td and as a RegisterClass in SelLowering.cpp), i16 should be promoted to i32. Nonotheless, this simple program: int main(){ volatile short a; a= 3; return 0; } which is trasformed in this IR: define i32 @main() nounwind readnone { entry: %a = alloca i16,
2015 Jun 28
2
[LLVMdev] readonly and infinite loops
On Sat, Jun 27, 2015 at 2:46 PM, Daniel Berlin <dberlin at dberlin.org> wrote: > In C, dunno, but in LLVM, it means they aren't readonly :) In that case, -functionattrs needs to be fixed: define void @infloop() { entry: br label %l l: br label %l } == opt -functionattrs ==> ; Function Attrs: readnone define void @infloop() #0 { entry: br label %l l:
2017 Jan 03
3
RFC: Allow readnone and readonly functions to throw exceptions
On Tue, Jan 3, 2017 at 10:47 AM, Michael Kuperstein via llvm-dev < llvm-dev at lists.llvm.org> wrote: > > > On Tue, Jan 3, 2017 at 9:59 AM, Sanjoy Das via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hi Michael, >> >> On Mon, Jan 2, 2017 at 11:49 PM, Michael Kuperstein >> <michael.kuperstein at gmail.com> wrote: >> > This
2009 Jun 08
2
[LLVMdev] Call to address 0 gets removed
Hello If I optimize (opt -std-compile-opts ) the following .ll ; ModuleID = 'call0.ll' target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" target triple = "i386-mingw32" define i32 @t(i32 %a) nounwind { entry: %0 = tail call i32 inttoptr (i32 0 to i32 (i32)*)(i32 %a) nounwind
2016 Jul 15
2
RFC: Strong GC References in LLVM
On Fri, Jul 15, 2016 at 2:30 PM, Sanjoy Das <sanjoy at playingwithpointers.com> wrote: > Hi Daniel, > > Daniel Berlin wrote: > > However, I didn't quite understand your point about may-throw -- how > > is may-throw different from a generic side-effect (volatile store, > > syscall etc.)? All of those can't be hoisted or sunk -- we have to >
2010 Oct 12
0
[LLVMdev] DCE and external function
On Tue, Oct 12, 2010 at 1:21 PM, leledumbo <leledumbo_cool at yahoo.co.id> wrote: > >> only if the compiler can prove that the called function has >> no side effects (such as modifying some global variables or >> causing the program to exit). > > can it prove if the function resides in a shared library? Only if the right function attributes are added. See
2009 May 28
0
[LLVMdev] mov instruction in LLVM IR
On May 28, 2009, at 4:23 PM, Vinod Grover wrote: > The input language is at assembly level, And C makes for an excellent assembler: $ cat s.c main() { volatile register int i, j; i = j; } $ clang -O4 s.c -o - -S ; ModuleID = 's.c' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32- i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-
2011 Aug 16
1
[LLVMdev] Missing metadata for volatile variables
Hi everyone, I am using the dragonegg plugin to produce bitcode for the following small C program: int main() { 1: int x = -5; 2: x = 6; 3: return 0; } The assignments on lines 1 and 2 are removed even when no optimization flags are specified. I tried making variable "x" volatile, which prevents the assignments from being removed, however I am no longer able to recover the original