From 0bd906ec8f7839ac9a802b82b48444d647bba88c Mon Sep 17 00:00:00 2001 From: Hiroshi Inoue Date: Wed, 2 Aug 2017 18:16:32 +0000 Subject: [StackColoring] Update AliasAnalysis information in stack coloring pass (part 2) This patch is update after the first patch (https://reviews.llvm.org/rL309651) based on the post-commit comments. Stack coloring pass need to maintain AliasAnalysis information when merging stack slots of different types. Actually, there is a FIXME comment in StackColoring.cpp // FIXME: In order to enable the use of TBAA when using AA in CodeGen, // we'll also need to update the TBAA nodes in MMOs with values // derived from the merged allocas. But, TBAA has been already enabled in CodeGen without fixing this pass. The incorrect TBAA metadata results in recent failures in bootstrap test on ppc64le (PR33928) by allowing unsafe instruction scheduling. Although we observed the problem on ppc64le, this is a platform neutral issue. This patch makes the stack coloring pass maintains AliasAnalysis information when merging multiple stack slots. This patch fixes PR33928. llvm-svn: 309849 --- llvm/lib/Analysis/ValueTracking.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'llvm/lib/Analysis/ValueTracking.cpp') diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 9e80bbef3c8..9ab98ce6175 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -3319,13 +3319,6 @@ void llvm::getUnderlyingObjectsForCodeGen(const Value *V, GetUnderlyingObjects(const_cast(V), Objs, DL); for (Value *V : Objs) { - // If GetUnderlyingObjects fails to find an identifiable object, - // getUnderlyingObjectsForCodeGen also fails for safety. - if (!isIdentifiedObject(V)) { - Objects.clear(); - return; - } - if (!Visited.insert(V).second) continue; if (Operator::getOpcode(V) == Instruction::IntToPtr) { @@ -3336,6 +3329,12 @@ void llvm::getUnderlyingObjectsForCodeGen(const Value *V, continue; } } + // If GetUnderlyingObjects fails to find an identifiable object, + // getUnderlyingObjectsForCodeGen also fails for safety. + if (!isIdentifiedObject(V)) { + Objects.clear(); + return; + } Objects.push_back(const_cast(V)); } } while (!Working.empty()); -- cgit v1.2.3