From a940f360cbaa1fb0da984c5cd311efe85a7d88ae Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 15 Jul 2016 17:19:24 +0000 Subject: [AliasAnalysis] Give back AA results for fence instructions Calling getModRefInfo with a fence resulted in crashes because fences don't have a memory location. Add a new predicate to Instruction called isFenceLike which indicates that the instruction mutates memory but not any single memory location in particular. In practice, it is a proxy for the set of instructions which "mayWriteToMemory" but cannot be used with MemoryLocation::get. This fixes PR28570. llvm-svn: 275581 --- llvm/lib/Analysis/AliasAnalysis.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Analysis/AliasAnalysis.cpp') diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp index ab5f814fb39..f931b6fc652 100644 --- a/llvm/lib/Analysis/AliasAnalysis.cpp +++ b/llvm/lib/Analysis/AliasAnalysis.cpp @@ -111,6 +111,9 @@ ModRefInfo AAResults::getModRefInfo(Instruction *I, ImmutableCallSite Call) { if (auto CS = ImmutableCallSite(I)) { // Check if the two calls modify the same memory return getModRefInfo(CS, Call); + } else if (I->isFenceLike()) { + // If this is a fence, just return MRI_ModRef. + return MRI_ModRef; } else { // Otherwise, check if the call modifies or references the // location this memory access defines. The best we can say -- cgit v1.2.3