OpenMP runtime functions assume the pointers are aligned to sizeof(pointer), but it is being aligned incorrectly. Fix with the proper alignment in the IR builder.
Details
Details
Diff Detail
Diff Detail
Unit Tests
Unit Tests
Event Timeline
Comment Actions
It looks this issue will not just affect this single variable. It needs to be fixed in getOrCreateInternalVariable.
Comment Actions
Thanks for the review! I have made changes based on the comment. Specify the alignment while making these internal variables.
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp | ||
---|---|---|
4496–4499 | You can go for the slightly more readable version below const DataLayout &DL = M.getDataLayout(); const llvm::Align TypeAlign = DL.getABITypeAlign(Ty); const llvm::Align PtrAlign = DL.getPointerABIAlignment(AddressSpace); GV->setAlignment(std::max(TypeAlign, PtrAlign)); | |
llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp | ||
2753–2754 | GV->getAlignment() should disappear. Can you use the following lines instead? if(const llvm::MaybeAlign Alignment = GV->getAlign()) { EXPECT_EQ(*Alignment, PtrAlign); } |
Comment Actions
I think the diff is based on your previous version instead of trunk. Can you rebase it?
You can go for the slightly more readable version below