Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmoses committed Nov 12, 2024
1 parent f2f0ae4 commit 50a63aa
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 8 additions & 4 deletions enzyme/Enzyme/JLInstSimplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@ bool jlInstSimplify(llvm::Function &F, TargetLibraryInfo &TLI,
if (auto alias = arePointersGuaranteedNoAlias(
TLI, AA, LI, I.getOperand(0), I.getOperand(1), false)) {

auto repval =
ICmpInst::isTrueWhenEqual(pred)
? ConstantInt::get(I.getType(), 1 - alias.getValue())
: ConstantInt::get(I.getType(), alias.getValue());
#if LLVM_VERSION_MAJOR >= 16
bool val = alias.value();
#else
bool val = alias.getValue();
#endif
auto repval = ICmpInst::isTrueWhenEqual(pred)
? ConstantInt::get(I.getType(), 1 - val)
: ConstantInt::get(I.getType(), val);
I.replaceAllUsesWith(repval);
changed = true;
continue;
Expand Down
4 changes: 4 additions & 0 deletions enzyme/Enzyme/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,11 @@ bool overwritesToMemoryReadBy(const TypeResults *TR, llvm::AAResults &AA,
if (loadPtr && storePtr)
if (auto alias =
arePointersGuaranteedNoAlias(TLI, AA, LI, loadPtr, storePtr, true))
#if LLVM_VERSION_MAJOR >= 16
if (alias.value())
#else
if (alias.getValue())
#endif
return false;

if (!overwritesToMemoryReadByLoop(SE, LI, DT, maybeReader, LoadBegin, LoadEnd,
Expand Down

0 comments on commit 50a63aa

Please sign in to comment.