summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2016-11-21 22:56:42 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2016-11-21 22:56:42 +0000
commitb30d2aca5838c931f04c3de15d33fc15fb87df77 (patch)
tree9be72606eebf150a2bd843eb4f3d88d0f526a432 /llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
parente0bf52f3948dd1b6fdac1d08f1fcadf8211970ab (diff)
downloadbcm5719-llvm-b30d2aca5838c931f04c3de15d33fc15fb87df77.tar.gz
bcm5719-llvm-b30d2aca5838c931f04c3de15d33fc15fb87df77.zip
DAG: Ignore call site attributes when emitting target intrinsic
A target intrinsic may be defined as possibly reading memory, but the call site may have additional knowledge that it doesn't read memory. The intrinsic lowering will expect the pessimistic assumption of the intrinsic definition, so the chain should still be used. llvm-svn: 287593
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index 4bb3cd2055e..4594f92317c 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -4061,8 +4061,12 @@ void SelectionDAGBuilder::visitAtomicStore(const StoreInst &I) {
/// node.
void SelectionDAGBuilder::visitTargetIntrinsic(const CallInst &I,
unsigned Intrinsic) {
- bool HasChain = !I.doesNotAccessMemory();
- bool OnlyLoad = HasChain && I.onlyReadsMemory();
+ // Ignore the callsite's attributes. A specific call site may be marked with
+ // readnone, but the lowering code will expect the chain based on the
+ // definition.
+ const Function *F = I.getCalledFunction();
+ bool HasChain = !F->doesNotAccessMemory();
+ bool OnlyLoad = HasChain && F->onlyReadsMemory();
// Build the operand list.
SmallVector<SDValue, 8> Ops;
OpenPOWER on IntegriCloud