[PATCH] Fix optimisations of SELECT_CC which assumed result is boolean
Tim Northover
t.p.northover at gmail.com
Fri Nov 14 15:22:14 PST 2014
================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:648-650
@@ -647,1 +647,5 @@
+ if (TLI.getBooleanContents(N.getValueType()) ==
+ TargetLowering::UndefinedBooleanContent)
+ return false;
+
----------------
arsenm wrote:
> Is this really necessary? I believe isConstTrue should do the correct thing for for UndefinedBooleanContent
The problem is that most (all?) contexts this function is used in, the output isn't necessarily a boolean. E.g.
(and (select_cc L1, R1, 0x1230, 0x4561), (select_cc L2, R2, 0x7890, 0xabc1))
That's going to be a very specific constant, but any argument based on thinking of it as equivalent to
(and (setcc L1, R1), (setcc L2, R2))
is going to be on very shaky ground. Thinking about it, you could probably allow it if the type is still i1 or <N x i1>, but not more generally.
http://reviews.llvm.org/D6249
More information about the llvm-commits
mailing list