[all-commits] [llvm/llvm-project] ad6940: [SCEVAA] Avoid forming malformed pointer diff expr...
Philip Reames via All-commits
all-commits at lists.llvm.org
Wed Nov 17 12:38:31 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ad69402f3e19f027fc6fb179ad59a2851e615c41
https://github.com/llvm/llvm-project/commit/ad69402f3e19f027fc6fb179ad59a2851e615c41
Author: Philip Reames <listmail at philipreames.com>
Date: 2021-11-17 (Wed, 17 Nov 2021)
Changed paths:
M llvm/include/llvm/Analysis/ScalarEvolution.h
M llvm/lib/Analysis/ScalarEvolution.cpp
M llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp
M llvm/test/Analysis/ScalarEvolution/scev-aa.ll
Log Message:
-----------
[SCEVAA] Avoid forming malformed pointer diff expressions
This solves the same crash as in D104503, but with a different approach.
The test case test_non_dom demonstrates a case where scev-aa crashes today. (If exercised either by -eval-aa or -licm.) The basic problem is that SCEV-AA expects to be able to compute a pointer difference between two SCEVs for any two pair of pointers we do an alias query on. For (valid, but out of scope) reasons, we can end up asking whether expressions in different sub-loops can alias each other. This results in a subtraction expression being formed where neither operand dominates the other.
The approach this patch takes is to leverage the "defining scope" notion we introduced for flag semantics to detect and disallow the formation of the problematic SCEV. This ends up being relatively straight forward on that new infrastructure. This change does hint that we should probably be verifying a similar property for all SCEVs somewhere, but I'll leave that to a follow on change.
Differential Revision: D114112
More information about the All-commits
mailing list