forked from OSchip/llvm-project
[InstCombine] Address a couple stylistic issues pointed out by reviewer [NFC]
Better addressing comments from https://reviews.llvm.org/D58290. llvm-svn: 354171
This commit is contained in:
parent
cae6c767e8
commit
8220ecbce1
|
@ -26,8 +26,7 @@ bool isIdempotentRMW(AtomicRMWInst& RMWI) {
|
||||||
// TODO: Handle fadd, fsub?
|
// TODO: Handle fadd, fsub?
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AtomicRMWInst::BinOp Op = RMWI.getOperation();
|
switch(RMWI.getOperation()) {
|
||||||
switch(Op) {
|
|
||||||
case AtomicRMWInst::Add:
|
case AtomicRMWInst::Add:
|
||||||
case AtomicRMWInst::Sub:
|
case AtomicRMWInst::Sub:
|
||||||
case AtomicRMWInst::Or:
|
case AtomicRMWInst::Or:
|
||||||
|
@ -55,12 +54,12 @@ bool isSaturating(AtomicRMWInst& RMWI) {
|
||||||
if(!C)
|
if(!C)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
AtomicRMWInst::BinOp Op = RMWI.getOperation();
|
switch(RMWI.getOperation()) {
|
||||||
switch(Op) {
|
|
||||||
default:
|
default:
|
||||||
// TODO: fadd, fsub w/Nan
|
// TODO: fadd, fsub w/Nan
|
||||||
// Note: We avoid listing xchg to prevent transform cycles.
|
|
||||||
return false;
|
return false;
|
||||||
|
case AtomicRMWInst::Xchg:
|
||||||
|
return true;
|
||||||
case AtomicRMWInst::Or:
|
case AtomicRMWInst::Or:
|
||||||
return C->isAllOnesValue();
|
return C->isAllOnesValue();
|
||||||
case AtomicRMWInst::And:
|
case AtomicRMWInst::And:
|
||||||
|
@ -87,7 +86,8 @@ Instruction *InstCombiner::visitAtomicRMWInst(AtomicRMWInst &RMWI) {
|
||||||
|
|
||||||
// Any atomicrmw op which produces a known result in memory can be
|
// Any atomicrmw op which produces a known result in memory can be
|
||||||
// replaced w/an atomicrmw xchg.
|
// replaced w/an atomicrmw xchg.
|
||||||
if (isSaturating(RMWI)) {
|
if (isSaturating(RMWI) &&
|
||||||
|
RMWI.getOperation() != AtomicRMWInst::Xchg) {
|
||||||
RMWI.setOperation(AtomicRMWInst::Xchg);
|
RMWI.setOperation(AtomicRMWInst::Xchg);
|
||||||
return &RMWI;
|
return &RMWI;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue