http://llvm.org/bugs/show_bug.cgi?id=8862
Summary: instcombine shouldn't canonicalize 'sdiv exact' into
ashr
Product: libraries
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Scalar Optimizations
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Instcombine should compile this identity function to return X:
define i32 @test(i32 %X) {
%A = sdiv exact i32 %X, 4
%B = mul i32 %A, 4
ret i32 %B
}
instead we get:
define i32 @test(i32 %X) {
%A1 = and i32 %X, -4
ret i32 %A1
}
This is because it simplifies the sdiv into an ashr instruction, which loses
information. This sort of thing comes up when handling array/pointer
difference stuff.
To fix this, SDISel whould lower sdiv exact into ashr, instcombine should
handle sdiv's as aggressively as ashr's, and then we should stop canonicalizing
ashr to sdiv in instcombine.
--
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
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs