From ae9ac9ce84e0903b0741af8da0df0d5beb1d612a Mon Sep 17 00:00:00 2001 From: Sanjoy Das Date: Mon, 13 Jun 2016 19:55:04 +0000 Subject: [PATCH] Fix AAResults::callCapturesBefore for operand bundles Summary: AAResults::callCapturesBefore would previously ignore operand bundles. It was possible for a later instruction to miss its memory dependency on a call site that would only access the pointer through a bundle. Patch by Oscar Blumberg! Reviewers: sanjoy Differential Revision: http://reviews.llvm.org/D21286 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@272580 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/AliasAnalysis.cpp | 2 +- test/CodeGen/X86/statepoint-memdep.ll | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/CodeGen/X86/statepoint-memdep.ll diff --git a/lib/Analysis/AliasAnalysis.cpp b/lib/Analysis/AliasAnalysis.cpp index 117f8cb123f..263dd48bfea 100644 --- a/lib/Analysis/AliasAnalysis.cpp +++ b/lib/Analysis/AliasAnalysis.cpp @@ -445,7 +445,7 @@ ModRefInfo AAResults::callCapturesBefore(const Instruction *I, unsigned ArgNo = 0; ModRefInfo R = MRI_NoModRef; - for (ImmutableCallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end(); + for (auto CI = CS.data_operands_begin(), CE = CS.data_operands_end(); CI != CE; ++CI, ++ArgNo) { // Only look at the no-capture or byval pointer arguments. If this // pointer were passed to arguments that were neither of these, then it diff --git a/test/CodeGen/X86/statepoint-memdep.ll b/test/CodeGen/X86/statepoint-memdep.ll new file mode 100644 index 00000000000..c22a25ed7d8 --- /dev/null +++ b/test/CodeGen/X86/statepoint-memdep.ll @@ -0,0 +1,17 @@ +; RUN: opt -S -dse < %s | FileCheck %s +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +define void @f() { + ; CHECK-LABEL: @f( + %s = alloca i64 + ; Verify that this first store is not considered killed by the second one + ; since it could be observed from the deopt continuation. + ; CHECK: store i64 1, i64* %s + store i64 1, i64* %s + call void @g() [ "deopt"(i64* %s) ] + store i64 0, i64* %s + ret void +} + +declare void @g() -- 2.11.0