[llvm] r264072 - Add a hasOperandBundlesOtherThan helper, and use it; NFC
Sanjoy Das via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 22 10:51:26 PDT 2016
Author: sanjoy
Date: Tue Mar 22 12:51:25 2016
New Revision: 264072
URL: http://llvm.org/viewvc/llvm-project?rev=264072&view=rev
Log:
Add a hasOperandBundlesOtherThan helper, and use it; NFC
Modified:
llvm/trunk/include/llvm/IR/InstrTypes.h
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
Modified: llvm/trunk/include/llvm/IR/InstrTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/InstrTypes.h?rev=264072&r1=264071&r2=264072&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/InstrTypes.h (original)
+++ llvm/trunk/include/llvm/IR/InstrTypes.h Tue Mar 22 12:51:25 2016
@@ -1478,6 +1478,17 @@ public:
Other.bundle_op_info_begin());
};
+ /// \brief Return true if this operand bundle user contains operand bundles
+ /// with tags other than those specified in \p IDs.
+ bool hasOperandBundlesOtherThan(ArrayRef<uint32_t> IDs) const {
+ for (unsigned i = 0, e = getNumOperandBundles(); i != e; ++i) {
+ uint32_t ID = getOperandBundleAt(i).getTagID();
+ if (std::find(IDs.begin(), IDs.end(), ID) == IDs.end())
+ return true;
+ }
+ return false;
+ }
+
protected:
/// \brief Is the function attribute S disallowed by some operand bundle on
/// this operand bundle user?
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp?rev=264072&r1=264071&r2=264072&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp Tue Mar 22 12:51:25 2016
@@ -2127,14 +2127,11 @@ void SelectionDAGBuilder::visitInvoke(co
MachineBasicBlock *Return = FuncInfo.MBBMap[I.getSuccessor(0)];
const BasicBlock *EHPadBB = I.getSuccessor(1);
-#ifndef NDEBUG
// Deopt bundles are lowered in LowerCallSiteWithDeoptBundle, and we don't
// have to do anything here to lower funclet bundles.
- for (unsigned i = 0, e = I.getNumOperandBundles(); i != e; ++i)
- assert((I.getOperandBundleAt(i).isDeoptOperandBundle() ||
- I.getOperandBundleAt(i).isFuncletOperandBundle()) &&
- "Cannot lower invokes with arbitrary operand bundles yet!");
-#endif
+ assert(!I.hasOperandBundlesOtherThan(
+ {LLVMContext::OB_deopt, LLVMContext::OB_funclet}) &&
+ "Cannot lower invokes with arbitrary operand bundles yet!");
const Value *Callee(I.getCalledValue());
const Function *Fn = dyn_cast<Function>(Callee);
@@ -6116,14 +6113,11 @@ void SelectionDAGBuilder::visitCall(cons
RenameFn,
DAG.getTargetLoweringInfo().getPointerTy(DAG.getDataLayout()));
-#ifndef NDEBUG
// Deopt bundles are lowered in LowerCallSiteWithDeoptBundle, and we don't
// have to do anything here to lower funclet bundles.
- for (unsigned i = 0, e = I.getNumOperandBundles(); i != e; ++i)
- assert((I.getOperandBundleAt(i).isDeoptOperandBundle() ||
- I.getOperandBundleAt(i).isFuncletOperandBundle()) &&
- "Cannot lower calls with arbitrary operand bundles!");
-#endif
+ assert(!I.hasOperandBundlesOtherThan(
+ {LLVMContext::OB_deopt, LLVMContext::OB_funclet}) &&
+ "Cannot lower calls with arbitrary operand bundles!");
if (I.countOperandBundlesOfType(LLVMContext::OB_deopt))
LowerCallSiteWithDeoptBundle(&I, Callee, nullptr);
More information about the llvm-commits
mailing list