[PATCH] Make it possible for ints/floats to return different values from getBooleanContents()

Daniel Sanders daniel.sanders at imgtec.com
Tue Jul 8 12:45:08 PDT 2014


================
Comment at: include/llvm/Target/TargetLowering.h:285
@@ -283,1 +284,3 @@
+  /// vectors instead of the way they treat scalars.
+  BooleanContent getBooleanContentsOLD(bool isVec) const {
     return isVec ? BooleanVectorContents : BooleanContents;
----------------
hfinkel at anl.gov wrote:
> Please remove this (we don't need the OLD version any more).
Ok.

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4524
@@ -4523,1 +4523,3 @@
+  // We can't do this reliably if integer based booleans have different contents
+  // to floating point based booleans.
   if (VT.isInteger() &&
----------------
hfinkel at anl.gov wrote:
> I'm missing something here... why not?
We can't tell whether we have an integer-based boolean or a floating-point-based boolean unless we can find the SETCC that produced it and inspect its operands. This is fairly easy if C is the SETCC node, but it can potentially be undiscoverable (or not reasonably discoverable). For example, it could be in another basic block or it could require searching a complicated expression.

================
Comment at: lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:265
@@ +264,3 @@
+  // If integer and float booleans have different contents then we can't
+  // reliably optimize in all cases.
+  if (TLI.getBooleanContents(false, false) !=
----------------
hfinkel at anl.gov wrote:
> Again, please explain.
It's the same reason as the other one but here I attempt to cover the most likely case where Cond is a SETCC.

http://reviews.llvm.org/D4389






More information about the llvm-commits mailing list