http://llvm.org/bugs/show_bug.cgi?id=20542
Bug ID: 20542
Summary: Wrong folding of xor in DAGCombiner
Product: new-bugs
Version: unspecified
Hardware: Other
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 12858
--> http://llvm.org/bugs/attachment.cgi?id=12858&action=edit
Added check for argument's bit width to 'visitXOR' in DAGCombiner.
The DAGCombiner tries to fold 'xor %tmp, 1' into '!%tmp' (read: "not %tmp").
This is valid only if the type of %tmp is i1.
Example code that triggers this problem:
1 @g_609 = global i32 42
2
3 define i32 @main() #0 {
4 entry:
5 %0 = load i32* @g_609, align 4
6 %cmp = icmp slt i32 %0, 1
7 %sub = sext i1 %cmp to i32
8 %xor = xor i32 %sub, 1
9 ret i32 %xor
10 }
NOTE: The problem occurs only if the first argument of the 'xor' is a
'select_cc' node. Since X86 does not lower 'select_cc', this problem cannot be
reproduced on X86.
Suggested patch attached.
--
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