[llvm-commits] [llvm] r123832 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/fold.ll
Nick Lewycky
nicholas at mxc.ca
Wed Jan 19 07:56:12 PST 2011
Author: nicholas
Date: Wed Jan 19 09:56:12 2011
New Revision: 123832
URL: http://llvm.org/viewvc/llvm-project?rev=123832&view=rev
Log:
Add a missing SCEV simplification sext(zext x) --> zext x.
Added:
llvm/trunk/test/Analysis/ScalarEvolution/fold.ll
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=123832&r1=123831&r2=123832&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Wed Jan 19 09:56:12 2011
@@ -994,6 +994,10 @@
if (const SCEVSignExtendExpr *SS = dyn_cast<SCEVSignExtendExpr>(Op))
return getSignExtendExpr(SS->getOperand(), Ty);
+ // sext(zext(x)) --> zext(x)
+ if (const SCEVZeroExtendExpr *SZ = dyn_cast<SCEVZeroExtendExpr>(Op))
+ return getZeroExtendExpr(SZ->getOperand(), Ty);
+
// Before doing any expensive analysis, check to see if we've already
// computed a SCEV for this Op and Ty.
FoldingSetNodeID ID;
Added: llvm/trunk/test/Analysis/ScalarEvolution/fold.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/fold.ll?rev=123832&view=auto
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/fold.ll (added)
+++ llvm/trunk/test/Analysis/ScalarEvolution/fold.ll Wed Jan 19 09:56:12 2011
@@ -0,0 +1,8 @@
+; RUN: opt -analyze -scalar-evolution %s -S | FileCheck %s
+
+define i16 @test(i8 %x) {
+ %A = zext i8 %x to i12
+ %B = sext i12 %A to i16
+; CHECK: zext i8 %x to i16
+ ret i16 %B
+}
More information about the llvm-commits
mailing list