[llvm] r182125 - R600: Improve texture handling
Tom Stellard
tom at stellard.net
Fri Aug 16 17:09:35 PDT 2013
On Thu, Aug 15, 2013 at 01:57:48AM -0700, Nick Lewycky wrote:
> Vincent Lejeune wrote:
> >Author: vljn
> >Date: Fri May 17 11:50:20 2013
> >New Revision: 182125
> >
> >URL: http://llvm.org/viewvc/llvm-project?rev=182125&view=rev
> >Log:
> >R600: Improve texture handling
>
> [...]
>
> >Added: llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp
> >URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp?rev=182125&view=auto
> >==============================================================================
> >--- llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp (added)
> >+++ llvm/trunk/lib/Target/R600/R600TextureIntrinsicsReplacer.cpp Fri May 17 11:50:20 2013
>
> [...]
>
> >+ void ReplaceTexIntrinsic(CallInst&I, bool hasLOD, FunctionType *FT,
> >+ const char *VanillaInt,
> >+ const char *ShadowInt) {
> >+ Value *Coord = I.getArgOperand(0);
> >+ Value *ResourceId = I.getArgOperand(1);
> >+ Value *SamplerId = I.getArgOperand(2);
> >+
> >+ unsigned TextureType =
> >+ dyn_cast<ConstantInt>(I.getArgOperand(3))->getZExtValue();
>
> This can be zero ...
>
> >+
> >+ unsigned SrcSelect[4] = { 0, 1, 2, 3 };
> >+ unsigned CT[4] = {1, 1, 1, 1};
> >+ Value *Offset[3] = {
> >+ ConstantInt::get(Int32Type, 0),
> >+ ConstantInt::get(Int32Type, 0),
> >+ ConstantInt::get(Int32Type, 0)
> >+ };
> >+ bool useShadowVariant;
> >+
> >+ getAdjustementFromTextureTarget(TextureType, hasLOD, SrcSelect, CT,
> >+ useShadowVariant);
>
> ... which goes through an explicit "case 0: return" in
> getAdjustmentFromTextureTarget instead of the "default:
> llvm_unreachable" ...
>
> >+
> >+ ReplaceCallInst(I, FT, useShadowVariant?ShadowInt:VanillaInt, SrcSelect,
> >+ Offset, ResourceId, SamplerId, CT, Coord);
>
> ... and then useShadowVariant is used uninitialized here. Please fix!
>
I've fixed this in r188599, thanks for spotting it.
-Tom
More information about the llvm-commits
mailing list