[llvm] r268010 - [InstCombine] Propagate operand bundles
David Majnemer via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 29 01:07:20 PDT 2016
Author: majnemer
Date: Fri Apr 29 03:07:20 2016
New Revision: 268010
URL: http://llvm.org/viewvc/llvm-project?rev=268010&view=rev
Log:
[InstCombine] Propagate operand bundles
We neglected to transfer operand bundles for some transforms. These
were found via inspection, I'll try to come up with some test cases.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=268010&r1=268009&r2=268010&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Fri Apr 29 03:07:20 2016
@@ -2793,15 +2793,18 @@ InstCombiner::transformCallThroughTrampo
const AttributeSet &NewPAL =
AttributeSet::get(FTy->getContext(), NewAttrs);
+ SmallVector<OperandBundleDef, 1> OpBundles;
+ CS.getOperandBundlesAsDefs(OpBundles);
+
Instruction *NewCaller;
if (InvokeInst *II = dyn_cast<InvokeInst>(Caller)) {
NewCaller = InvokeInst::Create(NewCallee,
II->getNormalDest(), II->getUnwindDest(),
- NewArgs);
+ NewArgs, OpBundles);
cast<InvokeInst>(NewCaller)->setCallingConv(II->getCallingConv());
cast<InvokeInst>(NewCaller)->setAttributes(NewPAL);
} else {
- NewCaller = CallInst::Create(NewCallee, NewArgs);
+ NewCaller = CallInst::Create(NewCallee, NewArgs, OpBundles);
if (cast<CallInst>(Caller)->isTailCall())
cast<CallInst>(NewCaller)->setTailCall();
cast<CallInst>(NewCaller)->
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=268010&r1=268009&r2=268010&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Fri Apr 29 03:07:20 2016
@@ -1401,8 +1401,11 @@ Instruction *InstCombiner::visitFPTrunc(
Function *Overload = Intrinsic::getDeclaration(
CI.getModule(), II->getIntrinsicID(), IntrinsicType);
+ SmallVector<OperandBundleDef, 1> OpBundles;
+ II->getOperandBundlesAsDefs(OpBundles);
+
Value *Args[] = { InnerTrunc };
- return CallInst::Create(Overload, Args, II->getName());
+ return CallInst::Create(Overload, Args, OpBundles, II->getName());
}
}
}
More information about the llvm-commits
mailing list