[LLVMbugs] [Bug 4895] New: Missed phi/phi/select folding opportunity
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Fri Sep 4 22:14:47 PDT 2009
http://llvm.org/bugs/show_bug.cgi?id=4895
Summary: Missed phi/phi/select folding opportunity
Product: new-bugs
Version: unspecified
Platform: Other
OS/Version: other
Status: NEW
Severity: minor
Priority: P2
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: me22.ca at gmail.com
CC: llvmbugs at cs.uiuc.edu
I compiled the following C++ code with bitter melon on 2009-09-05T05:00Z with
LTO enabled:
#include <set>
int main() {
std::set<int> s;
if (s.find(0) != s.end()) return *s.find(0);
}
This resulted in this basic block (among others):
_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEED1Ev.exit: ; preds
= %invcont2, %invcont1
%.0 = phi i32 [ %29, %invcont2 ], [ undef, %invcont1 ] ; <i32>
[#uses=1]
%finally_tmp.74.0 = phi i1 [ true, %invcont2 ], [ false, %invcont1 ]
; <i1> [#uses=1]
%.1 = select i1 %finally_tmp.74.0, i32 %.0, i32 0 ; <i32>
[#uses=1]
ret i32 %.1
Which, which names shortened, looks like this:
%.0 = phi i32 [%29, %A], [undef, %B]
%t = phi i1 [true, %A], [false, %B]
%.1 = select i1 %t, i32 %.0, i32 0
ret i32 %.1
Selecting on the result of a phi[true][false] seems strange to me, as AFAIK it
could have simply been written like this:
%.0 = phi i32 [%29, %A], [0, %B]
ret i32 %.0
--
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.
More information about the llvm-bugs
mailing list