[LLVMbugs] [Bug 774] NEW: SwitchInst default block doesn't get optimized away
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Wed May 10 12:23:22 PDT 2006
http://llvm.org/bugs/show_bug.cgi?id=774
Summary: SwitchInst default block doesn't get optimized away
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Scalar Optimizations
AssignedTo: unassignedbugs at nondot.org
ReportedBy: nicholas at mxc.ca
LLVM doesn't seem to do a good job of removing the default block of a switch
statement. Given the C++ code:
int test1(bool b)
{
switch (b) {
case true:
return 1;
case false:
return 2;
default:
return 3;
}
return 4;
}
The return 4 is removed, but return 3 is kept. By contrast, the same logic with
if statements:
int test1if(bool b)
{
if (b == true)
return 1;
else if (b == false)
return 2;
else
return 3;
return 4;
}
becomes:
int %_Z7test1ifb(bool %b) {
entry:
%retval = select bool %b, int 1, int 2 ; <int> [#uses=1]
ret int %retval
}
so it's clear that LLVM should know what's going on.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list