[PATCH] CodeGenPrepare: Avoid and/or i1 in select conditions.

hfinkel at anl.gov hfinkel at anl.gov
Wed Mar 4 08:51:40 PST 2015


REPOSITORY
  rL LLVM

================
Comment at: include/llvm/Target/TargetLowering.h:1095
@@ +1094,3 @@
+    // If SELECTs are expensive then we should not do this.
+    return !isSelectExpensive();
+  }
----------------
I think it makes more sense to make this default to:
  !hasMultipleConditionRegisters()

because if a target has multiple condition registers, then it probably has operations on those registers.


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4714
@@ +4713,3 @@
+  const SDNode *Node = Value.getNode();
+  for (auto I = Node->use_begin(), E = Node->use_end(); I != E; ++I) {
+    const SDUse &Use = I.getUse();
----------------
Range-based for?

================
Comment at: lib/Target/PowerPC/PPCISelLowering.h:624
@@ +623,3 @@
+    bool shouldNormalizeToSelectSequence() const override {
+      return false;
+    }
----------------
This needs to default to !Subtarget.useCRBits() (so you might need to move the implementation into the PPCISelLowering.cpp).

Better yet, if you use hasMultipleConditionRegisters() for the default implementation (which I think you should), then you don't need this at all.

http://reviews.llvm.org/D7622

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list