New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CBE miscompilation of 197.parser #1471
Comments
One solution would be to emit: ltmp_2_2 == (signed short)ltmp_1_2 instead of ltmp_2_2 == ltmp_1_2 -Chris |
For the record, this is the bugpoint command that reduced this test case: cd Output/bugpoint-test |
yes, which assumes that you primed it with "make clean; make RUN_TYPE=test bugpoint-llc" then hit ctrl- |
Hmm. This seems to be fallout from parameter attributes change. |
This patch: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070108/042265.html is a partial fix for this PR. It defaults function parameters to signed This fixes 197.parser but there is more to do. Any comparison and possibly |
Fixed with this patch: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070108/042272.html |
mentioned in issue llvm/llvm-bugzilla-archive#1416 |
Extended Description
Reduced by bugpoint. The issue is that this testcase:
target datalayout = "e-p:32:32"
target endian = little
target pointersize = 32
target triple = "i686-apple-darwin8"
%struct.Connector = type { i16, i16, i8, i8, %struct.Connector*, i8* }
implementation ; Functions:
define bool %prune_match_entry_2E_ce(%struct.Connector* %a, i16 %b.0.0.val) {
newFuncRoot:
br label %entry.ce
cond_next.exitStub: ; preds = %entry.ce
ret bool true
entry.return_crit_edge.exitStub: ; preds = %entry.ce
ret bool false
entry.ce: ; preds = %newFuncRoot
%tmp = getelementptr %struct.Connector* %a, i32 0, i32 0 ; <i16*> [#uses=1]
%tmp = load i16* %tmp ; [#uses=1]
%tmp = icmp eq i16 %tmp, %b.0.0.val ; [#uses=1]
br bool %tmp, label %cond_next.exitStub, label %entry.return_crit_edge.exitStub
}
is compiled to:
struct l_struct_2E_Connector {
signed short field0;
signed short field1;
signed char field2;
signed char field3;
struct l_struct_2E_Connector *field4;
signed char *field5;
};
...
bool prune_match_entry_2E_ce(struct l_struct_2E_Connector *ltmp_0_1, unsigned short ltmp_1_2) {
signed short ltmp_2_2;
ltmp_2_2 = *(<mp_0_1->field0);
return ((((ltmp_2_2 == ltmp_1_2)) ? (1) : (0)));
}
Note that the == is comparing a signed short and an unsigned short. These both get extended
(differently) to int before the comparison is done.
-Chris
The text was updated successfully, but these errors were encountered: