diff options
author | Cameron McInally <cameron.mcinally@nyu.edu> | 2019-08-07 14:34:41 +0000 |
---|---|---|
committer | Cameron McInally <cameron.mcinally@nyu.edu> | 2019-08-07 14:34:41 +0000 |
commit | 303b6dbfb47c6e7cc346468aeb0710c2877150e8 (patch) | |
tree | d5eb8e8d55ecae5ac4c7e8ca9591163c267ff9e5 | |
parent | 2e3a07fcb87e44140ff1a203da4d77eff1a78e77 (diff) | |
download | bcm5719-llvm-303b6dbfb47c6e7cc346468aeb0710c2877150e8.tar.gz bcm5719-llvm-303b6dbfb47c6e7cc346468aeb0710c2877150e8.zip |
[EarlyCSE] Add support for unary FNeg to EarlyCSE
Differential Revision: https://reviews.llvm.org/D65815
llvm-svn: 368171
-rw-r--r-- | llvm/lib/Transforms/Scalar/EarlyCSE.cpp | 13 | ||||
-rw-r--r-- | llvm/test/Transforms/EarlyCSE/floatingpoint.ll | 5 |
2 files changed, 9 insertions, 9 deletions
diff --git a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp index f1f07525702..22628ffa3e2 100644 --- a/llvm/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/llvm/lib/Transforms/Scalar/EarlyCSE.cpp @@ -108,11 +108,12 @@ struct SimpleValue { // This can only handle non-void readnone functions. if (CallInst *CI = dyn_cast<CallInst>(Inst)) return CI->doesNotAccessMemory() && !CI->getType()->isVoidTy(); - return isa<CastInst>(Inst) || isa<BinaryOperator>(Inst) || - isa<GetElementPtrInst>(Inst) || isa<CmpInst>(Inst) || - isa<SelectInst>(Inst) || isa<ExtractElementInst>(Inst) || - isa<InsertElementInst>(Inst) || isa<ShuffleVectorInst>(Inst) || - isa<ExtractValueInst>(Inst) || isa<InsertValueInst>(Inst); + return isa<CastInst>(Inst) || isa<UnaryOperator>(Inst) || + isa<BinaryOperator>(Inst) || isa<GetElementPtrInst>(Inst) || + isa<CmpInst>(Inst) || isa<SelectInst>(Inst) || + isa<ExtractElementInst>(Inst) || isa<InsertElementInst>(Inst) || + isa<ShuffleVectorInst>(Inst) || isa<ExtractValueInst>(Inst) || + isa<InsertValueInst>(Inst); } }; @@ -240,7 +241,7 @@ static unsigned getHashValueImpl(SimpleValue Val) { assert((isa<CallInst>(Inst) || isa<GetElementPtrInst>(Inst) || isa<ExtractElementInst>(Inst) || isa<InsertElementInst>(Inst) || - isa<ShuffleVectorInst>(Inst)) && + isa<ShuffleVectorInst>(Inst) || isa<UnaryOperator>(Inst)) && "Invalid/unknown instruction"); // Mix in the opcode. diff --git a/llvm/test/Transforms/EarlyCSE/floatingpoint.ll b/llvm/test/Transforms/EarlyCSE/floatingpoint.ll index de1c1eb4b41..998f86dff75 100644 --- a/llvm/test/Transforms/EarlyCSE/floatingpoint.ll +++ b/llvm/test/Transforms/EarlyCSE/floatingpoint.ll @@ -17,9 +17,8 @@ define <4 x float> @fW( <4 x float> %a) { ; CSE unary fnegs. define void @fX(<4 x float> *%p, <4 x float> %a) { ; CHECK: %x = fneg <4 x float> %a - ; CHECK: %y = fneg <4 x float> %a - ; CHECK-NEXT: store volatile <4 x float> %x, <4 x float>* %p - ; CHECK-NEXT: store volatile <4 x float> %y, <4 x float>* %p + ; CHECK-NEXT: store volatile <4 x float> %x, <4 x float>* %p + ; CHECK-NEXT: store volatile <4 x float> %x, <4 x float>* %p %x = fneg <4 x float> %a %y = fneg <4 x float> %a store volatile <4 x float> %x, <4 x float>* %p |