https://llvm.org/bugs/show_bug.cgi?id=26816

            Bug ID: 26816
           Summary: [ScalarEvolution] Iteration order over Set depends on
                    pointer values
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Global Analyses
          Assignee: unassignedb...@nondot.org
          Reporter: mattias.v.eriks...@ericsson.com
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

I am seeing some non-deterministic behavior in the output files in some tests
that I am running.

I have been tracking the problem and I think it is caused by a new for loop in
ScalarEvolutionExpander. The iteration order over Set below will depend on
pointer values. I am not sure how to fix this.

Value *SCEVExpander::FindValueInExprValueMap(const SCEV *S,
                                             const Instruction *InsertPt) {
  SetVector<Value *> *Set = SE.getSCEVValues(S);
  // If the expansion is not in CanonicalMode, and the SCEV contains any
  // sub scAddRecExpr type SCEV, it is required to expand the SCEV literally.
  if (CanonicalMode || !SE.containsAddRecurrence(S)) {
    // If S is scConstant, it may be worse to reuse an existing Value.
    if (S->getSCEVType() != scConstant && Set) {
      // Choose a Value from the set which dominates the insertPt.
      // insertPt should be inside the Value's parent loop so as not to break
      // the LCSSA form.
      for (auto const &Ent : *Set) {

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to