From: Cameron McInally Date: Wed, 7 Aug 2019 14:34:41 +0000 (+0000) Subject: [EarlyCSE] Add support for unary FNeg to EarlyCSE X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=719f93d82110c7487a7e588c2fbdcada2535e184;p=llvm [EarlyCSE] Add support for unary FNeg to EarlyCSE Differential Revision: https://reviews.llvm.org/D65815 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368171 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/EarlyCSE.cpp b/lib/Transforms/Scalar/EarlyCSE.cpp index f1f07525702..22628ffa3e2 100644 --- a/lib/Transforms/Scalar/EarlyCSE.cpp +++ b/lib/Transforms/Scalar/EarlyCSE.cpp @@ -108,11 +108,12 @@ struct SimpleValue { // This can only handle non-void readnone functions. if (CallInst *CI = dyn_cast(Inst)) return CI->doesNotAccessMemory() && !CI->getType()->isVoidTy(); - return isa(Inst) || isa(Inst) || - isa(Inst) || isa(Inst) || - isa(Inst) || isa(Inst) || - isa(Inst) || isa(Inst) || - isa(Inst) || isa(Inst); + return isa(Inst) || isa(Inst) || + isa(Inst) || isa(Inst) || + isa(Inst) || isa(Inst) || + isa(Inst) || isa(Inst) || + isa(Inst) || isa(Inst) || + isa(Inst); } }; @@ -240,7 +241,7 @@ static unsigned getHashValueImpl(SimpleValue Val) { assert((isa(Inst) || isa(Inst) || isa(Inst) || isa(Inst) || - isa(Inst)) && + isa(Inst) || isa(Inst)) && "Invalid/unknown instruction"); // Mix in the opcode. diff --git a/test/Transforms/EarlyCSE/floatingpoint.ll b/test/Transforms/EarlyCSE/floatingpoint.ll index de1c1eb4b41..998f86dff75 100644 --- a/test/Transforms/EarlyCSE/floatingpoint.ll +++ b/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