LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 48651 - [Hexagon] Suspicious 'dead store' in SplatB pattern
Summary: [Hexagon] Suspicious 'dead store' in SplatB pattern
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: Hexagon (show other bugs)
Version: trunk
Hardware: PC Windows NT
: P enhancement
Assignee: Krzysztof Parzyszek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-04 04:47 PST by Simon Pilgrim
Modified: 2021-01-04 08:48 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Pilgrim 2021-01-04 04:47:36 PST
def SplatB: SDNodeXForm<imm, [{
  uint32_t V = N->getZExtValue();
  assert(isUInt<8>(V) || V >> 8 == 0xFFFFFF);
  uint32_t S = V << 24 | V << 16 | V << 8 | V;
  V &= 0xFF;
  return CurDAG->getTargetConstant(S, SDLoc(N), MVT::i32);
}]>;

clang static analyzer reports this as a dead store - but isn't the problem that we need to mask V's bottom 8 bits before S 'splats' it across the 32-bits:

def SplatB: SDNodeXForm<imm, [{
  uint32_t V = N->getZExtValue();
  assert(isUInt<8>(V) || V >> 8 == 0xFFFFFF);
  V &= 0xFF;
  uint32_t S = V << 24 | V << 16 | V << 8 | V;
  return CurDAG->getTargetConstant(S, SDLoc(N), MVT::i32);
}]>;
Comment 1 Krzysztof Parzyszek 2021-01-04 08:48:26 PST
Fixed in https://reviews.llvm.org/rGc55b609b777d.