From 8c9cc8c86be80abd4224341314725d03551460d6 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Mon, 12 Dec 2016 02:52:51 +0000 Subject: [SCEVExpand] do not hoist divisions by zero (PR30935) SCEVExpand computes the insertion point for the components of a SCEV to be code generated. When it comes to generating code for a division, SCEVexpand would not be able to check (at compilation time) all the conditions necessary to avoid a division by zero. The patch disables hoisting of expressions containing divisions by anything other than non-zero constants in order to avoid hoisting these expressions past conditions that should hold before doing the division. The patch passes check-all on x86_64-linux. Differential Revision: https://reviews.llvm.org/D27216 llvm-svn: 289412 --- llvm/lib/Analysis/ScalarEvolution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp') diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 7962222a210..051489730bb 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -2130,7 +2130,7 @@ const SCEV *ScalarEvolution::getAddExpr(SmallVectorImpl &Ops, } // Okay, check to see if the same value occurs in the operand list more than - // once. If so, merge them together into an multiply expression. Since we + // once. If so, merge them together into a multiply expression. Since we // sorted the list, these values are required to be adjacent. Type *Ty = Ops[0]->getType(); bool FoundMatch = false; -- cgit v1.2.3