diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-06-05 21:15:52 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2019-06-05 21:15:52 +0000 |
commit | 663d762c9a5344c9209d1180e823fe22b26c433f (patch) | |
tree | 3b6015944d70fcbf8db4178252a878cd890e662c /llvm/lib | |
parent | c46827c7eda30cd0bc3e70d08670c8dc39fe6166 (diff) | |
download | bcm5719-llvm-663d762c9a5344c9209d1180e823fe22b26c433f.tar.gz bcm5719-llvm-663d762c9a5344c9209d1180e823fe22b26c433f.zip |
NewGVN: Handle addrspacecast
The AllConstant check needs to be moved out of the if/else if chain to
avoid a test regression. The "there is no SimplifyZExt" comment
puzzles me, since there is SimplifyCastInst. Additionally, the
Simplify* calls seem to not see the operand as constant, so this needs
to be tried if the simplify failed.
llvm-svn: 362653
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/NewGVN.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/NewGVN.cpp b/llvm/lib/Transforms/Scalar/NewGVN.cpp index c54da4f72df..412bd235d79 100644 --- a/llvm/lib/Transforms/Scalar/NewGVN.cpp +++ b/llvm/lib/Transforms/Scalar/NewGVN.cpp @@ -1166,9 +1166,9 @@ const Expression *NewGVN::createExpression(Instruction *I) const { SimplifyBinOp(E->getOpcode(), E->getOperand(0), E->getOperand(1), SQ); if (const Expression *SimplifiedE = checkSimplificationResults(E, I, V)) return SimplifiedE; - } else if (auto *BI = dyn_cast<BitCastInst>(I)) { + } else if (auto *CI = dyn_cast<CastInst>(I)) { Value *V = - SimplifyCastInst(BI->getOpcode(), BI->getOperand(0), BI->getType(), SQ); + SimplifyCastInst(CI->getOpcode(), E->getOperand(0), CI->getType(), SQ); if (const Expression *SimplifiedE = checkSimplificationResults(E, I, V)) return SimplifiedE; } else if (isa<GetElementPtrInst>(I)) { @@ -1984,6 +1984,7 @@ NewGVN::performSymbolicEvaluation(Value *V, E = performSymbolicLoadEvaluation(I); break; case Instruction::BitCast: + case Instruction::AddrSpaceCast: E = createExpression(I); break; case Instruction::ICmp: |