Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2187,8 +2187,14 @@ std::pair<Value *, Value *> DFSanFunction::loadShadowFast(
// and then the entire shadow for the second origin pointer (which will be
// chosen by combineOrigins() iff the least-significant half of the wide
// shadow was empty but the other half was not).
Value *WideShadowLo = IRB.CreateShl(
WideShadow, ConstantInt::get(WideShadowTy, WideShadowBitWidth / 2));
Value *WideShadowLo =
F->getParent()->getDataLayout().isLittleEndian()
? IRB.CreateShl(
WideShadow,
ConstantInt::get(WideShadowTy, WideShadowBitWidth / 2))
: IRB.CreateAnd(
WideShadow,
ConstantInt::get(WideShadowTy, 0xFFFFFFFF00000000ULL));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be rewritten in terms of WideShadowBitWidth?

(I think it's something like (1 - (1 << (WideShadowBitWidth / 2))) << (WideShadowBitWidth / 2))

Shadows.push_back(WideShadow);
Origins.push_back(DFS.loadNextOrigin(Pos, OriginAlign, &OriginAddr));

Expand Down