[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-bugs
Subject: [LLVMbugs] [Bug 2831] New: instcombine complicates expression,
From: bugzilla-daemon () cs ! uiuc ! edu
Date: 2008-09-26 13:51:34
Message-ID: bug-2831-206 () http ! llvm ! org/bugs/
[Download RAW message or body]
http://llvm.org/bugs/show_bug.cgi?id=2831
Summary: instcombine complicates expression, and also gets it
wrong!
Product: new-bugs
Version: unspecified
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs@nondot.org
ReportedBy: baldrick@free.fr
CC: llvmbugs@cs.uiuc.edu
Running "opt -instcombine" on this testcase:
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-pc-linux-gnu"
define i32 @main(i32 %argc, i8** %argv) nounwind {
entry:
%0 = ptrtoint i8** %argv to i32 ; <i32> [#uses=1]
%1 = add i32 %0, 1 ; <i32> [#uses=1]
ret i32 %1
}
Turns it into:
define i32 @main(i32 %argc, i8** %argv) nounwind {
entry:
%argv1 = bitcast i8** %argv to i8* ; <i8*> [#uses=1]
%ctg2 = getelementptr i8* %argv1, i32 1 ; <i8*> [#uses=1]
%0 = ptrtoint i8* %ctg2 to i32 ; <i32> [#uses=1]
ret i32 %0
}
Not only is this more complicated, but overflow behaviour
is different: i32 overflow is well-defined, while gep overflow
is not (at least, I don't think it is...). So this transform
is wrong as well as silly.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
LLVMbugs@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic