diff options
author | David Majnemer <david.majnemer@gmail.com> | 2016-07-29 03:27:26 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2016-07-29 03:27:26 +0000 |
commit | d536f2328ededb3aae6563c721c6134c735f1918 (patch) | |
tree | 3d65c25e2093384cf070d6f3b8be9f9eaffbac78 /llvm/lib/Analysis/Lint.cpp | |
parent | c7de3a101885c5b9b167a82b0be37dfb23551aa2 (diff) | |
download | bcm5719-llvm-d536f2328ededb3aae6563c721c6134c735f1918.tar.gz bcm5719-llvm-d536f2328ededb3aae6563c721c6134c735f1918.zip |
[ConstnatFolding] Teach the folder how to fold ConstantVector
A ConstantVector can have ConstantExpr operands and vice versa.
However, the folder had no ability to fold ConstantVectors which, in
some cases, was an optimization barrier.
Instead, rephrase the folder in terms of Constants instead of
ConstantExprs and teach callers how to deal with failure.
llvm-svn: 277099
Diffstat (limited to 'llvm/lib/Analysis/Lint.cpp')
-rw-r--r-- | llvm/lib/Analysis/Lint.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp index fdf5f55dab9..0b374bad129 100644 --- a/llvm/lib/Analysis/Lint.cpp +++ b/llvm/lib/Analysis/Lint.cpp @@ -680,9 +680,9 @@ Value *Lint::findValueImpl(Value *V, bool OffsetOk, if (Instruction *Inst = dyn_cast<Instruction>(V)) { if (Value *W = SimplifyInstruction(Inst, *DL, TLI, DT, AC)) return findValueImpl(W, OffsetOk, Visited); - } else if (ConstantExpr *CE = dyn_cast<ConstantExpr>(V)) { - if (Value *W = ConstantFoldConstantExpression(CE, *DL, TLI)) - if (W != V) + } else if (auto *C = dyn_cast<Constant>(V)) { + if (Value *W = ConstantFoldConstant(C, *DL, TLI)) + if (W && W != V) return findValueImpl(W, OffsetOk, Visited); } |