[PATCH] Specify the access behaviour of the memcpy, memmove and memset intrinsics
Chandler Carruth
chandlerc at gmail.com
Tue Apr 30 05:08:10 PDT 2013
Sorry for the long delays, and thanks for reminding me about this. Comments below.
================
Comment at: include/llvm/IR/IntrinsicInst.h:135-144
@@ -134,4 +134,12 @@
+
bool isVolatile() const {
- return !getVolatileCst()->isZero();
+ switch (getIntrinsicID()) {
+ case Intrinsic::memcpy:
+ case Intrinsic::memmove:
+ return isDestVolatile() ||
+ !cast<ConstantInt>(const_cast<Value*>(getArgOperand(5)))->isZero();
+ default:
+ return isDestVolatile();
+ }
}
----------------
I would just sink this into the specific intrinsic classes so that we don't have to get the intrinsic ID and switch over it here.
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4472-4473
@@ -4471,3 +4471,4 @@
Align = 1; // @llvm.memcpy defines 0 and 1 to both mean no alignment.
- bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue();
+ bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue() ||
+ cast<ConstantInt>(I.getArgOperand(5))->getZExtValue();
DAG.setRoot(DAG.getMemcpy(getRoot(), dl, Op1, Op2, Op3, Align, isVol, false,
----------------
Update to use the new APIs?
================
Comment at: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:4510-4512
@@ -4508,4 +4509,5 @@
Align = 1; // @llvm.memmove defines 0 and 1 to both mean no alignment.
- bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue();
+ bool isVol = cast<ConstantInt>(I.getArgOperand(4))->getZExtValue() ||
+ cast<ConstantInt>(I.getArgOperand(5))->getZExtValue();
DAG.setRoot(DAG.getMemmove(getRoot(), dl, Op1, Op2, Op3, Align, isVol,
MachinePointerInfo(I.getArgOperand(0)),
----------------
Here as well.
================
Comment at: lib/Target/ARM/ARMFastISel.cpp:2292
@@ -2292,1 +2291,3 @@
+ const char *IntrMemName = 0,
+ unsigned numVolatileSpec = 0) {
const CallInst *CI = cast<CallInst>(I);
----------------
This seems like a moderately horrible interface. I would much prefer to use the types to tell what to do than to count the volatile flags.
http://llvm-reviews.chandlerc.com/D386
More information about the llvm-commits
mailing list