Skip to content

Commit

Permalink
[Outline] Fix remapping logic when Tapir targets add constant argumen…
Browse files Browse the repository at this point in the history
…ts to helper functions.
  • Loading branch information
neboat committed Jul 9, 2024
1 parent e4eea14 commit 687f54c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion llvm/lib/Transforms/Tapir/Outline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,11 @@ Function *llvm::CreateHelper(
for (Value *I : Inputs) {
if (VMap.count(I) == 0) { // Is this argument preserved?
DestI->setName(I->getName()+NameSuffix); // Copy the name over...
VMap[I] = &*DestI++; // Add mapping to VMap
if (isa<Constant>(I))
// Don't add this constant input to the VMap, so it won't get remapped
DestI++;
else
VMap[I] = &*DestI++; // Add mapping to VMap
}
// Check for any vector arguments, and record the maximum width of any
// vector argument we find.
Expand Down Expand Up @@ -550,6 +554,8 @@ void llvm::AddAlignmentAssumptions(
for (Value *ArgVal : Args) {
// Ignore arguments to non-pointer types
if (!ArgVal->getType()->isPointerTy()) continue;
// Ignore constant pointer arguments
if (isa<Constant>(ArgVal)) continue;
Argument *Arg = cast<Argument>(VMap[ArgVal]);
// Ignore arguments to non-pointer types
if (!Arg->getType()->isPointerTy()) continue;
Expand Down

0 comments on commit 687f54c

Please sign in to comment.